OSDN Git Service

* alpha.h, arc.h, arm/aout.h, avr.h, c4x.h, cris.h, d30v.h,
[pf3gnuchains/gcc-fork.git] / gcc / config / mn10200 / mn10200.h
index d69a6b4..3b07679 100644 (file)
@@ -1,6 +1,7 @@
-/* Definitions of target machine for GNU compiler. 
+/* Definitions of target machine for GNU compiler.
    Matsushita MN10200 series
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+   Free Software Foundation, Inc.
    Contributed by Jeff Law (law@cygnus.com).
 
 This file is part of GNU CC.
@@ -20,7 +21,6 @@ along with GNU CC; see the file COPYING.  If not, write to
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-#include "svr4.h"
 
 /* Get rid of svr4.h stuff we don't want/need.  */
 #undef ASM_SPEC
@@ -32,7 +32,7 @@ Boston, MA 02111-1307, USA.  */
 
 /* Names to predefine in the preprocessor for this target machine.  */
 
-#define CPP_PREDEFINES "-D__mn10200__ -D__MN10200__ -D__LONG_MAX__=2147483647L -D__LONG_LONG_MAX__=2147483647L -D__INT_MAX__=32767"
+#define CPP_PREDEFINES "-D__mn10200__ -D__MN10200__"
 
 /* Run-time compilation parameters selecting different hardware subsets.  */
 
@@ -54,7 +54,7 @@ extern int target_flags;
    An empty string NAME is used to identify the default VALUE.  */
 
 #define TARGET_SWITCHES  \
-  {{ "", TARGET_DEFAULT}}
+  {{ "", TARGET_DEFAULT, 0}}
 
 #ifndef TARGET_DEFAULT
 #define TARGET_DEFAULT 0
@@ -81,19 +81,9 @@ extern int target_flags;
    This is not true on the Matsushita MN10200.  */
 #define WORDS_BIG_ENDIAN 0
 
-/* Number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
-   Note that this is not necessarily the width of data type `int';
-   if using 16-bit ints on a 68000, this would still be 32.
-   But on a machine with 16-bit registers, this would be 16.
-
-   This is a white lie.  Registers are really 24bits, but most operations
+/* This is a white lie.  Registers are really 24bits, but most operations
    only operate on 16 bits.   GCC chokes badly if we set this to a value
    that is not a power of two.  */
-#define BITS_PER_WORD          16
-
 /* Width of a word, in units (bytes).  */
 #define UNITS_PER_WORD         2
 
@@ -132,15 +122,6 @@ extern int target_flags;
 
 /* Define this as 1 if `char' should by default be signed; else as 0.  */
 #define DEFAULT_SIGNED_CHAR 0
-
-/* Define results of standard character escape sequences.  */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
 \f
 /* Standard register usage.  */
 
