OSDN Git Service

* ginclude/varargs.h: Replace with stub which issues #error.
[pf3gnuchains/gcc-fork.git] / gcc / config / arc / arc.h
index d31ccdb..db8b8d4 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions of target machine for GNU compiler, Argonaut ARC cpu.
-   Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001
+   Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002
    Free Software Foundation, Inc.
 
 This file is part of GNU CC.
@@ -43,13 +43,17 @@ Boston, MA 02111-1307, USA.  */
 #define TARGET_VERSION fprintf (stderr, " (arc)")
 
 /* Names to predefine in the preprocessor for this target machine.  */
-#define CPP_PREDEFINES "-Acpu=arc -Amachine=arc -D__arc__"
-
-/* Additional flags for the preprocessor.  */
-#define CPP_SPEC "\
-%{!mcpu=*:-D__base__} %{mcpu=base:-D__base__} \
-%{EB:-D__big_endian__} \
-"
+#define TARGET_CPU_CPP_BUILTINS()              \
+  do                                           \
+    {                                          \
+       builtin_define ("__arc__");             \
+       if (TARGET_BIG_ENDIAN)                  \
+         builtin_define ("__big_endian__");    \
+       if (arc_cpu_type == 0)                  \
+         builtin_define ("__base__");          \
+       builtin_assert ("cpu=arc");             \
+       builtin_assert ("machine=arc");         \
+    } while (0)
 
 /* Pass -mmangle-cpu if we get -mcpu=*.
    Doing it this way lets one have it on as default with -mcpu=*,
@@ -130,23 +134,6 @@ extern int target_flags;
 /* Non-zero means the cpu has a barrel shifter.  */
 #define TARGET_SHIFTER 0
 
-/* This macro is similar to `TARGET_SWITCHES' but defines names of
-   command options that have values.  Its definition is an
-   initializer with a subgrouping for each command option.
-
-   Each subgrouping contains a string constant, that defines the
-   fixed part of the option name, and the address of a variable. 
-   The variable, type `char *', is set to the variable part of the
-   given option if the fixed part matches.  The actual option name
-   is made by appending `-m' to the specified name.
-
-   Here is an example which defines `-mshort-data-NUMBER'.  If the
-   given option is `-mshort-data-512', the variable `m88k_short_data'
-   will be set to the string `"512"'.
-
-       extern char *m88k_short_data;
-       #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } }  */
-
 extern const char *arc_cpu_string;
 extern const char *arc_text_string,*arc_data_string,*arc_rodata_string;
 
