OSDN Git Service

Apply https://gcc.gnu.org/bugzilla/attachment.cgi?id=28797 for lm32-elf.
[pf3gnuchains/gcc-fork.git] / gcc / config / lm32 / lm32.c
index 2c7131a..fbd823b 100644 (file)
@@ -1,7 +1,7 @@
 /* Subroutines used for code generation on the Lattice Mico32 architecture.
    Contributed by Jon Beniston <jon@beniston.com>
 
-   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
 
    This file is part of GCC.
 
@@ -65,34 +65,25 @@ static rtx emit_add (rtx dest, rtx src0, rtx src1);
 static void expand_save_restore (struct lm32_frame_info *info, int op);
 static void stack_adjust (HOST_WIDE_INT amount);
 static bool lm32_in_small_data_p (const_tree);
-static void lm32_setup_incoming_varargs (CUMULATIVE_ARGS * cum,
+static void lm32_setup_incoming_varargs (cumulative_args_t cum,
                                         enum machine_mode mode, tree type,
                                         int *pretend_size, int no_rtl);
-static bool lm32_rtx_costs (rtx x, int code, int outer_code, int *total,
-                           bool speed);
+static bool lm32_rtx_costs (rtx x, int code, int outer_code, int opno,
+                           int *total, bool speed);
 static bool lm32_can_eliminate (const int, const int);
 static bool
 lm32_legitimate_address_p (enum machine_mode mode, rtx x, bool strict);
 static HOST_WIDE_INT lm32_compute_frame_size (int size);
 static void lm32_option_override (void);
-static rtx lm32_function_arg (CUMULATIVE_ARGS * cum,
+static rtx lm32_function_arg (cumulative_args_t cum,
                              enum machine_mode mode, const_tree type,
                              bool named);
-static void lm32_function_arg_advance (CUMULATIVE_ARGS * cum,
+static void lm32_function_arg_advance (cumulative_args_t cum,
                                       enum machine_mode mode,
                                       const_tree type, bool named);
 
-/* Implement TARGET_OPTION_OPTIMIZATION_TABLE.  */
-static const struct default_options lm32_option_optimization_table[] =
-  {
-    { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 },
-    { OPT_LEVELS_NONE, 0, NULL, 0 }
-  };
-
 #undef TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE lm32_option_override
-#undef TARGET_OPTION_OPTIMIZATION_TABLE
-#define TARGET_OPTION_OPTIMIZATION_TABLE lm32_option_optimization_table
 #undef TARGET_ADDRESS_COST
 #define TARGET_ADDRESS_COST hook_int_rtx_bool_0
 #undef TARGET_RTX_COSTS
@@ -117,8 +108,6 @@ static const struct default_options lm32_option_optimization_table[] =
 #define TARGET_CAN_ELIMINATE lm32_can_eliminate
 #undef TARGET_LEGITIMATE_ADDRESS_P
 #define TARGET_LEGITIMATE_ADDRESS_P lm32_legitimate_address_p
-#undef TARGET_EXCEPT_UNWIND_INFO
-#define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
@@ -631,9 +620,11 @@ lm32_print_operand_address (FILE * file, rtx addr)
     (otherwise it is an extra parameter matching an ellipsis).  */
 
 static rtx
-lm32_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+lm32_function_arg (cumulative_args_t cum_v, enum machine_mode mode,
                   const_tree type, bool named)
 {
+  CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
+
   if (mode == VOIDmode)
     /* Compute operand 2 of the call insn.  */
     return GEN_INT (0);
@@ -648,10 +639,10 @@ lm32_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
 }
 
 static void
-lm32_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+lm32_function_arg_advance (cumulative_args_t cum, enum machine_mode mode,
                           const_tree type, bool named ATTRIBUTE_UNUSED)
 {
-  *cum += LM32_NUM_REGS2 (mode, type);
+  *get_cumulative_args (cum) += LM32_NUM_REGS2 (mode, type);
 }
 
 HOST_WIDE_INT
@@ -684,9 +675,10 @@ lm32_compute_initial_elimination_offset (int from, int to)
 }
 
 static void
-lm32_setup_incoming_varargs (CUMULATIVE_ARGS * cum, enum machine_mode mode,
+lm32_setup_incoming_varargs (cumulative_args_t cum_v, enum machine_mode mode,
                             tree type, int *pretend_size, int no_rtl)
 {
+  CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
   int first_anon_arg;
   tree fntype;
 
@@ -933,7 +925,8 @@ nonpic_symbol_mentioned_p (rtx x)
    scanned.  In either case, *TOTAL contains the cost result.  */
 
 static bool
-lm32_rtx_costs (rtx x, int code, int outer_code, int *total, bool speed)
+lm32_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+               int *total, bool speed)
 {
   enum machine_mode mode = GET_MODE (x);
   bool small_mode;
@@ -1234,15 +1227,3 @@ lm32_move_ok (enum machine_mode mode, rtx operands[2]) {
     return register_or_zero_operand (operands[1], mode);
   return true;
 }
-
-/* Implement LEGITIMATE_CONSTANT_P.  */
-
-bool
-lm32_legitimate_constant_p (rtx x)
-{
-  /* 32-bit addresses require multiple instructions.  */  
-  if (!flag_pic && reloc_operand (x, GET_MODE (x)))
-    return false; 
-  
-  return true;
-}