@@ -250,11 +231,11 @@ enum reg_class {
    of length N_REG_CLASSES.  */
 
 #define REG_CLASS_CONTENTS                     \
-{     0,               /* No regs      */      \
-   0x0f,               /* DATA_REGS */         \
-   0xf0,               /* ADDRESS_REGS */      \
-   0xff,               /* GENERAL_REGS */      \
-   0xff,               /* ALL_REGS     */      \
+{     {0},             /* No regs      */      \
+   {0x0f},             /* DATA_REGS */         \
+   {0xf0},             /* ADDRESS_REGS */      \
+   {0xff},             /* GENERAL_REGS */      \
+   {0xff},             /* ALL_REGS     */      \
 }
 
 /* The same information, inverted:
@@ -289,7 +270,7 @@ enum reg_class {
    || (reg_renumber[regno] > 3 && reg_renumber[regno] < FIRST_PSEUDO_REGISTER))
 
 #define REGNO_OK_FOR_INDEX_P(regno) \
-  (((regno) >= 0 && regno < 4) \
+  (IN_RANGE ((regno), 0, 3) \
    || (reg_renumber[regno] >= 0 && reg_renumber[regno] < 4))
 
 
@@ -299,11 +280,11 @@ enum reg_class {
    in some cases it is preferable to use a more restrictive class.  */
 
 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
-  ((GET_MODE (X) != PSImode) ? DATA_REGS : CLASS)
+  ((GET_MODE (X) != PSImode && GET_MODE (X) != VOIDmode) ? DATA_REGS : CLASS)
 
 /* We want to use DATA_REGS for anything that is not PSImode.  */
 #define LIMIT_RELOAD_CLASS(MODE, CLASS) \
-  ((MODE != PSImode) ? DATA_REGS : CLASS)
+  ((MODE != PSImode && MODE != VOIDmode) ? DATA_REGS : CLASS)
 
 /* We have/need secondary reloads on the mn10200.  Mostly to deal
    with problems using address registers.  */
@@ -402,7 +383,7 @@ enum reg_class {
 
    We allow frame pointers to be eliminated when not having one will
    not interfere with debugging.  */
-#define ACCUMULATE_OUTGOING_ARGS
+#define ACCUMULATE_OUTGOING_ARGS 1
 #define FRAME_POINTER_REQUIRED 0
 #define CAN_DEBUG_WITHOUT_FP
 
@@ -437,7 +418,7 @@ enum reg_class {
 #undef SIZE_TYPE
 #undef PTRDIFF_TYPE
 #define SIZE_TYPE "long unsigned int"
-#define PTRDIFF_TYPE "long unsigned int"
+#define PTRDIFF_TYPE "long int"
 
 /* Note sizeof (WCHAR_TYPE) must be equal to the value of WCHAR_TYPE_SIZE!  */
 #undef WCHAR_TYPE
@@ -505,10 +486,12 @@ struct cum_arg { int nbytes; };
    NAMED is nonzero if this argument is a named parameter
     (otherwise it is an extra parameter matching an ellipsis).  */
 
-extern struct rtx_def *function_arg();
 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
   function_arg (&CUM, MODE, TYPE, NAMED)
 
+/* Implement `va_arg'.  */
+#define EXPAND_BUILTIN_VA_ARG(valist, type) \
+  mn10200_va_arg (valist, type)
 \f
 /* For "large" items, we pass them by invisible reference, and the
    callee is responsible for copying the data item if it might be
@@ -525,12 +508,12 @@ extern struct rtx_def *function_arg();
    otherwise, FUNC is 0.   */
    
 #define FUNCTION_VALUE(VALTYPE, FUNC) \
-  gen_rtx (REG, TYPE_MODE (VALTYPE), TYPE_MODE (VALTYPE) == PSImode ? 4 : 0)
+  gen_rtx_REG (TYPE_MODE (VALTYPE), TYPE_MODE (VALTYPE) == PSImode ? 4 : 0)
 
 /* Define how to find the value returned by a library function
    assuming the value has mode MODE.  */
 
-#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, (MODE) == PSImode ? 4 : 0)
+#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, (MODE) == PSImode ? 4 : 0)
 
 /* 1 if N is a possible register number for a function value.  */
 
@@ -591,9 +574,9 @@ extern struct rtx_def *function_arg();
 
 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT)                      \
 {                                                                      \
-  emit_move_insn (gen_rtx (MEM, PSImode, plus_constant ((TRAMP), 20)),  \
+  emit_move_insn (gen_rtx_MEM (PSImode, plus_constant ((TRAMP), 20)),  \
                  (CXT));                                               \
-  emit_move_insn (gen_rtx (MEM, PSImode, plus_constant ((TRAMP), 24)),  \
+  emit_move_insn (gen_rtx_MEM (PSImode, plus_constant ((TRAMP), 24)),  \
                  (FNADDR));                                            \
 }
 
@@ -602,7 +585,7 @@ extern struct rtx_def *function_arg();
 
 #define RETURN_ADDR_RTX(COUNT, FRAME)   \
   ((COUNT == 0)                         \
-   ? gen_rtx (MEM, Pmode, frame_pointer_rtx) \
+   ? gen_rtx_MEM (Pmode, frame_pointer_rtx) \
    : (rtx) 0)
 
 
@@ -646,20 +629,18 @@ extern struct rtx_def *function_arg();
 /* Nonzero if X is a hard reg that can be used as an index
    or if it is a pseudo reg.  */
 #define REG_OK_FOR_INDEX_P(X)  \
-  (GET_MODE (X) == PSImode \
-   && ((REGNO (X) >= 0 && REGNO(X) <= 3) || REGNO (X) >= FIRST_PSEUDO_REGISTER))
+  (IN_RANGE (REGNO (X), 0, 3) || REGNO (X) >= FIRST_PSEUDO_REGISTER)
 /* Nonzero if X is a hard reg that can be used as a base reg
    or if it is a pseudo reg.  */
 #define REG_OK_FOR_BASE_P(X) \
-  (GET_MODE (X) == PSImode \
-   && ((REGNO (X) >= 4 && REGNO(X) <= 8) || REGNO (X) >= FIRST_PSEUDO_REGISTER))
+  (((REGNO (X) >= 4 && REGNO(X) <= 8) || REGNO (X) >= FIRST_PSEUDO_REGISTER))
 #else
 /* Nonzero if X is a hard reg that can be used as an index.  */
 #define REG_OK_FOR_INDEX_P(X) \
-  (GET_MODE (X) == PSImode) && REGNO_OK_FOR_INDEX_P (REGNO (X))
+  REGNO_OK_FOR_INDEX_P (REGNO (X))
 /* Nonzero if X is a hard reg that can be used as a base reg.  */
 #define REG_OK_FOR_BASE_P(X) \
-  (GET_MODE (X) == PSImode) && REGNO_OK_FOR_BASE_P (REGNO (X))
+  REGNO_OK_FOR_BASE_P (REGNO (X))
 #endif
 
 \f
@@ -692,11 +673,9 @@ extern struct rtx_def *function_arg();
   if (GET_CODE (X) == PLUS)                            \
     {                                                  \
       rtx base = 0, index = 0;                         \
-      if (REG_P (XEXP (X, 0))                          \
-         && REG_OK_FOR_BASE_P (XEXP (X, 0)))           \
+      if (RTX_OK_FOR_BASE_P (XEXP (X, 0)))             \
        base = XEXP (X, 0), index = XEXP (X, 1);        \
-      if (REG_P (XEXP (X, 1))                          \
-         && REG_OK_FOR_BASE_P (XEXP (X, 1)))           \
+      if (RTX_OK_FOR_BASE_P (XEXP (X, 1)))             \
        base = XEXP (X, 1), index = XEXP (X, 0);        \
       if (base != 0 && index != 0)                     \
        {                                               \
@@ -736,7 +715,7 @@ extern struct rtx_def *function_arg();
 /* Tell final.c how to eliminate redundant test instructions.  */
 
 /* Here we define machine-dependent flags and fields in cc_status
-   (see `conditions.h').  No extra ones are needed for the vax.  */
+   (see `conditions.h').  No extra ones are needed for the VAX.  */
 
 /* Store in cc_status the expressions
    that the condition codes will describe
@@ -784,7 +763,7 @@ extern struct rtx_def *function_arg();
 
 /* Make moves between different classes more expensive than moves
    within the same class.  */
-#define REGISTER_MOVE_COST(CLASS1, CLASS2)  (CLASS1 != CLASS2 ? 4 : 2)
+#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2)  (CLASS1 != CLASS2 ? 4 : 2)
 
 /* Provide the costs of a rtl expression.  This is in the body of a
    switch on CODE. 
@@ -828,64 +807,12 @@ extern struct rtx_def *function_arg();
 
 #define ASM_APP_OFF "#NO_APP\n"
 
-/* This is how to output an assembler line defining a `double' constant.
-   It is .dfloat or .gfloat, depending.  */
-
-#define ASM_OUTPUT_DOUBLE(FILE, VALUE)                 \
-do { char dstr[30];                                    \
-     REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr);   \
-     fprintf (FILE, "\t.double %s\n", dstr);           \
-   } while (0)
-
-
-/* This is how to output an assembler line defining a `float' constant.  */
-#define ASM_OUTPUT_FLOAT(FILE, VALUE)                  \
-do { char dstr[30];                                    \
-     REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr);   \
-     fprintf (FILE, "\t.float %s\n", dstr);            \
-   } while (0)
-
-/* This is how to output an assembler line defining an `int' constant.  */
-
-#define ASM_OUTPUT_INT(FILE, VALUE)            \
-( fprintf (FILE, "\t.long "),                  \
-  output_addr_const (FILE, (VALUE)),           \
-  fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants.  */
-
-#define ASM_OUTPUT_SHORT(FILE, VALUE)          \
-( fprintf (FILE, "\t.hword "),                 \
-  output_addr_const (FILE, (VALUE)),           \
-  fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE, VALUE)           \
-( fprintf (FILE, "\t.byte "),                  \
-  output_addr_const (FILE, (VALUE)),           \
-  fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte.  */
-#define ASM_OUTPUT_BYTE(FILE, VALUE)  \
-  fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-/* Define the parentheses used to group arithmetic operations
-   in assembler code.  */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
 /* This says how to output the assembler to define a global
    uninitialized but not common symbol.
    Try to use asm_output_bss to implement this macro.  */
 
-#define ASM_OUTPUT_BSS(FILE, DECL, NAME, SIZE, ROUNDED) \
-  asm_output_bss ((FILE), (DECL), (NAME), (SIZE), (ROUNDED))
-
-/* This is how to output the definition of a user-level label named NAME,
-   such as the label on a static function or variable NAME.  */
-
-#define ASM_OUTPUT_LABEL(FILE, NAME)   \
-  do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
+#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
+  asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
 
 /* This is how to output a command to make the user-level label named NAME
    defined for reference from other files.  */
@@ -897,12 +824,8 @@ do { char dstr[30];                                        \
    `assemble_name' uses this.  */
 
 #undef ASM_OUTPUT_LABELREF
-#define ASM_OUTPUT_LABELREF(FILE, NAME)                  \
-  do {                                            \
-  char* real_name;                                \
-  STRIP_NAME_ENCODING (real_name, (NAME));        \
-  fprintf (FILE, "_%s", real_name);               \
-  } while (0)           
+#define ASM_OUTPUT_LABELREF(FILE, NAME) \
+  fprintf (FILE, "_%s", (*targetm.strip_name_encoding) (NAME))
 
 /* Store in OUTPUT a string (made with alloca) containing
    an assembler-name for a local static variable named NAME.
@@ -947,22 +870,20 @@ do { char dstr[30];                                       \
 
 /* This is how to output an element of a case-vector that is relative.  */
 
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
+#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
   fprintf (FILE, "\t%s .L%d-.L%d\n", ".long", VALUE, REL)
 
 #define ASM_OUTPUT_ALIGN(FILE,LOG)     \
   if ((LOG) != 0)                      \
     fprintf (FILE, "\t.align %d\n", (LOG))
 
-/* We don't have to worry about dbx compatability for the mn10200.  */
+/* We don't have to worry about dbx compatibility for the mn10200.  */
 #define DEFAULT_GDB_EXTENSIONS 1
 
 /* Use stabs debugging info by default.  */
 #undef PREFERRED_DEBUGGING_TYPE
 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
 
-#define DBX_REGISTER_NUMBER(REGNO) REGNO
-
 /* GDB always assumes the current function's frame begins at the value
    of the stack pointer upon entry to the current function.  Accessing
    local variables and parameters passed on the stack is done using the
@@ -984,19 +905,10 @@ do { char dstr[30];                                       \
   ((GET_CODE (X) == PLUS ? OFFSET : 0) \
     + (frame_pointer_needed ? 0 : -total_frame_size ()))
 
-/* Define to use software floating point emulator for REAL_ARITHMETIC and
-   decimal <-> binary conversion. */
-#define REAL_ARITHMETIC
-
 /* Specify the machine mode that this machine uses
    for the index in the tablejump instruction.  */
 #define CASE_VECTOR_MODE Pmode
 
-/* Define this if the case instruction drops through after the table
-   when the index is out of range.  Don't define it if the case insn
-   jumps to the default label instead.  */
-#define CASE_DROPS_THROUGH
-
 /* Dispatch tables on the mn10200 are extremely expensive in terms of code
    and readonly data size.  So we crank up the case threshold value to
    encourage a series of if/else comparisons to implement many small switch
@@ -1013,16 +925,10 @@ do { char dstr[30];                                      \
    fast and more compact code.  */
 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
 
-/* Specify the tree operation to be used to convert reals to integers.  */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
 /* This flag, if defined, says the same insns that convert to a signed fixnum
    also convert validly to an unsigned one.  */
 #define FIXUNS_TRUNC_LIKE_FIX_TRUNC
 
-/* This is the kind of divide that is easiest to do in the general case.  */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
 /* Max number of bytes we can move from memory to memory
    in one reasonably fast instruction.  */
 #define MOVE_MAX       2
@@ -1053,27 +959,23 @@ do { char dstr[30];                                      \
 #define INIT_TARGET_OPTABS \
   do { \
     sdiv_optab->handlers[(int) HImode].libfunc         \
-      = gen_rtx (SYMBOL_REF, Pmode, DIVHI3_LIBCALL);   \
+      = init_one_libfunc (DIVHI3_LIBCALL);             \
     smod_optab->handlers[(int) HImode].libfunc         \
-      = gen_rtx (SYMBOL_REF, Pmode, MODHI3_LIBCALL);   \
+      = init_one_libfunc (MODHI3_LIBCALL);             \
   } while (0)
 
 /* The assembler op to get a word.  */
 
 #define FILE_ASM_OP "\t.file\n"
 
-extern void asm_file_start ();
-extern void print_operand ();
-extern void print_operand_address ();
-extern void expand_prologue ();
-extern void expand_epilogue ();
-extern void notice_update_cc ();
-extern int call_address_operand ();
-extern enum reg_class secondary_reload_class ();
-extern char *emit_a_shift ();
-extern int current_function_needs_context;
-extern char *output_tst ();
-extern int extendpsi_operand ();
-extern int rtx_equal_function_value_matters;
-extern struct rtx_def *zero_dreg;
-extern struct rtx_def *zero_areg;
+#define PREDICATE_CODES                                                        \
+  {"call_address_operand",     { SYMBOL_REF, REG }},                   \
+  {"constant_memory_operand",  { MEM }},                               \
+  {"psimode_truncation_operand",{ PLUS, CONST_INT, CONST_DOUBLE, CONST,        \
+                                 SYMBOL_REF, LABEL_REF, SUBREG, REG, MEM }},\
+  {"extendpsi_operand",                { PLUS, CONST_INT, CONST_DOUBLE, CONST, \
+                                 SYMBOL_REF, LABEL_REF, SUBREG, REG, MEM }}, \
+  {"nshift_operator",          { ASHIFTRT, LSHIFTRT, ASHIFT }},
+
+extern GTY(()) rtx zero_dreg;
+extern GTY(()) rtx zero_areg;