Mercurial > hg > CbC > CbC_gcc
diff gcc/config/mmix/mmix.c @ 67:f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author | nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Mar 2011 17:18:12 +0900 |
parents | b7f97abdc517 |
children | 04ced10e8804 |
line wrap: on
line diff
--- a/gcc/config/mmix/mmix.c Tue May 25 18:58:51 2010 +0900 +++ b/gcc/config/mmix/mmix.c Tue Mar 22 17:18:12 2011 +0900 @@ -30,11 +30,12 @@ #include "hashtab.h" #include "insn-config.h" #include "output.h" +#include "basic-block.h" #include "flags.h" #include "tree.h" #include "function.h" #include "expr.h" -#include "toplev.h" +#include "diagnostic-core.h" #include "recog.h" #include "ggc.h" #include "dwarf2.h" @@ -43,6 +44,7 @@ #include "integrate.h" #include "target.h" #include "target-def.h" +#include "df.h" /* First some local helper definitions. */ #define MMIX_FIRST_GLOBAL_REGNUM 32 @@ -111,6 +113,8 @@ /* Intermediate for insn output. */ static int mmix_output_destination_register; +static void mmix_option_override (void); +static void mmix_asm_output_source_filename (FILE *, const char *); static void mmix_output_shiftvalue_op_from_str (FILE *, const char *, HOST_WIDEST_INT); static void mmix_output_shifted_value (FILE *, HOST_WIDEST_INT); @@ -138,6 +142,14 @@ static enum machine_mode mmix_promote_function_mode (const_tree, enum machine_mode, int *, const_tree, int); +static void mmix_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, + const_tree, bool); +static rtx mmix_function_arg_1 (const CUMULATIVE_ARGS *, enum machine_mode, + const_tree, bool, bool); +static rtx mmix_function_incoming_arg (CUMULATIVE_ARGS *, enum machine_mode, + const_tree, bool); +static rtx mmix_function_arg (CUMULATIVE_ARGS *, enum machine_mode, + const_tree, bool); static rtx mmix_function_value (const_tree, const_tree, bool); static rtx mmix_libcall_value (enum machine_mode, const_rtx); static bool mmix_function_value_regno_p (const unsigned int); @@ -146,6 +158,16 @@ static bool mmix_frame_pointer_required (void); static void mmix_asm_trampoline_template (FILE *); static void mmix_trampoline_init (rtx, tree, rtx); +static void mmix_conditional_register_usage (void); + +/* TARGET_OPTION_OPTIMIZATION_TABLE. */ + +static const struct default_options mmix_option_optimization_table[] = + { + { OPT_LEVELS_1_PLUS, OPT_fregmove, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_NONE, 0, NULL, 0 } + }; /* Target structure macros. Listed by node. See `Using and Porting GCC' for a general description. */ @@ -187,6 +209,11 @@ #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true #undef TARGET_ASM_FILE_END #define TARGET_ASM_FILE_END mmix_file_end +#undef TARGET_ASM_OUTPUT_SOURCE_FILENAME +#define TARGET_ASM_OUTPUT_SOURCE_FILENAME mmix_asm_output_source_filename + +#undef TARGET_CONDITIONAL_REGISTER_USAGE +#define TARGET_CONDITIONAL_REGISTER_USAGE mmix_conditional_register_usage #undef TARGET_RTX_COSTS #define TARGET_RTX_COSTS mmix_rtx_costs @@ -206,6 +233,12 @@ #undef TARGET_FUNCTION_VALUE_REGNO_P #define TARGET_FUNCTION_VALUE_REGNO_P mmix_function_value_regno_p +#undef TARGET_FUNCTION_ARG +#define TARGET_FUNCTION_ARG mmix_function_arg +#undef TARGET_FUNCTION_INCOMING_ARG +#define TARGET_FUNCTION_INCOMING_ARG mmix_function_incoming_arg +#undef TARGET_FUNCTION_ARG_ADVANCE +#define TARGET_FUNCTION_ARG_ADVANCE mmix_function_arg_advance #undef TARGET_STRUCT_VALUE_RTX #define TARGET_STRUCT_VALUE_RTX mmix_struct_value_rtx #undef TARGET_SETUP_INCOMING_VARARGS @@ -228,15 +261,20 @@ #undef TARGET_TRAMPOLINE_INIT #define TARGET_TRAMPOLINE_INIT mmix_trampoline_init +#undef TARGET_OPTION_OVERRIDE +#define TARGET_OPTION_OVERRIDE mmix_option_override +#undef TARGET_OPTION_OPTIMIZATION_TABLE +#define TARGET_OPTION_OPTIMIZATION_TABLE mmix_option_optimization_table + struct gcc_target targetm = TARGET_INITIALIZER; /* Functions that are expansions for target macros. See Target Macros in `Using and Porting GCC'. */ -/* OVERRIDE_OPTIONS. */ - -void -mmix_override_options (void) +/* TARGET_OPTION_OVERRIDE. */ + +static void +mmix_option_override (void) { /* Should we err or should we warn? Hmm. At least we must neutralize it. For example the wrong kind of case-tables will be generated with @@ -263,7 +301,7 @@ static struct machine_function * mmix_init_machine_status (void) { - return GGC_CNEW (struct machine_function); + return ggc_alloc_cleared_machine_function (); } /* DATA_ALIGNMENT. @@ -293,8 +331,8 @@ /* LOCAL_ALIGNMENT. */ -int -mmix_local_alignment (tree type ATTRIBUTE_UNUSED, int basic_align) +unsigned +mmix_local_alignment (tree type ATTRIBUTE_UNUSED, unsigned basic_align) { if (basic_align < 32) return 32; @@ -302,9 +340,9 @@ return basic_align; } -/* CONDITIONAL_REGISTER_USAGE. */ - -void +/* TARGET_CONDITIONAL_REGISTER_USAGE. */ + +static void mmix_conditional_register_usage (void) { int i; @@ -345,9 +383,9 @@ Those two macros must only be applied to function argument registers. FIXME: for their current use in gcc, it'd be better with an explicit specific additional FUNCTION_INCOMING_ARG_REGNO_P - a'la FUNCTION_ARG / FUNCTION_INCOMING_ARG instead of forcing the - target to commit to a fixed mapping and for any unspecified - register use. */ + a'la TARGET_FUNCTION_ARG / TARGET_FUNCTION_INCOMING_ARG instead of + forcing the target to commit to a fixed mapping and for any + unspecified register use. */ int mmix_opposite_regno (int regno, int incoming) @@ -598,15 +636,28 @@ + (fromreg == MMIX_ARG_POINTER_REGNUM ? 0 : 8); } -/* Return an rtx for a function argument to go in a register, and 0 for - one that must go on stack. */ - -rtx -mmix_function_arg (const CUMULATIVE_ARGS *argsp, - enum machine_mode mode, - tree type, - int named ATTRIBUTE_UNUSED, - int incoming) +static void +mmix_function_arg_advance (CUMULATIVE_ARGS *argsp, enum machine_mode mode, + const_tree type, bool named ATTRIBUTE_UNUSED) +{ + int arg_size = MMIX_FUNCTION_ARG_SIZE (mode, type); + + argsp->regs = ((targetm.calls.must_pass_in_stack (mode, type) + || (arg_size > 8 + && !TARGET_LIBFUNC + && !argsp->lib)) + ? (MMIX_MAX_ARGS_IN_REGS) + 1 + : argsp->regs + (7 + arg_size) / 8); +} + +/* Helper function for mmix_function_arg and mmix_function_incoming_arg. */ + +static rtx +mmix_function_arg_1 (const CUMULATIVE_ARGS *argsp, + enum machine_mode mode, + const_tree type, + bool named ATTRIBUTE_UNUSED, + bool incoming) { /* Last-argument marker. */ if (type == void_type_node) @@ -630,6 +681,27 @@ : NULL_RTX; } +/* Return an rtx for a function argument to go in a register, and 0 for + one that must go on stack. */ + +static rtx +mmix_function_arg (CUMULATIVE_ARGS *argsp, + enum machine_mode mode, + const_tree type, + bool named) +{ + return mmix_function_arg_1 (argsp, mode, type, named, false); +} + +static rtx +mmix_function_incoming_arg (CUMULATIVE_ARGS *argsp, + enum machine_mode mode, + const_tree type, + bool named) +{ + return mmix_function_arg_1 (argsp, mode, type, named, true); +} + /* Returns nonzero for everything that goes by reference, 0 for everything that goes by value. */ @@ -1243,9 +1315,9 @@ switch_to_section (data_section); } -/* ASM_OUTPUT_SOURCE_FILENAME. */ - -void +/* TARGET_ASM_OUTPUT_SOURCE_FILENAME. */ + +static void mmix_asm_output_source_filename (FILE *stream, const char *name) { fprintf (stream, "# 1 "); @@ -1833,8 +1905,8 @@ /* DBX_REGISTER_NUMBER. */ -int -mmix_dbx_register_number (int regno) +unsigned +mmix_dbx_register_number (unsigned regno) { /* Adjust the register number to the one it will be output as, dammit. It'd be nice if we could check the assumption that we're filling a @@ -2042,14 +2114,12 @@ offset)), tmpreg); RTX_FRAME_RELATED_P (insn) = 1; - REG_NOTES (insn) - = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - gen_rtx_SET (VOIDmode, - gen_rtx_MEM (DImode, - plus_constant (stack_pointer_rtx, - offset)), - retreg), - REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, + gen_rtx_SET (VOIDmode, + gen_rtx_MEM (DImode, + plus_constant (stack_pointer_rtx, + offset)), + retreg)); offset -= 8; } @@ -2677,7 +2747,7 @@ retval |= (unsigned HOST_WIDEST_INT) CONST_DOUBLE_HIGH (x) - << (HOST_BITS_PER_LONG); + << (HOST_BITS_PER_LONG)/2 << (HOST_BITS_PER_LONG)/2; } else retval = CONST_DOUBLE_HIGH (x);