OSDN Git Service

gcc/
[pf3gnuchains/gcc-fork.git] / gcc / config / iq2000 / iq2000.h
index eef6285..91c5173 100644 (file)
@@ -1,12 +1,13 @@
 /* Definitions of target machine for GNU compiler.  
    Vitesse IQ2000 processors
-   Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   Free Software Foundation, Inc.
 
    This file is part of GCC.
 
    GCC 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 2, or (at your
+   by the Free Software Foundation; either version 3, or (at your
    option) any later version.
 
    GCC is distributed in the hope that it will be useful, but WITHOUT
    License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with GCC; see the file COPYING.  If not, write to the Free
-   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   along with GCC; see the file COPYING3.  If not see
+   <http://www.gnu.org/licenses/>.  */
 
 /* Driver configuration.  */
 
-#undef  SWITCH_TAKES_ARG
-#define SWITCH_TAKES_ARG(CHAR)                                         \
-  (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G')
-
 /* The svr4.h LIB_SPEC with -leval and --*group tacked on */
 #undef  LIB_SPEC
 #define LIB_SPEC "%{!shared:%{!symbolic:--start-group -lc -leval -lgcc --end-group}}"
 #ifndef TARGET_VERSION
 #define TARGET_VERSION TARGET_VERSION_INTERNAL (stderr)
 #endif
-
-#define OVERRIDE_OPTIONS override_options ()
-
-#define CAN_DEBUG_WITHOUT_FP
 \f
 /* Storage Layout.  */
 
 #define BITS_BIG_ENDIAN                0
 #define BYTES_BIG_ENDIAN               1 
 #define WORDS_BIG_ENDIAN               1
-#define LIBGCC2_WORDS_BIG_ENDIAN       1
 #define BITS_PER_WORD                  32
 #define MAX_BITS_PER_WORD              64
 #define UNITS_PER_WORD                         4
 
 #define PCC_BITFIELD_TYPE_MATTERS 1
 
-#define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
-
 \f
 /* Layout of Source Language Data Types.  */
 
@@ -204,6 +193,11 @@ enum reg_class
 
 #define N_REG_CLASSES (int) LIM_REG_CLASSES
 
+#define IRA_COVER_CLASSES      \
+{                              \
+  GR_REGS, LIM_REG_CLASSES     \
+}
+
 #define REG_CLASS_NAMES                                                \
 {                                                              \
   "NO_REGS",                                                   \
@@ -244,20 +238,18 @@ enum reg_class
         ? (GR_REGS)                                            \
         : (CLASS))))
 