@@ -185,10 +172,6 @@ do {                               \
 \f
 /* Target machine storage layout.  */
 
-/* Define to use software floating point emulator for REAL_ARITHMETIC and
-   decimal <-> binary conversion.  */
-#define REAL_ARITHMETIC
-
 /* Define this if most significant bit is lowest numbered
    in instructions that operate on numbered bit-fields.  */
 #define BITS_BIG_ENDIAN 1
@@ -208,15 +191,6 @@ do {                               \
 #define LIBGCC2_WORDS_BIG_ENDIAN 0
 #endif
 
-/* 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.  */
-#define BITS_PER_WORD 32
-
 /* Width of a word, in units (bytes).  */
 #define UNITS_PER_WORD 4
 
@@ -239,10 +213,6 @@ if (GET_MODE_CLASS (MODE) == MODE_INT              \
 /* Likewise, if the function return value is promoted.  */
 #define PROMOTE_FUNCTION_RETURN
 
-/* Width in bits of a pointer.
-   See also the macro `Pmode' defined below.  */
-#define POINTER_SIZE 32
-
 /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
 #define PARM_BOUNDARY 32
 
@@ -389,6 +359,16 @@ if (GET_MODE_CLASS (MODE) == MODE_INT              \
   48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,              \
   27, 28, 29, 30 }
 
+/* Macro to conditionally modify fixed_regs/call_used_regs.  */
+#define CONDITIONAL_REGISTER_USAGE                     \
+do {                                                   \
+  if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM)       \
+    {                                                  \
+      fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1;         \
+      call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1;     \
+    }                                                  \
+} while (0)
+
 /* Return number of consecutive hard regs needed starting at reg REGNO
    to hold something of mode MODE.
    This is ordinarily the length in words of a value of mode MODE
@@ -397,7 +377,7 @@ if (GET_MODE_CLASS (MODE) == MODE_INT               \
 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.  */
-extern unsigned int arc_hard_regno_mode_ok[];
+extern const unsigned int arc_hard_regno_mode_ok[];
 extern unsigned int arc_mode_class[];
 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
 ((arc_hard_regno_mode_ok[REGNO] & arc_mode_class[MODE]) != 0)
@@ -464,7 +444,7 @@ enum reg_class {
    Return the class number of the smallest class containing
    reg number REGNO.  This could be a conditional expression
    or could index an array.  */
-extern enum reg_class arc_regno_reg_class[];
+extern enum reg_class arc_regno_reg_class[FIRST_PSEUDO_REGISTER];
 #define REGNO_REG_CLASS(REGNO) \
 (arc_regno_reg_class[REGNO])
 
@@ -685,15 +665,9 @@ extern enum reg_class arc_regno_reg_class[];
    a reg.  This includes arguments that have to be passed by reference as the
    pointer to them is passed in a reg if one is available (and that is what
    we're given).
-   When passing arguments NAMED is always 1.  When receiving arguments NAMED
-   is 1 for each argument except the last in a stdarg/varargs function.  In
-   a stdarg function we want to treat the last named arg as named.  In a
-   varargs function we want to treat the last named arg (which is
-   `__builtin_va_alist') as unnamed.
    This macro is only used in this file.  */
-#define PASS_IN_REG_P(CUM, MODE, TYPE, NAMED) \
-((!current_function_varargs || (NAMED))                                        \
- && (CUM) < MAX_ARC_PARM_REGS                                          \
+#define PASS_IN_REG_P(CUM, MODE, TYPE) \
+((CUM) < MAX_ARC_PARM_REGS                                             \
  && ((ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE))                                \
       + ROUND_ADVANCE_ARG ((MODE), (TYPE))                             \
       <= MAX_ARC_PARM_REGS)))
@@ -713,7 +687,7 @@ extern enum reg_class arc_regno_reg_class[];
 /* On the ARC the first MAX_ARC_PARM_REGS args are normally in registers
    and the rest are pushed.  */
 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
-(PASS_IN_REG_P ((CUM), (MODE), (TYPE), (NAMED))                                \
+(PASS_IN_REG_P ((CUM), (MODE), (TYPE)                                \
  ? gen_rtx_REG ((MODE), ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)))     \
  : 0)
 
@@ -1010,15 +984,6 @@ do { \
     goto LABEL;                                \
 }
 \f
-/* Condition code usage.  */
-
-/* Some insns set all condition code flags, some only set the ZNC flags, and
-   some only set the ZN flags.  */
-
-#define EXTRA_CC_MODES \
-       CC(CCZNCmode, "CCZNC") \
-       CC(CCZNmode, "CCZN")
-
 /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
    return the mode to be used for the comparison.  */
 #define SELECT_CC_MODE(OP, X, Y) \
@@ -1126,12 +1091,12 @@ extern const char *arc_text_section, *arc_data_section, *arc_rodata_section;
 #if defined (CRT_INIT) || defined (CRT_FINI)
 #define TEXT_SECTION_ASM_OP    "\t.section .text"
 #else
-#define TEXT_SECTION_ASM_OP    arc_text_section /*"\t.section .text"*/
+#define TEXT_SECTION_ASM_OP    arc_text_section
 #endif
-#define DATA_SECTION_ASM_OP    arc_data_section /*"\t.section .data"*/
+#define DATA_SECTION_ASM_OP    arc_data_section
 
-#undef CONST_SECTION_ASM_OP
-#define CONST_SECTION_ASM_OP   arc_rodata_section /*"\t.section .rodata"*/
+#undef  READONLY_DATA_SECTION_ASM_OP
+#define READONLY_DATA_SECTION_ASM_OP   arc_rodata_section
 
 #define BSS_SECTION_ASM_OP     "\t.section .bss"
 
@@ -1141,35 +1106,6 @@ extern const char *arc_text_section, *arc_data_section, *arc_rodata_section;
    This macro is irrelevant if there is no separate readonly data section.  */
 /*#define JUMP_TABLES_IN_TEXT_SECTION*/
 
-/* Define this macro if references to a symbol must be treated
-   differently depending on something about the variable or
-   function named by the symbol (such as what section it is in).
-
-   The macro definition, if any, is executed immediately after the
-   rtl for DECL or other node is created.
-   The value of the rtl will be a `mem' whose address is a
-   `symbol_ref'.
-
-   The usual thing for this macro to do is to store a flag in the
-   `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
-   name string in the `symbol_ref' (if one bit is not enough
-   information).  */
-
-/* On the ARC, function addresses are not the same as normal addresses.
-   Branch to absolute address insns take an address that is right-shifted
-   by 2.  We encode the fact that we have a function here, and then emit a
-   special assembler op when outputting the address.  */
-#define ENCODE_SECTION_INFO(DECL) \
-do {                                                   \
-  if (TREE_CODE (DECL) == FUNCTION_DECL)               \
-    SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1;   \
-} while (0)
-
-/* Decode SYM_NAME and store the real name part in VAR, sans
-   the characters that encode section info.  Define this macro if
-   ENCODE_SECTION_INFO alters the symbol's name string.  */
-/*#define STRIP_NAME_ENCODING(VAR, SYM_NAME)*/
-
 /* For DWARF.  Marginally different than default so output is "prettier"
    (and consistent with above).  */
 #define PUSHSECTION_ASM_OP "\t.section "
@@ -1186,7 +1122,7 @@ do {                                                      \
    pointer and frame pointer registers.  If this macro is not defined, it
    is up to the machine-dependent files to allocate such a register (if
    necessary).  */
-#define PIC_OFFSET_TABLE_REGNUM 26
+#define PIC_OFFSET_TABLE_REGNUM  (flag_pic ? 26 : INVALID_REGNUM)
 
 /* Define this macro if the register defined by PIC_OFFSET_TABLE_REGNUM is
    clobbered by calls.  Do not define this macro if PIC_OFFSET_TABLE_REGNUM
@@ -1332,7 +1268,7 @@ arc_final_prescan_insn (INSN, OPVEC, NOPERANDS)
 
 /* A C expression which evaluates to true if CODE is a valid
    punctuation character for use in the `PRINT_OPERAND' macro.  */
-extern char arc_punct_chars[];
+extern char arc_punct_chars[256];
 #define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
 arc_punct_chars[(unsigned char) (CHAR)]
 
@@ -1344,12 +1280,7 @@ arc_print_operand (FILE, X, CODE)
 
 /* A C compound statement to output to stdio stream STREAM the
    assembler syntax for an instruction operand that is a memory
-   reference whose address is ADDR.  ADDR is an RTL expression.
-
-   On some machines, the syntax for a symbolic address depends on
-   the section that the address refers to.  On these machines,
-   define the macro `ENCODE_SECTION_INFO' to store the information
-   into the `symbol_ref', and then check for it here.  */
+   reference whose address is ADDR.  ADDR is an RTL expression.  */
 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
 arc_print_operand_address (FILE, ADDR)
 
@@ -1430,12 +1361,6 @@ do { if ((LOG) != 0) fprintf (FILE, "\t.align %d\n", 1 << (LOG)); } while (0)
    done, NIL if none.  */
 #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 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 4