OSDN Git Service

Merge basic-improvements-branch to trunk
[pf3gnuchains/gcc-fork.git] / gcc / config / m68k / sgs.h
index 588a319..fb799be 100644 (file)
@@ -1,13 +1,13 @@
 /* Definitions of target machine for GNU compiler for m68k targets using
    assemblers derived from AT&T "SGS" releases.
-   Copyright (C) 1991, 1993 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1993, 1996, 2000 Free Software Foundation, Inc.
    Written by Fred Fish (fnf@cygnus.com)
 
 This file is part of GNU CC.
 
 GNU CC is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
+the Free Software Foundation; either version 2, or (at your option)
 any later version.
 
 GNU CC is distributed in the hope that it will be useful,
@@ -17,7 +17,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
 
 /* Control assembler-syntax conditionals in m68k.md and conditionals in
    m68k.h.  Note that some systems may also require SGS_SWAP_W and/or
@@ -29,22 +30,19 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include "m68k/m68k.h"
 
-/* SGS specific assembler pseudo ops. */
+#undef INT_OP_GROUP
+#define INT_OP_GROUP INT_OP_STANDARD
 
-#define        BYTE_ASM_OP             ".byte"
-#define WORD_ASM_OP            ".short"
-#define LONG_ASM_OP            ".long"
-#define SPACE_ASM_OP           ".space"
-#define ALIGN_ASM_OP           ".align"
-#undef GLOBAL_ASM_OP
-#define GLOBAL_ASM_OP          ".global"
-#define SWBEG_ASM_OP           ".swbeg"
-#define SET_ASM_OP             ".set"
+/* SGS specific assembler pseudo ops.  */
 
-#define UNALIGNED_SHORT_ASM_OP ".short"        /* Used in dwarfout.c */
-#define UNALIGNED_INT_ASM_OP   ".long"         /* Used in dwarfout.c */
+#define SPACE_ASM_OP           "\t.space "
+#define ALIGN_ASM_OP           "\t.align "
+#undef GLOBAL_ASM_OP
+#define GLOBAL_ASM_OP          "\t.global "
+#define SWBEG_ASM_OP           "\t.swbeg "
+#define SET_ASM_OP             "\t.set "
 
-#define ASM_PN_FORMAT          "%s_%d"         /* Format for private names */
+#define ASM_PN_FORMAT          "%s_%lu"        /* Format for private names */
 
 /* Here are four prefixes that are used by asm_fprintf to
    facilitate customization for alternate assembler syntaxes.
@@ -59,12 +57,12 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define REGISTER_PREFIX "%"
 
 /* The prefix for local (compiler generated) labels.
-   These labels will not appear in the symbol table. */
+   These labels will not appear in the symbol table.  */
 
 #undef LOCAL_LABEL_PREFIX
 #define LOCAL_LABEL_PREFIX "."
 
-/* The prefix to add to user-visible assembler symbols. */
+/* The prefix to add to user-visible assembler symbols.  */
 
 #undef USER_LABEL_PREFIX
 #define USER_LABEL_PREFIX ""
@@ -101,72 +99,31 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #endif /* defined SUPPORT_SUN_FPA */
 