-#define SMALL_REGISTER_CLASSES 0
-
 #define CLASS_MAX_NREGS(CLASS, MODE)    \
   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
 /* For IQ2000:
 
    `I' is used for the range of constants an arithmetic insn can
-       actually contain (16 bits signed integers).
+       actually contain (16-bits signed integers).
 
    `J' is used for the range which is just zero (i.e., $r0).
 
    `K' is used for the range of constants a logical insn can actually
-       contain (16 bit zero-extended integers).
+       contain (16-bit zero-extended integers).
 
    `L' is used for the range of constants that be loaded with lui
        (i.e., the bottom 16 bits are zero).
@@ -267,7 +259,7 @@ enum reg_class
 
    `N' is used for constants 0xffffnnnn or 0xnnnnffff
 
-   `O' is a 5 bit zero-extended integer.  */
+   `O' is a 5-bit zero-extended integer.  */
 
 #define CONST_OK_FOR_LETTER_P(VALUE, C)                                        \
   ((C) == 'I' ? ((unsigned HOST_WIDE_INT) ((VALUE) + 0x8000) < 0x10000)        \
@@ -301,10 +293,10 @@ enum reg_class
 
 #define STACK_GROWS_DOWNWARD
 
-/* #define FRAME_GROWS_DOWNWARD */
+#define FRAME_GROWS_DOWNWARD 0
 
 #define STARTING_FRAME_OFFSET                                          \
-  (current_function_outgoing_args_size)
+  (crtl->outgoing_args_size)
 
 /* Use the default value zero.  */
 /* #define STACK_POINTER_OFFSET 0 */
@@ -342,8 +334,6 @@ enum reg_class
 \f
 /* Eliminating the Frame Pointer and the Arg Pointer.  */
 
-#define FRAME_POINTER_REQUIRED 0
-
 #define ELIMINABLE_REGS                                                        \
 {{ ARG_POINTER_REGNUM,   STACK_POINTER_REGNUM},                                \
  { ARG_POINTER_REGNUM,   HARD_FRAME_POINTER_REGNUM},                   \
@@ -353,17 +343,6 @@ enum reg_class
  { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM},                                \
  { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
 
-
-/* We can always eliminate to the frame pointer.  We can eliminate to the 
-   stack pointer unless a frame pointer is needed.  */
-
-#define CAN_ELIMINATE(FROM, TO)                                                \
-  (((FROM) == RETURN_ADDRESS_POINTER_REGNUM && (! leaf_function_p ()   \
-   || (TO == GP_REG_FIRST + 31 && leaf_function_p)))                           \
-  || ((FROM) != RETURN_ADDRESS_POINTER_REGNUM                          \
-   && ((TO) == HARD_FRAME_POINTER_REGNUM                               \
-   || ((TO) == STACK_POINTER_REGNUM && ! frame_pointer_needed))))
-
 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)                    \
         (OFFSET) = iq2000_initial_elimination_offset ((FROM), (TO))
 \f
@@ -375,9 +354,7 @@ enum reg_class
 
 #define REG_PARM_STACK_SPACE(FNDECL) 0
 
-#define OUTGOING_REG_PARM_STACK_SPACE
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
+#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
 
 \f
 /* Function Arguments in Registers.  */
@@ -432,20 +409,9 @@ typedef struct iq2000_args
   (((N) >= GP_ARG_FIRST && (N) <= GP_ARG_LAST))                        
 
 \f
-/* How Scalar Function Values are Returned.  */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC)  iq2000_function_value (VALTYPE, FUNC)
-
-#define LIBCALL_VALUE(MODE)                            \
-  gen_rtx_REG (((GET_MODE_CLASS (MODE) != MODE_INT     \
-                || GET_MODE_SIZE (MODE) >= 4)          \
-               ? (MODE)                                \
-               : SImode),                              \
-              GP_RETURN)
-
 /* On the IQ2000, R2 and R3 are the only register thus used.  */
 
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == GP_RETURN)
+#define FUNCTION_VALUE_REGNO_P(N) iq2000_function_value_regno_p (N)
 
 \f
 /* How Large Values are Returned.  */
@@ -477,51 +443,11 @@ typedef struct iq2000_args
 }
 
 \f
-/* Implementing the Varargs Macros.  */
-
-#define EXPAND_BUILTIN_VA_START(valist, nextarg) \
-  iq2000_va_start (valist, nextarg)
-
-\f
 /* Trampolines for Nested Functions.  */
 
-/* A C statement to output, on the stream FILE, assembler code for a
-   block of data that contains the constant parts of a trampoline.
-   This code should not include a label--the label is taken care of
-   automatically.  */
-
-#define TRAMPOLINE_TEMPLATE(STREAM)                                     \
-{                                                                       \
-  fprintf (STREAM, "\t.word\t0x03e00821\t\t# move   $1,$31\n");                \
-  fprintf (STREAM, "\t.word\t0x04110001\t\t# bgezal $0,.+8\n");                \
-  fprintf (STREAM, "\t.word\t0x00000000\t\t# nop\n");                  \
-  if (Pmode == DImode)                                                 \
-    {                                                                  \
-      fprintf (STREAM, "\t.word\t0xdfe30014\t\t# ld     $3,20($31)\n");        \
-      fprintf (STREAM, "\t.word\t0xdfe2001c\t\t# ld     $2,28($31)\n");        \
-    }                                                                  \
-  else                                                                 \
-    {                                                                  \
-      fprintf (STREAM, "\t.word\t0x8fe30014\t\t# lw     $3,20($31)\n");        \
-      fprintf (STREAM, "\t.word\t0x8fe20018\t\t# lw     $2,24($31)\n");        \
-    }                                                                  \
-  fprintf (STREAM, "\t.word\t0x0060c821\t\t# move   $25,$3 (abicalls)\n"); \
-  fprintf (STREAM, "\t.word\t0x00600008\t\t# jr     $3\n");            \
-  fprintf (STREAM, "\t.word\t0x0020f821\t\t# move   $31,$1\n");                \
-  fprintf (STREAM, "\t.word\t0x00000000\t\t# <function address>\n"); \
-  fprintf (STREAM, "\t.word\t0x00000000\t\t# <static chain value>\n"); \
-}
-
-#define TRAMPOLINE_SIZE (40)
-
-#define TRAMPOLINE_ALIGNMENT 32
-
-#define INITIALIZE_TRAMPOLINE(ADDR, FUNC, CHAIN)                           \
-{                                                                          \
-  rtx addr = ADDR;                                                         \
-    emit_move_insn (gen_rtx_MEM (SImode, plus_constant (addr, 32)), FUNC); \
-    emit_move_insn (gen_rtx_MEM (SImode, plus_constant (addr, 36)), CHAIN);\
-}
+#define TRAMPOLINE_CODE_SIZE  (8*4)
+#define TRAMPOLINE_SIZE       (TRAMPOLINE_CODE_SIZE + 2*GET_MODE_SIZE (Pmode))
+#define TRAMPOLINE_ALIGNMENT  GET_MODE_ALIGNMENT (Pmode)
 
 \f
 /* Addressing Modes.  */
@@ -533,90 +459,8 @@ typedef struct iq2000_args
 
 #define MAX_REGS_PER_ADDRESS 1
 
-#ifdef REG_OK_STRICT
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)                \
-  {                                                    \
-    if (iq2000_legitimate_address_p (MODE, X, 1))      \
-      goto ADDR;                                       \
-  }
-#else
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)                \
-  {                                                    \
-    if (iq2000_legitimate_address_p (MODE, X, 0))      \
-      goto ADDR;                                       \
-  }
-#endif
-
 #define REG_OK_FOR_INDEX_P(X) 0
 
-
-/* For the IQ2000, transform:
-
-       memory(X + <large int>)
-   into:
-       Y = <large int> & ~0x7fff;
-       Z = X + Y
-       memory (Z + (<large int> & 0x7fff));
-*/
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN)                            \
-{                                                                      \
-  rtx xinsn = (X);                                                     \
-                                                                       \
-  if (TARGET_DEBUG_B_MODE)                                             \
-    {                                                                  \
-      GO_PRINTF ("\n========== LEGITIMIZE_ADDRESS\n");                 \
-      GO_DEBUG_RTX (xinsn);                                            \
-    }                                                                  \
-                                                                       \
-  if (iq2000_check_split (X, MODE))            \
-    {                                                                  \
-      X = gen_rtx_LO_SUM (Pmode,                                       \
-                         copy_to_mode_reg (Pmode,                      \
-                                           gen_rtx_HIGH (Pmode, X)),   \
-                         X);                                           \
-      goto WIN;                                                                \
-    }                                                                  \
-                                                                       \
-  if (GET_CODE (xinsn) == PLUS)                                                \
-    {                                                                  \
-      rtx xplus0 = XEXP (xinsn, 0);                                    \
-      rtx xplus1 = XEXP (xinsn, 1);                                    \
-      enum rtx_code code0 = GET_CODE (xplus0);                         \
-      enum rtx_code code1 = GET_CODE (xplus1);                         \
-                                                                       \
-      if (code0 != REG && code1 == REG)                                        \
-       {                                                               \
-         xplus0 = XEXP (xinsn, 1);                                     \
-         xplus1 = XEXP (xinsn, 0);                                     \
-         code0 = GET_CODE (xplus0);                                    \
-         code1 = GET_CODE (xplus1);                                    \
-       }                                                               \
-                                                                       \
-      if (code0 == REG && REG_MODE_OK_FOR_BASE_P (xplus0, MODE)                \
-         && code1 == CONST_INT && !SMALL_INT (xplus1))                 \
-       {                                                               \
-         rtx int_reg = gen_reg_rtx (Pmode);                            \
-         rtx ptr_reg = gen_reg_rtx (Pmode);                            \
-                                                                       \
-         emit_move_insn (int_reg,                                      \
-                         GEN_INT (INTVAL (xplus1) & ~ 0x7fff));        \
-                                                                       \
-         emit_insn (gen_rtx_SET (VOIDmode,                             \
-                                 ptr_reg,                              \
-                                 gen_rtx_PLUS (Pmode, xplus0, int_reg))); \
-                                                                       \
-         X = plus_constant (ptr_reg, INTVAL (xplus1) & 0x7fff);        \
-         goto WIN;                                                     \
-       }                                                               \
-    }                                                                  \
-                                                                       \
-  if (TARGET_DEBUG_B_MODE)                                             \
-    GO_PRINTF ("LEGITIMIZE_ADDRESS could not fix.\n");                 \
-}
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {}
-
 #define LEGITIMATE_CONSTANT_P(X) (1)
 
 \f
@@ -627,7 +471,7 @@ typedef struct iq2000_args
 #define MEMORY_MOVE_COST(MODE,CLASS,TO_P)      \
   (TO_P ? 2 : 16)
 
-#define BRANCH_COST 2
+#define BRANCH_COST(speed_p, predictable_p) 2
 
 #define SLOW_BYTE_ACCESS 1
 
@@ -716,13 +560,6 @@ typedef struct iq2000_args
 #define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS)                     \
   final_prescan_insn (INSN, OPVEC, NOPERANDS)
 
-/* See iq2000.c for the IQ2000 specific codes.  */
-#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) iq2000_print_operand_punct[CODE]
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
-
 #define DBR_OUTPUT_SEQEND(STREAM)                                      \
 do                                                                     \
   {                                                                    \
@@ -757,7 +594,8 @@ while (0)
 
 #undef ASM_OUTPUT_SKIP
 #define ASM_OUTPUT_SKIP(STREAM,SIZE)                                   \
-  fprintf (STREAM, "\t.space\t%u\n", (SIZE))
+  fprintf (STREAM, "\t.space\t" HOST_WIDE_INT_PRINT_UNSIGNED "\n",     \
+           (unsigned HOST_WIDE_INT)(SIZE))
 
 #define ASM_OUTPUT_ALIGN(STREAM,LOG)                                   \
   if ((LOG) != 0)                                                      \
@@ -779,23 +617,6 @@ while (0)
 \f
 /* Miscellaneous Parameters.  */
 
-#define PREDICATE_CODES                                                        \
-  {"uns_arith_operand",                { REG, CONST_INT, SUBREG }},            \
-  {"arith_operand",            { REG, CONST_INT, SUBREG }},            \
-  {"small_int",                        { CONST_INT }},                         \
-  {"large_int",                        { CONST_INT }},                         \
-  {"reg_or_0_operand",         { REG, CONST_INT, CONST_DOUBLE, SUBREG }}, \
-  {"simple_memory_operand",    { MEM, SUBREG }},                       \
-  {"equality_op",              { EQ, NE }},                            \
-  {"cmp_op",                   { EQ, NE, GT, GE, GTU, GEU, LT, LE,     \
-                                 LTU, LEU }},                          \
-  {"pc_or_label_operand",      { PC, LABEL_REF }},                     \
-  {"call_insn_operand",                { CONST_INT, CONST, SYMBOL_REF, REG}},  \
-  {"move_operand",             { CONST_INT, CONST_DOUBLE, CONST,       \
-                                 SYMBOL_REF, LABEL_REF, SUBREG,        \
-                                 REG, MEM}},                           \
-  {"power_of_2_operand",       { CONST_INT }},
-
 #define CASE_VECTOR_MODE SImode
 
 #define WORD_REGISTER_OPERATIONS
@@ -852,11 +673,6 @@ enum processor_type
 /* Recast the cpu class to be the cpu attribute.  */
 #define iq2000_cpu_attr ((enum attr_cpu) iq2000_tune)
 
-/* Functions to change what output section we are using.  */
-extern void            rdata_section (void);
-extern void            sdata_section (void);
-extern void            sbss_section  (void);
-
 #define BITMASK_UPPER16        ((unsigned long) 0xffff << 16)  /* 0xffff0000 */
 #define BITMASK_LOWER16        ((unsigned long) 0xffff)        /* 0x0000ffff */
 
@@ -996,9 +812,9 @@ extern void         sbss_section  (void);
 /* Tell prologue and epilogue if register REGNO should be saved / restored.  */
 
 #define MUST_SAVE_REGISTER(regno) \
((regs_ever_live[regno] && !call_used_regs[regno])                    \
 ((df_regs_ever_live_p (regno) && !call_used_regs[regno])             \
   || (regno == HARD_FRAME_POINTER_REGNUM && frame_pointer_needed)      \
-  || (regno == (GP_REG_FIRST + 31) && regs_ever_live[GP_REG_FIRST + 31]))
+   || (regno == (GP_REG_FIRST + 31) && df_regs_ever_live_p (GP_REG_FIRST + 31)))
 
 /* ALIGN FRAMES on double word boundaries */
 #ifndef IQ2000_STACK_ALIGN
@@ -1062,13 +878,6 @@ extern void               sbss_section  (void);
   ((LENGTH) = iq2000_adjust_insn_length ((INSN), (LENGTH)))
 
 \f
-/* A list of predicates that do special things with modes, and so
-   should not elicit warnings for VOIDmode match_operand.  */
-
-#define SPECIAL_MODE_PREDICATES \
-  "pc_or_label_operand",
-
-\f
 
 
 /* How to tell the debugger about changes of source files.  */
@@ -1093,27 +902,12 @@ extern void              sbss_section  (void);
 #define SDATA_SECTION_ASM_OP   "\t.sdata"      /* Small data.  */
 
 \f
-/* See iq2000_expand_prologue's use of loadgp for when this should be
-   true.  */
-
-#define DONT_ACCESS_GBLS_AFTER_EPILOGUE 0
-\f
-/* List of all IQ2000 punctuation characters used by print_operand.  */
-extern char iq2000_print_operand_punct[256];
-
 /* The target cpu for optimization and scheduling.  */
 extern enum processor_type iq2000_tune;
 
 /* Which instruction set architecture to use.  */
 extern int iq2000_isa;
 
-/* Cached operands, and operator to compare for use in set/branch/trap
-   on condition codes.  */
-extern rtx branch_cmp[2];
-
-/* What type of branch to use.  */
-extern enum cmp_type branch_type;
-
 enum iq2000_builtins
 {
   IQ2000_BUILTIN_ADO16,