-/* When using an SGS assembler, modify the name of the artificial label which
-   identifies this file as having been compiled with gcc, and the macro that
-   emits such a label in the assembly output, to use '%' rather than '.' */
-
-#define ASM_IDENTIFY_GCC(FILE)                         \
- { fprintf ((FILE), "%s:\n", "gcc2_compiled%"); }
-
-/* This is how to output an assembler line defining an `int' constant.  */
-/* The SGS assembler doesn't understand ".word". */
-
-#undef ASM_OUTPUT_SHORT
-#define ASM_OUTPUT_SHORT(FILE,VALUE)                   \
-( fprintf ((FILE), "\t%s ", WORD_ASM_OP),              \
-  output_addr_const ((FILE), (VALUE)),                 \
-  fprintf ((FILE), "\n"))
-
-#undef ASM_OUTPUT_LONG_DOUBLE
-#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE)                     \
-do { long l[3];                                                        \
-     REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l);              \
-     fprintf ((FILE), "\t%s 0x%x,0x%x,0x%x\n", LONG_ASM_OP,    \
-            l[0], l[1], l[2]);                                 \
-   } while (0)
-
-/* This is how to output an assembler line defining a `double' constant.  */
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE)                  \
-do { long l[2];                                                \
-     REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l);           \
-     fprintf ((FILE), "\t%s 0x%x,0x%x\n", LONG_ASM_OP, \
-             l[0], l[1]);                              \
-   } while (0)
-
-/* This is how to output an assembler line defining a `float' constant.  */
-
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE)                   \
-do { long l;                                           \
-     REAL_VALUE_TO_TARGET_SINGLE (VALUE, l);           \
-     fprintf ((FILE), "\t%s 0x%x\n", LONG_ASM_OP, l);  \
-   } while (0)
-
 /* This is how to output an assembler line that says to advance the
    location counter to a multiple of 2**LOG bytes.  */
 
 #undef ASM_OUTPUT_ALIGN
 #define ASM_OUTPUT_ALIGN(FILE,LOG)                             \
+do {                                                           \
   if ((LOG) > 0)                                               \
-    fprintf ((FILE), "\t%s \t%u\n", ALIGN_ASM_OP, 1 << (LOG)); \
+    fprintf ((FILE), "%s%u\n", ALIGN_ASM_OP, 1 << (LOG));      \
   else if ((LOG) > 31)                                         \
-    abort ();
+    abort ();                                                  \
+} while (0)
 
 /* The routine used to output null terminated string literals.  We cannot
    use the ".string" pseudo op, because it silently truncates strings to
    1023 bytes.  There is no "partial string op" which works like ".string"
    but doesn't append a null byte, so we can't chop the input string up
    into small pieces and use that.  Our only remaining alternative is to
-   output the string one byte at a time. */
+   output the string one byte at a time.  */
 
 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)                         \
 do {                                                           \
-  register int sp = 0, lp = 0, ch;                             \
-  fprintf ((FILE), "\t%s ", BYTE_ASM_OP);                      \
+  register size_t sp = 0, limit = (LEN);                       \
+  fputs (integer_asm_op (1, TRUE), (FILE));                    \
   do {                                                         \
-    ch = (PTR)[sp];                                            \
+    int ch = (PTR)[sp];                                                \
     if (ch > ' ' && ! (ch & 0x80) && ch != '\\')               \
       {                                                                \
        fprintf ((FILE), "'%c", ch);                            \
@@ -175,24 +132,24 @@ do {                                                              \
       {                                                                \
        fprintf ((FILE), "0x%x", ch);                           \
       }                                                                \
-    if (++sp < (LEN))                                          \
+    if (++sp < limit)                                          \
       {                                                                \
        if ((sp % 10) == 0)                                     \
          {                                                     \
-           fprintf ((FILE), "\n\t%s ", BYTE_ASM_OP);           \
+           fprintf ((FILE), "\n%s", integer_asm_op (1, TRUE)); \
          }                                                     \
        else                                                    \
          {                                                     \
            putc (',', (FILE));                                 \
          }                                                     \
       }                                                                \
-  } while (sp < (LEN));                                                \
+  } while (sp < limit);                                                \
   putc ('\n', (FILE));                                         \
 } while (0)
 
 
 /* SGS based assemblers don't understand #NO_APP and #APP, so just don't
-   bother emitting them. */
+   bother emitting them.  */
 
 #undef ASM_APP_ON
 #define ASM_APP_ON ""
@@ -219,25 +176,25 @@ do {                                                              \
 #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE)      \
   do { long l;                                         \
        REAL_VALUE_TO_TARGET_SINGLE (VALUE, l);         \
-       asm_fprintf ((FILE), "%I0x%x", l);              \
+       asm_fprintf ((FILE), "%I0x%lx", l);             \
      } while (0)
   
 #undef ASM_OUTPUT_DOUBLE_OPERAND
 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)          \
   do { long l[2];                                      \
        REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l);         \
-       asm_fprintf ((FILE), "%I0x%x%08x", l[0], l[1]); \
+       asm_fprintf ((FILE), "%I0x%lx%08lx", l[0], l[1]);\
      } while (0)
 
 /* How to output a block of SIZE zero bytes.  Note that the `space' pseudo,
    when used in the text segment, causes SGS assemblers to output nop insns
-   rather than 0s, so we set ASM_NO_SKIP_IN_TEXT to prevent this. */
+   rather than 0s, so we set ASM_NO_SKIP_IN_TEXT to prevent this.  */
 
 #define ASM_NO_SKIP_IN_TEXT 1
 
 #undef ASM_OUTPUT_SKIP
 #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
-  fprintf (FILE, "\t%s %u\n", SPACE_ASM_OP, (SIZE))
+  fprintf (FILE, "%s%u\n", SPACE_ASM_OP, (SIZE))
 \f
 /* Translate Motorola opcodes such as `jbeq' into SGS opcodes such
    as `beq.w'.
@@ -395,15 +352,15 @@ do {                                                              \
 /* This macro outputs the label at the start of a switch table.  The
    ".swbeg <N>" is an assembler directive that causes the switch table
    size to be inserted into the object code so that disassemblers, for
-   example, can identify that it is the start of a switch table. */
+   example, can identify that it is the start of a switch table.  */
 
 #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE)            \
-  fprintf ((FILE), "\t%s &%d\n", SWBEG_ASM_OP, XVECLEN (PATTERN (TABLE), 1));
+  fprintf ((FILE), "%s&%d\n", SWBEG_ASM_OP, XVECLEN (PATTERN (TABLE), 1));
 
 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLE)                   \
   do {                                                                 \
     ASM_OUTPUT_BEFORE_CASE_LABEL((FILE),(PREFIX),(NUM),(TABLE));       \
-    ASM_OUTPUT_INTERNAL_LABEL((FILE),(PREFIX),(NUM));                  \
+    (*targetm.asm_out.internal_label)((FILE),(PREFIX),(NUM));                  \
   } while (0)
 
 /* At end of a switch table, define LDnnn iff the symbol LInnn was defined.
@@ -412,34 +369,24 @@ do {                                                              \
    we want.  This difference can be accommodated by making the assembler
    define such "LDnnn" to be either "Lnnn-LInnn-2.b", "Lnnn", or any other
    string, as necessary.  This is accomplished via the ASM_OUTPUT_CASE_END
-   macro. */
+   macro.  */
 
 #undef ASM_OUTPUT_CASE_END
 #define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE)            \
 { if (switch_table_difference_label_flag)              \
-    asm_fprintf (FILE, "\t%s %LLD%d,%LL%d-%LLI%d-2.b\n",\
-                SET_ASM_OP, (NUM), (NUM), (NUM))       \
+    asm_fprintf (FILE, "%s%LLD%d,%LL%d-%LLI%d-2.b\n",\
+                SET_ASM_OP, (NUM), (NUM), (NUM));      \
   switch_table_difference_label_flag = 0; }
 
-int switch_table_difference_label_flag;
+extern int switch_table_difference_label_flag;
 
 /* This is how to output an element of a case-vector that is relative.  */
 
 #undef ASM_OUTPUT_ADDR_DIFF_ELT
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL)     \
-  asm_fprintf (FILE, "\t%s %LL%d-%LL%d\n", WORD_ASM_OP, VALUE, REL)
+#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL)       \
+  asm_fprintf (FILE, "%s%LL%d-%LL%d\n", integer_asm_op (2, TRUE), VALUE, REL)
 
 /* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
-   keep switch tables in the text section. */
+   keep switch tables in the text section.  */
    
 #define JUMP_TABLES_IN_TEXT_SECTION 1
-
-/* Store in OUTPUT a string (made with alloca) containing
-   an assembler-name for a local static variable named NAME.
-   LABELNO is an integer which is different for each call.  */
-
-#undef ASM_FORMAT_PRIVATE_NAME
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),   \
-  sprintf ((OUTPUT), ASM_PN_FORMAT, (NAME), (LABELNO)))
-