diff options
Diffstat (limited to 'gcc/config/rs6000/rs6000.c')
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 1528 |
1 files changed, 545 insertions, 983 deletions
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 7ff59de6b76..ae702fc012b 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -198,129 +198,126 @@ struct builtin_description const enum rs6000_builtins code; }; -static bool rs6000_function_ok_for_sibcall PARAMS ((tree, tree)); -static int num_insns_constant_wide PARAMS ((HOST_WIDE_INT)); -static void validate_condition_mode - PARAMS ((enum rtx_code, enum machine_mode)); -static rtx rs6000_generate_compare PARAMS ((enum rtx_code)); -static void rs6000_maybe_dead PARAMS ((rtx)); -static void rs6000_emit_stack_tie PARAMS ((void)); -static void rs6000_frame_related PARAMS ((rtx, rtx, HOST_WIDE_INT, rtx, rtx)); -static rtx spe_synthesize_frame_save PARAMS ((rtx)); -static bool spe_func_has_64bit_regs_p PARAMS ((void)); -static void emit_frame_save PARAMS ((rtx, rtx, enum machine_mode, - unsigned int, int, int)); -static rtx gen_frame_mem_offset PARAMS ((enum machine_mode, rtx, int)); -static void rs6000_emit_allocate_stack PARAMS ((HOST_WIDE_INT, int)); -static unsigned rs6000_hash_constant PARAMS ((rtx)); -static unsigned toc_hash_function PARAMS ((const void *)); -static int toc_hash_eq PARAMS ((const void *, const void *)); -static int constant_pool_expr_1 PARAMS ((rtx, int *, int *)); -static bool constant_pool_expr_p PARAMS ((rtx)); -static bool toc_relative_expr_p PARAMS ((rtx)); -static bool legitimate_small_data_p PARAMS ((enum machine_mode, rtx)); -static bool legitimate_offset_address_p PARAMS ((enum machine_mode, rtx, int)); -static bool legitimate_indexed_address_p PARAMS ((rtx, int)); -static bool legitimate_indirect_address_p PARAMS ((rtx, int)); -static bool legitimate_lo_sum_address_p PARAMS ((enum machine_mode, rtx, int)); -static struct machine_function * rs6000_init_machine_status PARAMS ((void)); -static bool rs6000_assemble_integer PARAMS ((rtx, unsigned int, int)); +static bool rs6000_function_ok_for_sibcall (tree, tree); +static int num_insns_constant_wide (HOST_WIDE_INT); +static void validate_condition_mode (enum rtx_code, enum machine_mode); +static rtx rs6000_generate_compare (enum rtx_code); +static void rs6000_maybe_dead (rtx); +static void rs6000_emit_stack_tie (void); +static void rs6000_frame_related (rtx, rtx, HOST_WIDE_INT, rtx, rtx); +static rtx spe_synthesize_frame_save (rtx); +static bool spe_func_has_64bit_regs_p (void); +static void emit_frame_save (rtx, rtx, enum machine_mode, + unsigned int, int, int); +static rtx gen_frame_mem_offset (enum machine_mode, rtx, int); +static void rs6000_emit_allocate_stack (HOST_WIDE_INT, int); +static unsigned rs6000_hash_constant (rtx); +static unsigned toc_hash_function (const void *); +static int toc_hash_eq (const void *, const void *); +static int constant_pool_expr_1 (rtx, int *, int *); +static bool constant_pool_expr_p (rtx); +static bool toc_relative_expr_p (rtx); +static bool legitimate_small_data_p (enum machine_mode, rtx); +static bool legitimate_offset_address_p (enum machine_mode, rtx, int); +static bool legitimate_indexed_address_p (rtx, int); +static bool legitimate_indirect_address_p (rtx, int); +static bool legitimate_lo_sum_address_p (enum machine_mode, rtx, int); +static struct machine_function * rs6000_init_machine_status (void); +static bool rs6000_assemble_integer (rtx, unsigned int, int); #ifdef HAVE_GAS_HIDDEN -static void rs6000_assemble_visibility PARAMS ((tree, int)); +static void rs6000_assemble_visibility (tree, int); #endif -static int rs6000_ra_ever_killed PARAMS ((void)); -static tree rs6000_handle_longcall_attribute PARAMS ((tree *, tree, tree, int, bool *)); +static int rs6000_ra_ever_killed (void); +static tree rs6000_handle_longcall_attribute (tree *, tree, tree, int, bool *); extern const struct attribute_spec rs6000_attribute_table[]; -static void rs6000_set_default_type_attributes PARAMS ((tree)); -static void rs6000_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); -static void rs6000_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); -static void rs6000_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT, - HOST_WIDE_INT, tree)); -static rtx rs6000_emit_set_long_const PARAMS ((rtx, - HOST_WIDE_INT, HOST_WIDE_INT)); -static void rs6000_file_start PARAMS ((void)); +static void rs6000_set_default_type_attributes (tree); +static void rs6000_output_function_prologue (FILE *, HOST_WIDE_INT); +static void rs6000_output_function_epilogue (FILE *, HOST_WIDE_INT); +static void rs6000_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, + HOST_WIDE_INT, tree); +static rtx rs6000_emit_set_long_const (rtx, HOST_WIDE_INT, HOST_WIDE_INT); +static void rs6000_file_start (void); #if TARGET_ELF -static unsigned int rs6000_elf_section_type_flags PARAMS ((tree, const char *, - int)); -static void rs6000_elf_asm_out_constructor PARAMS ((rtx, int)); -static void rs6000_elf_asm_out_destructor PARAMS ((rtx, int)); -static void rs6000_elf_select_section PARAMS ((tree, int, - unsigned HOST_WIDE_INT)); -static void rs6000_elf_unique_section PARAMS ((tree, int)); -static void rs6000_elf_select_rtx_section PARAMS ((enum machine_mode, rtx, - unsigned HOST_WIDE_INT)); -static void rs6000_elf_encode_section_info PARAMS ((tree, rtx, int)) +static unsigned int rs6000_elf_section_type_flags (tree, const char *, int); +static void rs6000_elf_asm_out_constructor (rtx, int); +static void rs6000_elf_asm_out_destructor (rtx, int); +static void rs6000_elf_select_section (tree, int, unsigned HOST_WIDE_INT); +static void rs6000_elf_unique_section (tree, int); +static void rs6000_elf_select_rtx_section (enum machine_mode, rtx, + unsigned HOST_WIDE_INT); +static void rs6000_elf_encode_section_info (tree, rtx, int) ATTRIBUTE_UNUSED; -static bool rs6000_elf_in_small_data_p PARAMS ((tree)); +static bool rs6000_elf_in_small_data_p (tree); #endif #if TARGET_XCOFF -static void rs6000_xcoff_asm_globalize_label PARAMS ((FILE *, const char *)); -static void rs6000_xcoff_asm_named_section PARAMS ((const char *, unsigned int)); -static void rs6000_xcoff_select_section PARAMS ((tree, int, - unsigned HOST_WIDE_INT)); -static void rs6000_xcoff_unique_section PARAMS ((tree, int)); -static void rs6000_xcoff_select_rtx_section PARAMS ((enum machine_mode, rtx, - unsigned HOST_WIDE_INT)); -static const char * rs6000_xcoff_strip_name_encoding PARAMS ((const char *)); -static unsigned int rs6000_xcoff_section_type_flags PARAMS ((tree, const char *, int)); -static void rs6000_xcoff_file_start PARAMS ((void)); -static void rs6000_xcoff_file_end PARAMS ((void)); +static void rs6000_xcoff_asm_globalize_label (FILE *, const char *); +static void rs6000_xcoff_asm_named_section (const char *, unsigned int); +static void rs6000_xcoff_select_section (tree, int, unsigned HOST_WIDE_INT); +static void rs6000_xcoff_unique_section (tree, int); +static void rs6000_xcoff_select_rtx_section (enum machine_mode, rtx, + unsigned HOST_WIDE_INT); +static const char * rs6000_xcoff_strip_name_encoding (const char *); +static unsigned int rs6000_xcoff_section_type_flags (tree, const char *, int); +static void rs6000_xcoff_file_start (void); +static void rs6000_xcoff_file_end (void); #endif #if TARGET_MACHO -static bool rs6000_binds_local_p PARAMS ((tree)); +static bool rs6000_binds_local_p (tree); #endif -static int rs6000_use_dfa_pipeline_interface PARAMS ((void)); -static int rs6000_variable_issue PARAMS ((FILE *, int, rtx, int)); -static bool rs6000_rtx_costs PARAMS ((rtx, int, int, int *)); -static int rs6000_adjust_cost PARAMS ((rtx, rtx, rtx, int)); -static int rs6000_adjust_priority PARAMS ((rtx, int)); -static int rs6000_issue_rate PARAMS ((void)); -static int rs6000_use_sched_lookahead PARAMS ((void)); - -static void rs6000_init_builtins PARAMS ((void)); -static rtx rs6000_expand_unop_builtin PARAMS ((enum insn_code, tree, rtx)); -static rtx rs6000_expand_binop_builtin PARAMS ((enum insn_code, tree, rtx)); -static rtx rs6000_expand_ternop_builtin PARAMS ((enum insn_code, tree, rtx)); -static rtx rs6000_expand_builtin PARAMS ((tree, rtx, rtx, enum machine_mode, int)); -static void altivec_init_builtins PARAMS ((void)); -static void rs6000_common_init_builtins PARAMS ((void)); - -static void enable_mask_for_builtins PARAMS ((struct builtin_description *, +static int rs6000_use_dfa_pipeline_interface (void); +static int rs6000_variable_issue (FILE *, int, rtx, int); +static bool rs6000_rtx_costs (rtx, int, int, int *); +static int rs6000_adjust_cost (rtx, rtx, rtx, int); +static int rs6000_adjust_priority (rtx, int); +static int rs6000_issue_rate (void); +static int rs6000_use_sched_lookahead (void); + +static void rs6000_init_builtins (void); +static rtx rs6000_expand_unop_builtin (enum insn_code, tree, rtx); +static rtx rs6000_expand_binop_builtin (enum insn_code, tree, rtx); +static rtx rs6000_expand_ternop_builtin (enum insn_code, tree, rtx); +static rtx rs6000_expand_builtin (tree, rtx, rtx, enum machine_mode, int); +static void altivec_init_builtins (void); +static void rs6000_common_init_builtins (void); + +static void enable_mask_for_builtins (struct builtin_description *, int, enum rs6000_builtins, - enum rs6000_builtins)); -static void spe_init_builtins PARAMS ((void)); -static rtx spe_expand_builtin PARAMS ((tree, rtx, bool *)); -static rtx spe_expand_predicate_builtin PARAMS ((enum insn_code, tree, rtx)); -static rtx spe_expand_evsel_builtin PARAMS ((enum insn_code, tree, rtx)); -static int rs6000_emit_int_cmove PARAMS ((rtx, rtx, rtx, rtx)); - -static rtx altivec_expand_builtin PARAMS ((tree, rtx, bool *)); -static rtx altivec_expand_ld_builtin PARAMS ((tree, rtx, bool *)); -static rtx altivec_expand_st_builtin PARAMS ((tree, rtx, bool *)); -static rtx altivec_expand_dst_builtin PARAMS ((tree, rtx, bool *)); -static rtx altivec_expand_abs_builtin PARAMS ((enum insn_code, tree, rtx)); -static rtx altivec_expand_predicate_builtin PARAMS ((enum insn_code, const char *, tree, rtx)); -static rtx altivec_expand_stv_builtin PARAMS ((enum insn_code, tree)); -static void rs6000_parse_abi_options PARAMS ((void)); -static void rs6000_parse_alignment_option PARAMS ((void)); -static void rs6000_parse_tls_size_option PARAMS ((void)); + enum rs6000_builtins); +static void spe_init_builtins (void); +static rtx spe_expand_builtin (tree, rtx, bool *); +static rtx spe_expand_predicate_builtin (enum insn_code, tree, rtx); +static rtx spe_expand_evsel_builtin (enum insn_code, tree, rtx); +static int rs6000_emit_int_cmove (rtx, rtx, rtx, rtx); + +static rtx altivec_expand_builtin (tree, rtx, bool *); +static rtx altivec_expand_ld_builtin (tree, rtx, bool *); +static rtx altivec_expand_st_builtin (tree, rtx, bool *); +static rtx altivec_expand_dst_builtin (tree, rtx, bool *); +static rtx altivec_expand_abs_builtin (enum insn_code, tree, rtx); +static rtx altivec_expand_predicate_builtin (enum insn_code, + const char *, tree, rtx); +static rtx altivec_expand_stv_builtin (enum insn_code, tree); +static void rs6000_parse_abi_options (void); +static void rs6000_parse_alignment_option (void); +static void rs6000_parse_tls_size_option (void); static void rs6000_parse_yes_no_option (const char *, const char *, int *); -static int first_altivec_reg_to_save PARAMS ((void)); -static unsigned int compute_vrsave_mask PARAMS ((void)); -static void is_altivec_return_reg PARAMS ((rtx, void *)); -static rtx generate_set_vrsave PARAMS ((rtx, rs6000_stack_t *, int)); -int easy_vector_constant PARAMS ((rtx, enum machine_mode)); -static int easy_vector_same PARAMS ((rtx, enum machine_mode)); -static bool is_ev64_opaque_type PARAMS ((tree)); -static rtx rs6000_dwarf_register_span PARAMS ((rtx)); -static rtx rs6000_legitimize_tls_address PARAMS ((rtx, enum tls_model)); -static rtx rs6000_tls_get_addr PARAMS ((void)); -static rtx rs6000_got_sym PARAMS ((void)); -static inline int rs6000_tls_symbol_ref_1 PARAMS ((rtx *, void *)); -static const char *rs6000_get_some_local_dynamic_name PARAMS ((void)); -static int rs6000_get_some_local_dynamic_name_1 PARAMS ((rtx *, void *)); +static int first_altivec_reg_to_save (void); +static unsigned int compute_vrsave_mask (void); +static void is_altivec_return_reg (rtx, void *); +static rtx generate_set_vrsave (rtx, rs6000_stack_t *, int); +int easy_vector_constant (rtx, enum machine_mode); +static int easy_vector_same (rtx, enum machine_mode); +static bool is_ev64_opaque_type (tree); +static rtx rs6000_dwarf_register_span (rtx); +static rtx rs6000_legitimize_tls_address (rtx, enum tls_model); +static rtx rs6000_tls_get_addr (void); +static rtx rs6000_got_sym (void); +static inline int rs6000_tls_symbol_ref_1 (rtx *, void *); +static const char *rs6000_get_some_local_dynamic_name (void); +static int rs6000_get_some_local_dynamic_name_1 (rtx *, void *); static rtx rs6000_complex_function_value (enum machine_mode); -static rtx rs6000_spe_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree); +static rtx rs6000_spe_function_arg (CUMULATIVE_ARGS *, + enum machine_mode, tree); /* Hash table stuff for keeping track of TOC entries. */ @@ -501,8 +498,7 @@ struct gcc_target targetm = TARGET_INITIALIZER; type and sometimes adjust other TARGET_ options. */ void -rs6000_override_options (default_cpu) - const char *default_cpu; +rs6000_override_options (const char *default_cpu) { size_t i, j; struct rs6000_cpu_select *ptr; @@ -888,7 +884,7 @@ rs6000_parse_yes_no_option (const char *name, const char *value, int *flag) /* Handle -mabi= options. */ static void -rs6000_parse_abi_options () +rs6000_parse_abi_options (void) { if (rs6000_abi_string == 0) return; @@ -911,7 +907,7 @@ rs6000_parse_abi_options () /* Handle -malign-XXXXXX options. */ static void -rs6000_parse_alignment_option () +rs6000_parse_alignment_option (void) { if (rs6000_alignment_string == 0 || ! strcmp (rs6000_alignment_string, "power")) @@ -926,7 +922,7 @@ rs6000_parse_alignment_option () /* Validate and record the size specified with the -mtls-size option. */ static void -rs6000_parse_tls_size_option () +rs6000_parse_tls_size_option (void) { if (rs6000_tls_size_string == 0) return; @@ -941,16 +937,14 @@ rs6000_parse_tls_size_option () } void -optimization_options (level, size) - int level ATTRIBUTE_UNUSED; - int size ATTRIBUTE_UNUSED; +optimization_options (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED) { } /* Do anything needed at the start of the asm file. */ static void -rs6000_file_start () +rs6000_file_start (void) { size_t i; char buffer[80]; @@ -1006,7 +1000,7 @@ rs6000_file_start () /* Return nonzero if this function is known to have a null epilogue. */ int -direct_return () +direct_return (void) { if (reload_completed) { @@ -1028,18 +1022,15 @@ direct_return () /* Returns 1 always. */ int -any_operand (op, mode) - rtx op ATTRIBUTE_UNUSED; - enum machine_mode mode ATTRIBUTE_UNUSED; +any_operand (rtx op ATTRIBUTE_UNUSED, + enum machine_mode mode ATTRIBUTE_UNUSED) { return 1; } /* Returns 1 if op is the count register. */ int -count_register_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +count_register_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { if (GET_CODE (op) != REG) return 0; @@ -1055,9 +1046,7 @@ count_register_operand (op, mode) /* Returns 1 if op is an altivec register. */ int -altivec_register_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +altivec_register_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { return (register_operand (op, mode) @@ -1067,9 +1056,7 @@ altivec_register_operand (op, mode) } int -xer_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +xer_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { if (GET_CODE (op) != REG) return 0; @@ -1084,9 +1071,7 @@ xer_operand (op, mode) by such constants completes more quickly. */ int -s8bit_cint_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +s8bit_cint_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { return ( GET_CODE (op) == CONST_INT && (INTVAL (op) >= -128 && INTVAL (op) <= 127)); @@ -1095,9 +1080,7 @@ s8bit_cint_operand (op, mode) /* Return 1 if OP is a constant that can fit in a D field. */ int -short_cint_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +short_cint_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { return (GET_CODE (op) == CONST_INT && CONST_OK_FOR_LETTER_P (INTVAL (op), 'I')); @@ -1106,9 +1089,7 @@ short_cint_operand (op, mode) /* Similar for an unsigned D field. */ int -u_short_cint_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +u_short_cint_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { return (GET_CODE (op) == CONST_INT && CONST_OK_FOR_LETTER_P (INTVAL (op) & GET_MODE_MASK (mode), 'K')); @@ -1117,9 +1098,7 @@ u_short_cint_operand (op, mode) /* Return 1 if OP is a CONST_INT that cannot fit in a signed D field. */ int -non_short_cint_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +non_short_cint_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { return (GET_CODE (op) == CONST_INT && (unsigned HOST_WIDE_INT) (INTVAL (op) + 0x8000) >= 0x10000); @@ -1129,9 +1108,7 @@ non_short_cint_operand (op, mode) and an exact power of 2. */ int -exact_log2_cint_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +exact_log2_cint_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { return (GET_CODE (op) == CONST_INT && INTVAL (op) > 0 @@ -1142,9 +1119,7 @@ exact_log2_cint_operand (op, mode) ctr, or lr). */ int -gpc_reg_operand (op, mode) - rtx op; - enum machine_mode mode; +gpc_reg_operand (rtx op, enum machine_mode mode) { return (register_operand (op, mode) && (GET_CODE (op) != REG @@ -1157,9 +1132,7 @@ gpc_reg_operand (op, mode) CR field. */ int -cc_reg_operand (op, mode) - rtx op; - enum machine_mode mode; +cc_reg_operand (rtx op, enum machine_mode mode) { return (register_operand (op, mode) && (GET_CODE (op) != REG @@ -1171,9 +1144,7 @@ cc_reg_operand (op, mode) CR field that isn't CR0. */ int -cc_reg_not_cr0_operand (op, mode) - rtx op; - enum machine_mode mode; +cc_reg_not_cr0_operand (rtx op, enum machine_mode mode) { return (register_operand (op, mode) && (GET_CODE (op) != REG @@ -1186,9 +1157,7 @@ cc_reg_not_cr0_operand (op, mode) mode unless MODE is VOIDmode. */ int -reg_or_short_operand (op, mode) - rtx op; - enum machine_mode mode; +reg_or_short_operand (rtx op, enum machine_mode mode) { return short_cint_operand (op, mode) || gpc_reg_operand (op, mode); } @@ -1197,9 +1166,7 @@ reg_or_short_operand (op, mode) valid for a D-field. */ int -reg_or_neg_short_operand (op, mode) - rtx op; - enum machine_mode mode; +reg_or_neg_short_operand (rtx op, enum machine_mode mode) { if (GET_CODE (op) == CONST_INT) return CONST_OK_FOR_LETTER_P (INTVAL (op), 'P'); @@ -1212,9 +1179,7 @@ reg_or_neg_short_operand (op, mode) mode unless MODE is VOIDmode. */ int -reg_or_aligned_short_operand (op, mode) - rtx op; - enum machine_mode mode; +reg_or_aligned_short_operand (rtx op, enum machine_mode mode) { if (gpc_reg_operand (op, mode)) return 1; @@ -1229,9 +1194,7 @@ reg_or_aligned_short_operand (op, mode) high-order 16 bits are zero. */ int -reg_or_u_short_operand (op, mode) - rtx op; - enum machine_mode mode; +reg_or_u_short_operand (rtx op, enum machine_mode mode) { return u_short_cint_operand (op, mode) || gpc_reg_operand (op, mode); } @@ -1240,9 +1203,7 @@ reg_or_u_short_operand (op, mode) constant integer. */ int -reg_or_cint_operand (op, mode) - rtx op; - enum machine_mode mode; +reg_or_cint_operand (rtx op, enum machine_mode mode) { return (GET_CODE (op) == CONST_INT || gpc_reg_operand (op, mode)); } @@ -1251,9 +1212,7 @@ reg_or_cint_operand (op, mode) 32-bit signed constant integer. */ int -reg_or_arith_cint_operand (op, mode) - rtx op; - enum machine_mode mode; +reg_or_arith_cint_operand (rtx op, enum machine_mode mode) { return (gpc_reg_operand (op, mode) || (GET_CODE (op) == CONST_INT @@ -1268,9 +1227,7 @@ reg_or_arith_cint_operand (op, mode) signed constant integer valid for 64-bit addition. */ int -reg_or_add_cint64_operand (op, mode) - rtx op; - enum machine_mode mode; +reg_or_add_cint64_operand (rtx op, enum machine_mode mode) { return (gpc_reg_operand (op, mode) || (GET_CODE (op) == CONST_INT @@ -1287,9 +1244,7 @@ reg_or_add_cint64_operand (op, mode) signed constant integer valid for 64-bit subtraction. */ int -reg_or_sub_cint64_operand (op, mode) - rtx op; - enum machine_mode mode; +reg_or_sub_cint64_operand (rtx op, enum machine_mode mode) { return (gpc_reg_operand (op, mode) || (GET_CODE (op) == CONST_INT @@ -1306,9 +1261,7 @@ reg_or_sub_cint64_operand (op, mode) 32-bit unsigned constant integer. */ int -reg_or_logical_cint_operand (op, mode) - rtx op; - enum machine_mode mode; +reg_or_logical_cint_operand (rtx op, enum machine_mode mode) { if (GET_CODE (op) == CONST_INT) { @@ -1339,9 +1292,7 @@ reg_or_logical_cint_operand (op, mode) /* Return 1 if the operand is an operand that can be loaded via the GOT. */ int -got_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +got_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { return (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == CONST @@ -1352,9 +1303,7 @@ got_operand (op, mode) the GOT (labels involving addition aren't allowed). */ int -got_no_const_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +got_no_const_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { return (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == LABEL_REF); } @@ -1363,8 +1312,7 @@ got_no_const_operand (op, mode) integer register. */ static int -num_insns_constant_wide (value) - HOST_WIDE_INT value; +num_insns_constant_wide (HOST_WIDE_INT value) { /* signed constant loadable with {cal|addi} */ if (CONST_OK_FOR_LETTER_P (value, 'I')) @@ -1398,9 +1346,7 @@ num_insns_constant_wide (value) } int -num_insns_constant (op, mode) - rtx op; - enum machine_mode mode; +num_insns_constant (rtx op, enum machine_mode mode) { if (GET_CODE (op) == CONST_INT) { @@ -1477,9 +1423,7 @@ num_insns_constant (op, mode) safely read CONST_DOUBLE_{LOW,HIGH}. */ int -easy_fp_constant (op, mode) - rtx op; - enum machine_mode mode; +easy_fp_constant (rtx op, enum machine_mode mode) { if (GET_CODE (op) != CONST_DOUBLE || GET_MODE (op) != mode @@ -1553,9 +1497,7 @@ easy_fp_constant (op, mode) /* Return nonzero if all elements of a vector have the same value. */ static int -easy_vector_same (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +easy_vector_same (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { int units, i, cst; @@ -1574,9 +1516,7 @@ easy_vector_same (op, mode) register without using memory. */ int -easy_vector_constant (op, mode) - rtx op; - enum machine_mode mode; +easy_vector_constant (rtx op, enum machine_mode mode) { int cst, cst2; @@ -1625,9 +1565,7 @@ easy_vector_constant (op, mode) /* Same as easy_vector_constant but only for EASY_VECTOR_15_ADD_SELF. */ int -easy_vector_constant_add_self (op, mode) - rtx op; - enum machine_mode mode; +easy_vector_constant_add_self (rtx op, enum machine_mode mode) { int cst; @@ -1640,8 +1578,7 @@ easy_vector_constant_add_self (op, mode) } const char * -output_vec_const_move (operands) - rtx *operands; +output_vec_const_move (rtx *operands) { int cst, cst2; enum machine_mode mode; @@ -1701,18 +1638,14 @@ output_vec_const_move (operands) /* Return 1 if the operand is the constant 0. This works for scalars as well as vectors. */ int -zero_constant (op, mode) - rtx op; - enum machine_mode mode; +zero_constant (rtx op, enum machine_mode mode) { return op == CONST0_RTX (mode); } /* Return 1 if the operand is 0.0. */ int -zero_fp_constant (op, mode) - rtx op; - enum machine_mode mode; +zero_fp_constant (rtx op, enum machine_mode mode) { return GET_MODE_CLASS (mode) == MODE_FLOAT && op == CONST0_RTX (mode); } @@ -1723,9 +1656,7 @@ zero_fp_constant (op, mode) recognize volatile references where its safe. */ int -volatile_mem_operand (op, mode) - rtx op; - enum machine_mode mode; +volatile_mem_operand (rtx op, enum machine_mode mode) { if (GET_CODE (op) != MEM) return 0; @@ -1748,9 +1679,7 @@ volatile_mem_operand (op, mode) /* Return 1 if the operand is an offsettable memory operand. */ int -offsettable_mem_operand (op, mode) - rtx op; - enum machine_mode mode; +offsettable_mem_operand (rtx op, enum machine_mode mode) { return ((GET_CODE (op) == MEM) && offsettable_address_p (reload_completed || reload_in_progress, @@ -1761,9 +1690,7 @@ offsettable_mem_operand (op, mode) memory. */ int -mem_or_easy_const_operand (op, mode) - rtx op; - enum machine_mode mode; +mem_or_easy_const_operand (rtx op, enum machine_mode mode) { return memory_operand (op, mode) || easy_fp_constant (op, mode); } @@ -1772,9 +1699,7 @@ mem_or_easy_const_operand (op, mode) that can be used as the operand of a `mode' add insn. */ int -add_operand (op, mode) - rtx op; - enum machine_mode mode; +add_operand (rtx op, enum machine_mode mode) { if (GET_CODE (op) == CONST_INT) return (CONST_OK_FOR_LETTER_P (INTVAL (op), 'I') @@ -1786,9 +1711,7 @@ add_operand (op, mode) /* Return 1 if OP is a constant but not a valid add_operand. */ int -non_add_cint_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +non_add_cint_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { return (GET_CODE (op) == CONST_INT && !CONST_OK_FOR_LETTER_P (INTVAL (op), 'I') @@ -1799,9 +1722,7 @@ non_add_cint_operand (op, mode) can be used as the operand of an OR or XOR insn on the RS/6000. */ int -logical_operand (op, mode) - rtx op; - enum machine_mode mode; +logical_operand (rtx op, enum machine_mode mode) { HOST_WIDE_INT opl, oph; @@ -1838,9 +1759,7 @@ logical_operand (op, mode) above), but could be split into one. */ int -non_logical_cint_operand (op, mode) - rtx op; - enum machine_mode mode; +non_logical_cint_operand (rtx op, enum machine_mode mode) { return ((GET_CODE (op) == CONST_INT || GET_CODE (op) == CONST_DOUBLE) && ! logical_operand (op, mode) @@ -1853,9 +1772,7 @@ non_logical_cint_operand (op, mode) away and confuse the making of MB and ME. */ int -mask_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +mask_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { HOST_WIDE_INT c, lsb; @@ -1897,9 +1814,7 @@ mask_operand (op, mode) /* Return 1 for the PowerPC64 rlwinm corner case. */ int -mask_operand_wrap (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +mask_operand_wrap (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { HOST_WIDE_INT c, lsb; @@ -1928,9 +1843,7 @@ mask_operand_wrap (op, mode) confuses the making of MB and ME. */ int -mask64_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +mask64_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { if (GET_CODE (op) == CONST_INT) { @@ -1961,9 +1874,7 @@ mask64_operand (op, mode) rldicr machine insns. */ int -mask64_2_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +mask64_2_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { if (GET_CODE (op) == CONST_INT) { @@ -2010,9 +1921,7 @@ mask64_2_operand (op, mode) /* Generates shifts and masks for a pair of rldicl or rldicr insns to implement ANDing by the mask IN. */ void -build_mask64_2_operands (in, out) - rtx in; - rtx *out; +build_mask64_2_operands (rtx in, rtx *out) { #if HOST_BITS_PER_WIDE_INT >= 64 unsigned HOST_WIDE_INT c, lsb, m1, m2; @@ -2083,9 +1992,7 @@ build_mask64_2_operands (in, out) that can be used as the operand of a PowerPC64 logical AND insn. */ int -and64_operand (op, mode) - rtx op; - enum machine_mode mode; +and64_operand (rtx op, enum machine_mode mode) { if (fixed_regs[CR0_REGNO]) /* CR0 not available, don't do andi./andis. */ return (gpc_reg_operand (op, mode) || mask64_operand (op, mode)); @@ -2097,9 +2004,7 @@ and64_operand (op, mode) with two rldicl or rldicr insns. */ int -and64_2_operand (op, mode) - rtx op; - enum machine_mode mode; +and64_2_operand (rtx op, enum machine_mode mode) { if (fixed_regs[CR0_REGNO]) /* CR0 not available, don't do andi./andis. */ return gpc_reg_operand (op, mode) || mask64_2_operand (op, mode); @@ -2111,9 +2016,7 @@ and64_2_operand (op, mode) constant that can be used as the operand of an RS/6000 logical AND insn. */ int -and_operand (op, mode) - rtx op; - enum machine_mode mode; +and_operand (rtx op, enum machine_mode mode) { if (fixed_regs[CR0_REGNO]) /* CR0 not available, don't do andi./andis. */ return (gpc_reg_operand (op, mode) || mask_operand (op, mode)); @@ -2124,9 +2027,7 @@ and_operand (op, mode) /* Return 1 if the operand is a general register or memory operand. */ int -reg_or_mem_operand (op, mode) - rtx op; - enum machine_mode mode; +reg_or_mem_operand (rtx op, enum machine_mode mode) { return (gpc_reg_operand (op, mode) || memory_operand (op, mode) @@ -2138,9 +2039,7 @@ reg_or_mem_operand (op, mode) instruction. */ int -lwa_operand (op, mode) - rtx op; - enum machine_mode mode; +lwa_operand (rtx op, enum machine_mode mode) { rtx inner = op; @@ -2159,9 +2058,7 @@ lwa_operand (op, mode) /* Return 1 if the operand, used inside a MEM, is a SYMBOL_REF. */ int -symbol_ref_operand (op, mode) - rtx op; - enum machine_mode mode; +symbol_ref_operand (rtx op, enum machine_mode mode) { if (mode != VOIDmode && GET_MODE (op) != mode) return 0; @@ -2174,9 +2071,7 @@ symbol_ref_operand (op, mode) to CALL. This is a SYMBOL_REF, a pseudo-register, LR or CTR. */ int -call_operand (op, mode) - rtx op; - enum machine_mode mode; +call_operand (rtx op, enum machine_mode mode) { if (mode != VOIDmode && GET_MODE (op) != mode) return 0; @@ -2192,9 +2087,8 @@ call_operand (op, mode) this file. */ int -current_file_function_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +current_file_function_operand (rtx op, + enum machine_mode mode ATTRIBUTE_UNUSED) { return (GET_CODE (op) == SYMBOL_REF && (DEFAULT_ABI != ABI_AIX || SYMBOL_REF_FUNCTION_P (op)) @@ -2205,9 +2099,7 @@ current_file_function_operand (op, mode) /* Return 1 if this operand is a valid input for a move insn. */ int -input_operand (op, mode) - rtx op; - enum machine_mode mode; +input_operand (rtx op, enum machine_mode mode) { /* Memory is always valid. */ if (memory_operand (op, mode)) @@ -2267,9 +2159,8 @@ input_operand (op, mode) /* Return 1 for an operand in small memory on V.4/eabi. */ int -small_data_operand (op, mode) - rtx op ATTRIBUTE_UNUSED; - enum machine_mode mode ATTRIBUTE_UNUSED; +small_data_operand (rtx op ATTRIBUTE_UNUSED, + enum machine_mode mode ATTRIBUTE_UNUSED) { #if TARGET_ELF rtx sym_ref; @@ -2327,10 +2218,7 @@ altivec_in_gprs_p (rtx op0, rtx op1) /* Subroutines of rs6000_legitimize_address and rs6000_legitimate_address. */ static int -constant_pool_expr_1 (op, have_sym, have_toc) - rtx op; - int *have_sym; - int *have_toc; +constant_pool_expr_1 (rtx op, int *have_sym, int *have_toc) { switch (GET_CODE(op)) { @@ -2368,8 +2256,7 @@ constant_pool_expr_1 (op, have_sym, have_toc) } static bool -constant_pool_expr_p (op) - rtx op; +constant_pool_expr_p (rtx op) { int have_sym = 0; int have_toc = 0; @@ -2377,8 +2264,7 @@ constant_pool_expr_p (op) } static bool -toc_relative_expr_p (op) - rtx op; +toc_relative_expr_p (rtx op) { int have_sym = 0; int have_toc = 0; @@ -2389,8 +2275,7 @@ toc_relative_expr_p (op) #define SPE_CONST_OFFSET_OK(x) (((x) & ~0xf8) == 0) bool -legitimate_constant_pool_address_p (x) - rtx x; +legitimate_constant_pool_address_p (rtx x) { return (TARGET_TOC && GET_CODE (x) == PLUS @@ -2400,9 +2285,7 @@ legitimate_constant_pool_address_p (x) } static bool -legitimate_small_data_p (mode, x) - enum machine_mode mode; - rtx x; +legitimate_small_data_p (enum machine_mode mode, rtx x) { return (DEFAULT_ABI == ABI_V4 && !flag_pic && !TARGET_TOC @@ -2411,10 +2294,7 @@ legitimate_small_data_p (mode, x) } static bool -legitimate_offset_address_p (mode, x, strict) - enum machine_mode mode; - rtx x; - int strict; +legitimate_offset_address_p (enum machine_mode mode, rtx x, int strict) { unsigned HOST_WIDE_INT offset, extra; @@ -2473,9 +2353,7 @@ legitimate_offset_address_p (mode, x, strict) } static bool -legitimate_indexed_address_p (x, strict) - rtx x; - int strict; +legitimate_indexed_address_p (rtx x, int strict) { rtx op0, op1; @@ -2494,18 +2372,13 @@ legitimate_indexed_address_p (x, strict) } static inline bool -legitimate_indirect_address_p (x, strict) - rtx x; - int strict; +legitimate_indirect_address_p (rtx x, int strict) { return GET_CODE (x) == REG && INT_REG_OK_FOR_BASE_P (x, strict); } static bool -legitimate_lo_sum_address_p (mode, x, strict) - enum machine_mode mode; - rtx x; - int strict; +legitimate_lo_sum_address_p (enum machine_mode mode, rtx x, int strict) { if (GET_CODE (x) != LO_SUM) return false; @@ -2558,10 +2431,8 @@ legitimate_lo_sum_address_p (mode, x, strict) load the other things into a register and return the sum. */ rtx -rs6000_legitimize_address (x, oldx, mode) - rtx x; - rtx oldx ATTRIBUTE_UNUSED; - enum machine_mode mode; +rs6000_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED, + enum machine_mode mode) { if (GET_CODE (x) == SYMBOL_REF) { @@ -2674,7 +2545,7 @@ rs6000_legitimize_address (x, oldx, mode) static GTY(()) rtx rs6000_tls_symbol; static rtx -rs6000_tls_get_addr () +rs6000_tls_get_addr (void) { if (!rs6000_tls_symbol) rs6000_tls_symbol = init_one_libfunc ("__tls_get_addr"); @@ -2686,7 +2557,7 @@ rs6000_tls_get_addr () static GTY(()) rtx rs6000_got_symbol; static rtx -rs6000_got_sym () +rs6000_got_sym (void) { if (!rs6000_got_symbol) { @@ -2702,9 +2573,7 @@ rs6000_got_sym () this (thread-local) address. */ static rtx -rs6000_legitimize_tls_address (addr, model) - rtx addr; - enum tls_model model; +rs6000_legitimize_tls_address (rtx addr, enum tls_model model) { rtx dest, insn; @@ -2890,9 +2759,7 @@ rs6000_legitimize_tls_address (addr, model) instruction definitions. */ int -rs6000_tls_symbol_ref (x, mode) - rtx x; - enum machine_mode mode ATTRIBUTE_UNUSED; +rs6000_tls_symbol_ref (rtx x, enum machine_mode mode ATTRIBUTE_UNUSED) { return RS6000_SYMBOL_REF_TLS_P (x); } @@ -2900,8 +2767,7 @@ rs6000_tls_symbol_ref (x, mode) /* Return 1 if X contains a thread-local symbol. */ bool -rs6000_tls_referenced_p (x) - rtx x; +rs6000_tls_referenced_p (rtx x) { return for_each_rtx (&x, &rs6000_tls_symbol_ref_1, 0); } @@ -2910,9 +2776,7 @@ rs6000_tls_referenced_p (x) rs6000_tls_symbol_ref except for the type of the unused argument. */ static inline int -rs6000_tls_symbol_ref_1 (x, data) - rtx *x; - void *data ATTRIBUTE_UNUSED; +rs6000_tls_symbol_ref_1 (rtx *x, void *data ATTRIBUTE_UNUSED) { return RS6000_SYMBOL_REF_TLS_P (*x); } @@ -2938,13 +2802,8 @@ rs6000_tls_symbol_ref_1 (x, data) The Darwin code is inside #if TARGET_MACHO because only then is machopic_function_base_name() defined. */ rtx -rs6000_legitimize_reload_address (x, mode, opnum, type, ind_levels, win) - rtx x; - enum machine_mode mode; - int opnum; - int type; - int ind_levels ATTRIBUTE_UNUSED; - int *win; +rs6000_legitimize_reload_address (rtx x, enum machine_mode mode, + int opnum, int type, int ind_levels ATTRIBUTE_UNUSED, int *win) { /* We must recognize output that we have already generated ourselves. */ if (GET_CODE (x) == PLUS @@ -3080,10 +2939,7 @@ rs6000_legitimize_reload_address (x, mode, opnum, type, ind_levels, win) adjacent memory cells are accessed by adding word-sized offsets during assembly output. */ int -rs6000_legitimate_address (mode, x, reg_ok_strict) - enum machine_mode mode; - rtx x; - int reg_ok_strict; +rs6000_legitimate_address (enum machine_mode mode, rtx x, int reg_ok_strict) { if (RS6000_SYMBOL_REF_TLS_P (x)) return 0; @@ -3132,8 +2988,7 @@ rs6000_legitimate_address (mode, x, reg_ok_strict) sub-words of a TFmode operand, which is what we had before. */ bool -rs6000_mode_dependent_address (addr) - rtx addr; +rs6000_mode_dependent_address (rtx addr) { switch (GET_CODE (addr)) { @@ -3166,10 +3021,8 @@ rs6000_mode_dependent_address (addr) insns, zero is returned and no insns and emitted. */ rtx -rs6000_emit_set_const (dest, mode, source, n) - rtx dest, source; - enum machine_mode mode; - int n ATTRIBUTE_UNUSED; +rs6000_emit_set_const (rtx dest, enum machine_mode mode, + rtx source, int n ATTRIBUTE_UNUSED) { rtx result, insn, set; HOST_WIDE_INT c0, c1; @@ -3231,9 +3084,7 @@ rs6000_emit_set_const (dest, mode, source, n) exponential run times encountered when looking for longer sequences with rs6000_emit_set_const. */ static rtx -rs6000_emit_set_long_const (dest, c1, c2) - rtx dest; - HOST_WIDE_INT c1, c2; +rs6000_emit_set_long_const (rtx dest, HOST_WIDE_INT c1, HOST_WIDE_INT c2) { if (!TARGET_POWERPC64) { @@ -3317,10 +3168,7 @@ rs6000_emit_set_long_const (dest, c1, c2) /* Emit a move from SOURCE to DEST in mode MODE. */ void -rs6000_emit_move (dest, source, mode) - rtx dest; - rtx source; - enum machine_mode mode; +rs6000_emit_move (rtx dest, rtx source, enum machine_mode mode) { rtx operands[2]; operands[0] = dest; @@ -3669,12 +3517,8 @@ rs6000_emit_move (dest, source, mode) so we never return a PARALLEL. */ void -init_cumulative_args (cum, fntype, libname, incoming, libcall) - CUMULATIVE_ARGS *cum; - tree fntype; - rtx libname ATTRIBUTE_UNUSED; - int incoming; - int libcall; +init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype, + rtx libname ATTRIBUTE_UNUSED, int incoming, int libcall) { static CUMULATIVE_ARGS zero_cumulative; @@ -3702,8 +3546,6 @@ init_cumulative_args (cum, fntype, libname, incoming, libcall) else cum->nargs_prototype = 0; - cum->orig_nargs = cum->nargs_prototype; - /* Check for a longcall attribute. */ if (fntype && lookup_attribute ("longcall", TYPE_ATTRIBUTES (fntype)) @@ -3738,21 +3580,52 @@ init_cumulative_args (cum, fntype, libname, incoming, libcall) argument slot. */ enum direction -function_arg_padding (mode, type) - enum machine_mode mode; - tree type; +function_arg_padding (enum machine_mode mode, tree type) { - if (type != 0 && AGGREGATE_TYPE_P (type)) - return upward; +#ifndef AGGREGATE_PADDING_FIXED +#define AGGREGATE_PADDING_FIXED 0 +#endif +#ifndef AGGREGATES_PAD_UPWARD_ALWAYS +#define AGGREGATES_PAD_UPWARD_ALWAYS 0 +#endif + + if (!AGGREGATE_PADDING_FIXED) + { + /* GCC used to pass structures of the same size as integer types as + if they were in fact integers, ignoring FUNCTION_ARG_PADDING. + ie. Structures of size 1 or 2 (or 4 when TARGET_64BIT) were + passed padded downward, except that -mstrict-align further + muddied the water in that multi-component structures of 2 and 4 + bytes in size were passed padded upward. + + The following arranges for best compatibility with previous + versions of gcc, but removes the -mstrict-align dependency. */ + if (BYTES_BIG_ENDIAN) + { + HOST_WIDE_INT size = 0; + + if (mode == BLKmode) + { + if (type && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST) + size = int_size_in_bytes (type); + } + else + size = GET_MODE_SIZE (mode); - /* This is the default definition. */ - return (! BYTES_BIG_ENDIAN - ? upward - : ((mode == BLKmode - ? (type && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST - && int_size_in_bytes (type) < (PARM_BOUNDARY / BITS_PER_UNIT)) - : GET_MODE_BITSIZE (mode) < PARM_BOUNDARY) - ? downward : upward)); + if (size == 1 || size == 2 || size == 4) + return downward; + } + return upward; + } + + if (AGGREGATES_PAD_UPWARD_ALWAYS) + { + if (type != 0 && AGGREGATE_TYPE_P (type)) + return upward; + } + + /* Fall back to the default. */ + return DEFAULT_FUNCTION_ARG_PADDING (mode, type); } /* If defined, a C expression that gives the alignment boundary, in bits, @@ -3762,9 +3635,7 @@ function_arg_padding (mode, type) V.4 wants long longs to be double word aligned. */ int -function_arg_boundary (mode, type) - enum machine_mode mode; - tree type ATTRIBUTE_UNUSED; +function_arg_boundary (enum machine_mode mode, tree type ATTRIBUTE_UNUSED) { if (DEFAULT_ABI == ABI_V4 && (mode == DImode || mode == DFmode)) return 64; @@ -3781,11 +3652,8 @@ function_arg_boundary (mode, type) (TYPE is null for libcalls where that information may not be available.) */ void -function_arg_advance (cum, mode, type, named) - CUMULATIVE_ARGS *cum; - enum machine_mode mode; - tree type; - int named; +function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, + tree type, int named) { cum->nargs_prototype--; @@ -3880,7 +3748,8 @@ function_arg_advance (cum, mode, type, named) /* Determine where to put a SIMD argument on the SPE. */ static rtx -rs6000_spe_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type) +rs6000_spe_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, + tree type) { if (cum->stdarg) { @@ -3938,11 +3807,8 @@ rs6000_spe_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type doesn't support PARALLEL anyway. */ struct rtx_def * -function_arg (cum, mode, type, named) - CUMULATIVE_ARGS *cum; - enum machine_mode mode; - tree type; - int named; +function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, + tree type, int named) { enum rs6000_abi abi = DEFAULT_ABI; @@ -4065,11 +3931,8 @@ function_arg (cum, mode, type, named) For args passed entirely in registers or entirely in memory, zero. */ int -function_arg_partial_nregs (cum, mode, type, named) - CUMULATIVE_ARGS *cum; - enum machine_mode mode; - tree type; - int named ATTRIBUTE_UNUSED; +function_arg_partial_nregs (CUMULATIVE_ARGS *cum, enum machine_mode mode, + tree type, int named ATTRIBUTE_UNUSED) { if (DEFAULT_ABI == ABI_V4) return 0; @@ -4106,11 +3969,9 @@ function_arg_partial_nregs (cum, mode, type, named) reference. */ int -function_arg_pass_by_reference (cum, mode, type, named) - CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED; - enum machine_mode mode ATTRIBUTE_UNUSED; - tree type; - int named ATTRIBUTE_UNUSED; +function_arg_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED, + enum machine_mode mode ATTRIBUTE_UNUSED, + tree type, int named ATTRIBUTE_UNUSED) { if (DEFAULT_ABI == ABI_V4 && ((type && AGGREGATE_TYPE_P (type)) @@ -4139,13 +4000,8 @@ function_arg_pass_by_reference (cum, mode, type, named) stack and set PRETEND_SIZE to the length of the registers pushed. */ void -setup_incoming_varargs (cum, mode, type, pretend_size, no_rtl) - CUMULATIVE_ARGS *cum; - enum machine_mode mode; - tree type; - int *pretend_size ATTRIBUTE_UNUSED; - int no_rtl; - +setup_incoming_varargs (CUMULATIVE_ARGS *cum, enum machine_mode mode, + tree type, int *pretend_size ATTRIBUTE_UNUSED, int no_rtl) { CUMULATIVE_ARGS next_cum; int reg_size = TARGET_32BIT ? 4 : 8; @@ -4233,7 +4089,7 @@ setup_incoming_varargs (cum, mode, type, pretend_size, no_rtl) /* Create the va_list data type. */ tree -rs6000_build_va_list () +rs6000_build_va_list (void) { tree f_gpr, f_fpr, f_res, f_ovf, f_sav, record, type_decl; @@ -4281,9 +4137,7 @@ rs6000_build_va_list () /* Implement va_start. */ void -rs6000_va_start (valist, nextarg) - tree valist; - rtx nextarg; +rs6000_va_start (tree valist, rtx nextarg) { HOST_WIDE_INT words, n_gpr, n_fpr; tree f_gpr, f_fpr, f_res, f_ovf, f_sav; @@ -4347,8 +4201,7 @@ rs6000_va_start (valist, nextarg) /* Implement va_arg. */ rtx -rs6000_va_arg (valist, type) - tree valist, type; +rs6000_va_arg (tree valist, tree type) { tree f_gpr, f_fpr, f_res, f_ovf, f_sav; tree gpr, fpr, ovf, sav, reg, t, u; @@ -4973,18 +4826,13 @@ static struct builtin_description bdesc_1arg[] = { 0, CODE_FOR_spe_evsubfsmiaaw, "__builtin_spe_evsubfsmiaaw", SPE_BUILTIN_EVSUBFSMIAAW }, { 0, CODE_FOR_spe_evsubfssiaaw, "__builtin_spe_evsubfssiaaw", SPE_BUILTIN_EVSUBFSSIAAW }, { 0, CODE_FOR_spe_evsubfumiaaw, "__builtin_spe_evsubfumiaaw", SPE_BUILTIN_EVSUBFUMIAAW }, - { 0, CODE_FOR_spe_evsplatfi, "__builtin_spe_evsplatfi", SPE_BUILTIN_EVSPLATFI }, - { 0, CODE_FOR_spe_evsplati, "__builtin_spe_evsplati", SPE_BUILTIN_EVSPLATI }, /* Place-holder. Leave as last unary SPE builtin. */ { 0, CODE_FOR_spe_evsubfusiaaw, "__builtin_spe_evsubfusiaaw", SPE_BUILTIN_EVSUBFUSIAAW }, }; static rtx -rs6000_expand_unop_builtin (icode, arglist, target) - enum insn_code icode; - tree arglist; - rtx target; +rs6000_expand_unop_builtin (enum insn_code icode, tree arglist, rtx target) { rtx pat; tree arg0 = TREE_VALUE (arglist); @@ -5033,10 +4881,7 @@ rs6000_expand_unop_builtin (icode, arglist, target) } static rtx -altivec_expand_abs_builtin (icode, arglist, target) - enum insn_code icode; - tree arglist; - rtx target; +altivec_expand_abs_builtin (enum insn_code icode, tree arglist, rtx target) { rtx pat, scratch1, scratch2; tree arg0 = TREE_VALUE (arglist); @@ -5068,10 +4913,7 @@ altivec_expand_abs_builtin (icode, arglist, target) } static rtx -rs6000_expand_binop_builtin (icode, arglist, target) - enum insn_code icode; - tree arglist; - rtx target; +rs6000_expand_binop_builtin (enum insn_code icode, tree arglist, rtx target) { rtx pat; tree arg0 = TREE_VALUE (arglist); @@ -5143,11 +4985,8 @@ rs6000_expand_binop_builtin (icode, arglist, target) } static rtx -altivec_expand_predicate_builtin (icode, opcode, arglist, target) - enum insn_code icode; - const char *opcode; - tree arglist; - rtx target; +altivec_expand_predicate_builtin (enum insn_code icode, const char *opcode, + tree arglist, rtx target) { rtx pat, scratch; tree cr6_form = TREE_VALUE (arglist); @@ -5224,9 +5063,7 @@ altivec_expand_predicate_builtin (icode, opcode, arglist, target) } static rtx -altivec_expand_stv_builtin (icode, arglist) - enum insn_code icode; - tree arglist; +altivec_expand_stv_builtin (enum insn_code icode, tree arglist) { tree arg0 = TREE_VALUE (arglist); tree arg1 = TREE_VALUE (TREE_CHAIN (arglist)); @@ -5259,10 +5096,7 @@ altivec_expand_stv_builtin (icode, arglist) } static rtx -rs6000_expand_ternop_builtin (icode, arglist, target) - enum insn_code icode; - tree arglist; - rtx target; +rs6000_expand_ternop_builtin (enum insn_code icode, tree arglist, rtx target) { rtx pat; tree arg0 = TREE_VALUE (arglist); @@ -5322,10 +5156,7 @@ rs6000_expand_ternop_builtin (icode, arglist, target) /* Expand the lvx builtins. */ static rtx -altivec_expand_ld_builtin (exp, target, expandedp) - tree exp; - rtx target; - bool *expandedp; +altivec_expand_ld_builtin (tree exp, rtx target, bool *expandedp) { tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); tree arglist = TREE_OPERAND (exp, 1); @@ -5378,10 +5209,8 @@ altivec_expand_ld_builtin (exp, target, expandedp) /* Expand the stvx builtins. */ static rtx -altivec_expand_st_builtin (exp, target, expandedp) - tree exp; - rtx target ATTRIBUTE_UNUSED; - bool *expandedp; +altivec_expand_st_builtin (tree exp, rtx target ATTRIBUTE_UNUSED, + bool *expandedp) { tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); tree arglist = TREE_OPERAND (exp, 1); @@ -5432,10 +5261,8 @@ altivec_expand_st_builtin (exp, target, expandedp) /* Expand the dst builtins. */ static rtx -altivec_expand_dst_builtin (exp, target, expandedp) - tree exp; - rtx target ATTRIBUTE_UNUSED; - bool *expandedp; +altivec_expand_dst_builtin (tree exp, rtx target ATTRIBUTE_UNUSED, + bool *expandedp) { tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); tree arglist = TREE_OPERAND (exp, 1); @@ -5495,10 +5322,7 @@ altivec_expand_dst_builtin (exp, target, expandedp) /* Expand the builtin in EXP and store the result in TARGET. Store true in *EXPANDEDP if we found a builtin to expand. */ static rtx -altivec_expand_builtin (exp, target, expandedp) - tree exp; - rtx target; - bool *expandedp; +altivec_expand_builtin (tree exp, rtx target, bool *expandedp) { struct builtin_description *d; struct builtin_description_predicates *dp; @@ -5678,10 +5502,7 @@ static struct builtin_description bdesc_2arg_spe[] = This expands the SPE builtins that are not simple unary and binary operations. */ static rtx -spe_expand_builtin (exp, target, expandedp) - tree exp; - rtx target; - bool *expandedp; +spe_expand_builtin (tree exp, rtx target, bool *expandedp) { tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); tree arglist = TREE_OPERAND (exp, 1); @@ -5717,6 +5538,19 @@ spe_expand_builtin (exp, target, expandedp) break; } + /* The evsplat*i instructions are not quite generic. */ + switch (fcode) + { + case SPE_BUILTIN_EVSPLATFI: + return rs6000_expand_unop_builtin (CODE_FOR_spe_evsplatfi, + arglist, target); + case SPE_BUILTIN_EVSPLATI: + return rs6000_expand_unop_builtin (CODE_FOR_spe_evsplati, + arglist, target); + default: + break; + } + d = (struct builtin_description *) bdesc_2arg_spe; for (i = 0; i < ARRAY_SIZE (bdesc_2arg_spe); ++i, ++d) if (d->code == fcode) @@ -5801,10 +5635,7 @@ spe_expand_builtin (exp, target, expandedp) } static rtx -spe_expand_predicate_builtin (icode, arglist, target) - enum insn_code icode; - tree arglist; - rtx target; +spe_expand_predicate_builtin (enum insn_code icode, tree arglist, rtx target) { rtx pat, scratch, tmp; tree form = TREE_VALUE (arglist); @@ -5913,10 +5744,7 @@ spe_expand_predicate_builtin (icode, arglist, target) */ static rtx -spe_expand_evsel_builtin (icode, arglist, target) - enum insn_code icode; - tree arglist; - rtx target; +spe_expand_evsel_builtin (enum insn_code icode, tree arglist, rtx target) { rtx pat, scratch; tree arg0 = TREE_VALUE (arglist); @@ -5973,12 +5801,9 @@ spe_expand_evsel_builtin (icode, arglist, target) IGNORE is nonzero if the value is to be ignored. */ static rtx -rs6000_expand_builtin (exp, target, subtarget, mode, ignore) - tree exp; - rtx target; - rtx subtarget ATTRIBUTE_UNUSED; - enum machine_mode mode ATTRIBUTE_UNUSED; - int ignore ATTRIBUTE_UNUSED; +rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, + enum machine_mode mode ATTRIBUTE_UNUSED, + int ignore ATTRIBUTE_UNUSED) { tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); tree arglist = TREE_OPERAND (exp, 1); @@ -6029,7 +5854,7 @@ rs6000_expand_builtin (exp, target, subtarget, mode, ignore) } static void -rs6000_init_builtins () +rs6000_init_builtins (void) { opaque_V2SI_type_node = copy_node (V2SI_type_node); opaque_V2SF_type_node = copy_node (V2SF_type_node); @@ -6049,10 +5874,9 @@ rs6000_init_builtins () START is the builtin enum at which to start. END is the builtin enum at which to end. */ static void -enable_mask_for_builtins (desc, size, start, end) - struct builtin_description *desc; - int size; - enum rs6000_builtins start, end; +enable_mask_for_builtins (struct builtin_description *desc, int size, + enum rs6000_builtins start, + enum rs6000_builtins end) { int i; @@ -6073,7 +5897,7 @@ enable_mask_for_builtins (desc, size, start, end) } static void -spe_init_builtins () +spe_init_builtins (void) { tree endlink = void_list_node; tree puint_type_node = build_pointer_type (unsigned_type_node); @@ -6172,6 +5996,11 @@ spe_init_builtins () tree_cons (NULL_TREE, integer_type_node, endlink))); + tree v2si_ftype_signed_char + = build_function_type (opaque_V2SI_type_node, + tree_cons (NULL_TREE, signed_char_type_node, + endlink)); + /* The initialization of the simple binary and unary builtins is done in rs6000_common_init_builtins, but we have to enable the mask bits here manually because we have run out of `target_flags' @@ -6194,6 +6023,10 @@ spe_init_builtins () SPE_BUILTIN_EVSEL_CMPGTS, SPE_BUILTIN_EVSEL_FSTSTEQ); + (*lang_hooks.decls.pushdecl) + (build_decl (TYPE_DECL, get_identifier ("__ev64_opaque__"), + opaque_V2SI_type_node)); + /* Initialize irregular SPE builtins. */ def_builtin (target_flags, "__builtin_spe_mtspefscr", void_ftype_int, SPE_BUILTIN_MTSPEFSCR); @@ -6212,6 +6045,8 @@ spe_init_builtins () def_builtin (target_flags, "__builtin_spe_evstwho", void_ftype_v2si_puint_char, SPE_BUILTIN_EVSTWHO); def_builtin (target_flags, "__builtin_spe_evstwwe", void_ftype_v2si_puint_char, SPE_BUILTIN_EVSTWWE); def_builtin (target_flags, "__builtin_spe_evstwwo", void_ftype_v2si_puint_char, SPE_BUILTIN_EVSTWWO); + def_builtin (target_flags, "__builtin_spe_evsplatfi", v2si_ftype_signed_char, SPE_BUILTIN_EVSPLATFI); + def_builtin (target_flags, "__builtin_spe_evsplati", v2si_ftype_signed_char, SPE_BUILTIN_EVSPLATI); /* Loads. */ def_builtin (target_flags, "__builtin_spe_evlddx", v2si_ftype_pv2si_int, SPE_BUILTIN_EVLDDX); @@ -6281,7 +6116,7 @@ spe_init_builtins () } static void -altivec_init_builtins () +altivec_init_builtins (void) { struct builtin_description *d; struct builtin_description_predicates *dp; @@ -6480,7 +6315,7 @@ altivec_init_builtins () } static void -rs6000_common_init_builtins () +rs6000_common_init_builtins (void) { struct builtin_description *d; size_t i; @@ -6950,8 +6785,7 @@ rs6000_common_init_builtins () #define MAX_MOVE_REG 4 int -expand_block_move (operands) - rtx operands[]; +expand_block_move (rtx operands[]) { rtx orig_dest = operands[0]; rtx orig_src = operands[1]; @@ -6987,8 +6821,8 @@ expand_block_move (operands) for (offset = 0; bytes > 0; offset += move_bytes, bytes -= move_bytes) { union { - rtx (*movstrsi) PARAMS ((rtx, rtx, rtx, rtx)); - rtx (*mov) PARAMS ((rtx, rtx)); + rtx (*movstrsi) (rtx, rtx, rtx, rtx); + rtx (*mov) (rtx, rtx); } gen_func; enum machine_mode mode = BLKmode; rtx src, dest; @@ -7118,9 +6952,7 @@ expand_block_move (operands) PARALLEL and the first section will be tested. */ int -load_multiple_operation (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +load_multiple_operation (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { int count = XVECLEN (op, 0); unsigned int dest_regno; @@ -7161,9 +6993,7 @@ load_multiple_operation (op, mode) is a CLOBBER. It will be tested later. */ int -store_multiple_operation (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +store_multiple_operation (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { int count = XVECLEN (op, 0) - 1; unsigned int src_regno; @@ -7206,8 +7036,7 @@ store_multiple_operation (op, mode) operands[2] is the first destination register. */ const char * -rs6000_output_load_multiple (operands) - rtx operands[3]; +rs6000_output_load_multiple (rtx operands[3]) { /* We have to handle the case where the pseudo used to contain the address is assigned to one of the output registers. */ @@ -7261,9 +7090,7 @@ rs6000_output_load_multiple (operands) /* Return 1 for a parallel vrsave operation. */ int -vrsave_operation (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +vrsave_operation (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { int count = XVECLEN (op, 0); unsigned int dest_regno, src_regno; @@ -7297,9 +7124,7 @@ vrsave_operation (op, mode) /* Return 1 for an PARALLEL suitable for mfcr. */ int -mfcr_operation (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +mfcr_operation (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { int count = XVECLEN (op, 0); int i; @@ -7347,9 +7172,7 @@ mfcr_operation (op, mode) /* Return 1 for an PARALLEL suitable for mtcrf. */ int -mtcrf_operation (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +mtcrf_operation (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { int count = XVECLEN (op, 0); int i; @@ -7396,9 +7219,7 @@ mtcrf_operation (op, mode) /* Return 1 for an PARALLEL suitable for lmw. */ int -lmw_operation (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +lmw_operation (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { int count = XVECLEN (op, 0); unsigned int dest_regno; @@ -7474,9 +7295,7 @@ lmw_operation (op, mode) /* Return 1 for an PARALLEL suitable for stmw. */ int -stmw_operation (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +stmw_operation (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { int count = XVECLEN (op, 0); unsigned int src_regno; @@ -7554,9 +7373,7 @@ stmw_operation (op, mode) never be generated. */ static void -validate_condition_mode (code, mode) - enum rtx_code code; - enum machine_mode mode; +validate_condition_mode (enum rtx_code code, enum machine_mode mode) { if (GET_RTX_CLASS (code) != '<' || GET_MODE_CLASS (mode) != MODE_CC) @@ -7597,9 +7414,7 @@ validate_condition_mode (code, mode) We only check the opcode against the mode of the CC value here. */ int -branch_comparison_operator (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +branch_comparison_operator (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { enum rtx_code code = GET_CODE (op); enum machine_mode cc_mode; @@ -7621,9 +7436,7 @@ branch_comparison_operator (op, mode) is set. */ int -branch_positive_comparison_operator (op, mode) - rtx op; - enum machine_mode mode; +branch_positive_comparison_operator (rtx op, enum machine_mode mode) { enum rtx_code code; @@ -7641,17 +7454,13 @@ branch_positive_comparison_operator (op, mode) insn: it must be a positive comparison. */ int -scc_comparison_operator (op, mode) - rtx op; - enum machine_mode mode; +scc_comparison_operator (rtx op, enum machine_mode mode) { return branch_positive_comparison_operator (op, mode); } int -trap_comparison_operator (op, mode) - rtx op; - enum machine_mode mode; +trap_comparison_operator (rtx op, enum machine_mode mode) { if (mode != VOIDmode && mode != GET_MODE (op)) return 0; @@ -7659,27 +7468,21 @@ trap_comparison_operator (op, mode) } int -boolean_operator (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +boolean_operator (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { enum rtx_code code = GET_CODE (op); return (code == AND || code == IOR || code == XOR); } int -boolean_or_operator (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +boolean_or_operator (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { enum rtx_code code = GET_CODE (op); return (code == IOR || code == XOR); } int -min_max_operator (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; +min_max_operator (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) { enum rtx_code code = GET_CODE (op); return (code == SMIN || code == SMAX || code == UMIN || code == UMAX); @@ -7690,9 +7493,7 @@ min_max_operator (op, mode) left insn of SHIFTOP bits. Both are known to be SImode CONST_INT. */ int -includes_lshift_p (shiftop, andop) - rtx shiftop; - rtx andop; +includes_lshift_p (rtx shiftop, rtx andop) { unsigned HOST_WIDE_INT shift_mask = ~(unsigned HOST_WIDE_INT) 0; @@ -7704,9 +7505,7 @@ includes_lshift_p (shiftop, andop) /* Similar, but for right shift. */ int -includes_rshift_p (shiftop, andop) - rtx shiftop; - rtx andop; +includes_rshift_p (rtx shiftop, rtx andop) { unsigned HOST_WIDE_INT shift_mask = ~(unsigned HOST_WIDE_INT) 0; @@ -7720,9 +7519,7 @@ includes_rshift_p (shiftop, andop) significant 0's, then one or more 1's, then zero or more 0's. */ int -includes_rldic_lshift_p (shiftop, andop) - rtx shiftop; - rtx andop; +includes_rldic_lshift_p (rtx shiftop, rtx andop) { if (GET_CODE (andop) == CONST_INT) { @@ -7815,9 +7612,7 @@ includes_rldic_lshift_p (shiftop, andop) significant 0's, with the remainder of the word 1's. */ int -includes_rldicr_lshift_p (shiftop, andop) - rtx shiftop; - rtx andop; +includes_rldicr_lshift_p (rtx shiftop, rtx andop) { if (GET_CODE (andop) == CONST_INT) { @@ -7889,8 +7684,7 @@ includes_rldicr_lshift_p (shiftop, andop) abort if we are passed pseudo registers. */ int -registers_ok_for_quad_peep (reg1, reg2) - rtx reg1, reg2; +registers_ok_for_quad_peep (rtx reg1, rtx reg2) { /* We might have been passed a SUBREG. */ if (GET_CODE (reg1) != REG || GET_CODE (reg2) != REG) @@ -7904,9 +7698,7 @@ registers_ok_for_quad_peep (reg1, reg2) (addr2 == addr1 + 8). */ int -addrs_ok_for_quad_peep (addr1, addr2) - rtx addr1; - rtx addr2; +addrs_ok_for_quad_peep (rtx addr1, rtx addr2) { unsigned int reg1; int offset1; @@ -7935,9 +7727,9 @@ addrs_ok_for_quad_peep (addr1, addr2) offset1 = 0; } -/* Make sure the second address is a (mem (plus (reg) (const_int))) - or if it is (mem (reg)) then make sure that offset1 is -8 and the same - register as addr1. */ + /* Make sure the second address is a (mem (plus (reg) (const_int))) + or if it is (mem (reg)) then make sure that offset1 is -8 and the same + register as addr1. */ if (offset1 == -8 && GET_CODE (addr2) == REG && reg1 == REGNO (addr2)) return 1; if (GET_CODE (addr2) != PLUS) @@ -7964,10 +7756,8 @@ addrs_ok_for_quad_peep (addr1, addr2) NO_REGS is returned. */ enum reg_class -secondary_reload_class (class, mode, in) - enum reg_class class; - enum machine_mode mode ATTRIBUTE_UNUSED; - rtx in; +secondary_reload_class (enum reg_class class, + enum machine_mode mode ATTRIBUTE_UNUSED, rtx in) { int regno; @@ -8045,9 +7835,7 @@ secondary_reload_class (class, mode, in) Return -1 if OP isn't a valid comparison for some reason. */ int -ccr_bit (op, scc_p) - rtx op; - int scc_p; +ccr_bit (rtx op, int scc_p) { enum rtx_code code = GET_CODE (op); enum machine_mode cc_mode; @@ -8112,8 +7900,7 @@ ccr_bit (op, scc_p) /* Return the GOT register. */ struct rtx_def * -rs6000_got_register (value) - rtx value ATTRIBUTE_UNUSED; +rs6000_got_register (rtx value ATTRIBUTE_UNUSED) { /* The second flow pass currently (June 1999) can't update regs_ever_live without disturbing other parts of the compiler, so @@ -8131,7 +7918,7 @@ rs6000_got_register (value) from push_function_context. */ static struct machine_function * -rs6000_init_machine_status () +rs6000_init_machine_status (void) { return ggc_alloc_cleared (sizeof (machine_function)); } @@ -8145,8 +7932,7 @@ rs6000_init_machine_status () (GET_CODE (X) == CONST_INT ? INTVAL (X) : CONST_DOUBLE_LOW (X)) int -extract_MB (op) - rtx op; +extract_MB (rtx op) { int i; unsigned long val = INT_LOWPART (op); @@ -8179,8 +7965,7 @@ extract_MB (op) } int -extract_ME (op) - rtx op; +extract_ME (rtx op) { int i; unsigned long val = INT_LOWPART (op); @@ -8217,7 +8002,7 @@ extract_ME (op) so that we can print its name in some tls_ld pattern. */ static const char * -rs6000_get_some_local_dynamic_name () +rs6000_get_some_local_dynamic_name (void) { rtx insn; @@ -8236,9 +8021,7 @@ rs6000_get_some_local_dynamic_name () /* Helper function for rs6000_get_some_local_dynamic_name. */ static int -rs6000_get_some_local_dynamic_name_1 (px, data) - rtx *px; - void *data ATTRIBUTE_UNUSED; +rs6000_get_some_local_dynamic_name_1 (rtx *px, void *data ATTRIBUTE_UNUSED) { rtx x = *px; @@ -8266,10 +8049,7 @@ rs6000_get_some_local_dynamic_name_1 (px, data) #endif void -print_operand (file, x, code) - FILE *file; - rtx x; - int code; +print_operand (FILE *file, rtx x, int code) { int i; HOST_WIDE_INT val; @@ -8887,9 +8667,7 @@ print_operand (file, x, code) /* Print the address of an operand. */ void -print_operand_address (file, x) - FILE *file; - rtx x; +print_operand_address (FILE *file, rtx x) { if (GET_CODE (x) == REG) fprintf (file, "0(%s)", reg_names[ REGNO (x) ]); @@ -8978,16 +8756,13 @@ print_operand_address (file, x) targets. */ static bool -rs6000_assemble_integer (x, size, aligned_p) - rtx x; - unsigned int size; - int aligned_p; +rs6000_assemble_integer (rtx x, unsigned int size, int aligned_p) { #ifdef RELOCATABLE_NEEDS_FIXUP /* Special handling for SI values. */ if (size == 4 && aligned_p) { - extern int in_toc_section PARAMS ((void)); + extern int in_toc_section (void); static int recurse = 0; /* For -mrelocatable, we mark all addresses that need to be fixed up @@ -9041,9 +8816,7 @@ rs6000_assemble_integer (x, size, aligned_p) VISIBILITY_TYPE. */ static void -rs6000_assemble_visibility (decl, vis) - tree decl; - int vis; +rs6000_assemble_visibility (tree decl, int vis) { /* Functions need to have their entry point symbol visibility set as well as their descriptor symbol visibility. */ @@ -9068,9 +8841,7 @@ rs6000_assemble_visibility (decl, vis) #endif enum rtx_code -rs6000_reverse_condition (mode, code) - enum machine_mode mode; - enum rtx_code code; +rs6000_reverse_condition (enum machine_mode mode, enum rtx_code code) { /* Reversal of FP compares takes care -- an ordered compare becomes an unordered compare and vice versa. */ @@ -9087,8 +8858,7 @@ rs6000_reverse_condition (mode, code) represents the result of the compare. */ static rtx -rs6000_generate_compare (code) - enum rtx_code code; +rs6000_generate_compare (enum rtx_code code) { enum machine_mode comp_mode; rtx compare_result; @@ -9272,9 +9042,7 @@ rs6000_generate_compare (code) /* Emit the RTL for an sCOND pattern. */ void -rs6000_emit_sCOND (code, result) - enum rtx_code code; - rtx result; +rs6000_emit_sCOND (enum rtx_code code, rtx result) { rtx condition_rtx; enum machine_mode op_mode; @@ -9320,9 +9088,7 @@ rs6000_emit_sCOND (code, result) /* Emit a branch of kind CODE to location LOC. */ void -rs6000_emit_cbranch (code, loc) - enum rtx_code code; - rtx loc; +rs6000_emit_cbranch (enum rtx_code code, rtx loc) { rtx condition_rtx, loc_ref; @@ -9346,11 +9112,7 @@ rs6000_emit_cbranch (code, loc) INSN is the insn. */ char * -output_cbranch (op, label, reversed, insn) - rtx op; - const char * label; - int reversed; - rtx insn; +output_cbranch (rtx op, const char *label, int reversed, rtx insn) { static char string[64]; enum rtx_code code = GET_CODE (op); @@ -9472,11 +9234,7 @@ output_cbranch (op, label, reversed, insn) is zero/false. Return 0 if the hardware has no such operation. */ int -rs6000_emit_cmove (dest, op, true_cond, false_cond) - rtx dest; - rtx op; - rtx true_cond; - rtx false_cond; +rs6000_emit_cmove (rtx dest, rtx op, rtx true_cond, rtx false_cond) { enum rtx_code code = GET_CODE (op); rtx op0 = rs6000_compare_op0; @@ -9641,11 +9399,7 @@ rs6000_emit_cmove (dest, op, true_cond, false_cond) /* Same as above, but for ints (isel). */ static int -rs6000_emit_int_cmove (dest, op, true_cond, false_cond) - rtx dest; - rtx op; - rtx true_cond; - rtx false_cond; +rs6000_emit_int_cmove (rtx dest, rtx op, rtx true_cond, rtx false_cond) { rtx condition_rtx, cr; @@ -9670,8 +9424,7 @@ rs6000_emit_int_cmove (dest, op, true_cond, false_cond) } const char * -output_isel (operands) - rtx *operands; +output_isel (rtx *operands) { enum rtx_code code; @@ -9686,11 +9439,7 @@ output_isel (operands) } void -rs6000_emit_minmax (dest, code, op0, op1) - rtx dest; - enum rtx_code code; - rtx op0; - rtx op1; +rs6000_emit_minmax (rtx dest, enum rtx_code code, rtx op0, rtx op1) { enum machine_mode mode = GET_MODE (op0); enum rtx_code c; @@ -9797,7 +9546,7 @@ rs6000_split_altivec_in_gprs (rtx *operands) saved. 32 if none. */ int -first_reg_to_save () +first_reg_to_save (void) { int first_reg; @@ -9823,7 +9572,7 @@ first_reg_to_save () /* Similar, for FP regs. */ int -first_fp_reg_to_save () +first_fp_reg_to_save (void) { int first_reg; @@ -9838,7 +9587,7 @@ first_fp_reg_to_save () /* Similar, for AltiVec regs. */ static int -first_altivec_reg_to_save () +first_altivec_reg_to_save (void) { int i; @@ -9859,7 +9608,7 @@ first_altivec_reg_to_save () the 32-bit word is 0. */ static unsigned int -compute_vrsave_mask () +compute_vrsave_mask (void) { unsigned int i, mask = 0; @@ -9891,9 +9640,7 @@ compute_vrsave_mask () } static void -is_altivec_return_reg (reg, xyes) - rtx reg; - void *xyes; +is_altivec_return_reg (rtx reg, void *xyes) { bool *yes = (bool *) xyes; if (REGNO (reg) == ALTIVEC_ARG_RETURN) @@ -9999,7 +9746,7 @@ is_altivec_return_reg (reg, xyes) #endif rs6000_stack_t * -rs6000_stack_info () +rs6000_stack_info (void) { static rs6000_stack_t info, zero_info; rs6000_stack_t *info_ptr = &info; @@ -10308,7 +10055,7 @@ rs6000_stack_info () mode. */ static bool -spe_func_has_64bit_regs_p () +spe_func_has_64bit_regs_p (void) { rtx insns, insn; @@ -10338,8 +10085,7 @@ spe_func_has_64bit_regs_p () } void -debug_stack_info (info) - rs6000_stack_t *info; +debug_stack_info (rs6000_stack_t *info) { const char *abi_string; @@ -10483,9 +10229,7 @@ debug_stack_info (info) } rtx -rs6000_return_addr (count, frame) - int count; - rtx frame; +rs6000_return_addr (int count, rtx frame) { /* Currently we don't optimize very well between prolog and body code and for PIC code the code can be actually quite bad, so @@ -10505,6 +10249,7 @@ rs6000_return_addr (count, frame) RETURN_ADDRESS_OFFSET))); } + cfun->machine->ra_need_lr = 1; return get_hard_reg_initial_val (Pmode, LINK_REGISTER_REGNUM); } @@ -10516,9 +10261,7 @@ rs6000_return_addr (count, frame) type info must be available here. (The tail recursion case can work with vector parameters, but there's no way to distinguish here.) */ static bool -rs6000_function_ok_for_sibcall (decl, exp) - tree decl; - tree exp ATTRIBUTE_UNUSED; +rs6000_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED) { tree type; if (decl) @@ -10546,7 +10289,7 @@ rs6000_function_ok_for_sibcall (decl, exp) } static int -rs6000_ra_ever_killed () +rs6000_ra_ever_killed (void) { rtx top; rtx reg; @@ -10599,8 +10342,7 @@ rs6000_ra_ever_killed () /* Add a REG_MAYBE_DEAD note to the insn. */ static void -rs6000_maybe_dead (insn) - rtx insn; +rs6000_maybe_dead (rtx insn) { REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD, const0_rtx, @@ -10612,8 +10354,7 @@ rs6000_maybe_dead (insn) a constant pool; or for SVR4 -fpic. */ void -rs6000_emit_load_toc_table (fromprolog) - int fromprolog; +rs6000_emit_load_toc_table (int fromprolog) { rtx dest, insn; dest = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM); @@ -10712,7 +10453,7 @@ rs6000_emit_load_toc_table (fromprolog) } int -get_TOC_alias_set () +get_TOC_alias_set (void) { static int set = -1; if (set == -1) @@ -10753,8 +10494,7 @@ uses_TOC () } rtx -create_TOC_reference (symbol) - rtx symbol; +create_TOC_reference (rtx symbol) { return gen_rtx_PLUS (Pmode, gen_rtx_REG (Pmode, TOC_REGISTER), @@ -10763,139 +10503,47 @@ create_TOC_reference (symbol) gen_rtx_SYMBOL_REF (Pmode, toc_label_name)))); } -/* __throw will restore its own return address to be the same as the - return address of the function that the throw is being made to. - This is unfortunate, because we want to check the original - return address to see if we need to restore the TOC. - So we have to squirrel it away here. - This is used only in compiling __throw and __rethrow. - - Most of this code should be removed by CSE. */ -static rtx insn_after_throw; +/* If _Unwind_* has been called from within the same module, + toc register is not guaranteed to be saved to 40(1) on function + entry. Save it there in that case. */ -/* This does the saving... */ void -rs6000_aix_emit_builtin_unwind_init () +rs6000_aix_emit_builtin_unwind_init (void) { rtx mem; rtx stack_top = gen_reg_rtx (Pmode); rtx opcode_addr = gen_reg_rtx (Pmode); - - insn_after_throw = gen_reg_rtx (SImode); + rtx opcode = gen_reg_rtx (SImode); + rtx tocompare = gen_reg_rtx (SImode); + rtx no_toc_save_needed = gen_label_rtx (); mem = gen_rtx_MEM (Pmode, hard_frame_pointer_rtx); emit_move_insn (stack_top, mem); - mem = gen_rtx_MEM (Pmode, - gen_rtx_PLUS (Pmode, stack_top, + mem = gen_rtx_MEM (Pmode, + gen_rtx_PLUS (Pmode, stack_top, GEN_INT (2 * GET_MODE_SIZE (Pmode)))); emit_move_insn (opcode_addr, mem); - emit_move_insn (insn_after_throw, gen_rtx_MEM (SImode, opcode_addr)); -} - -/* Emit insns to _restore_ the TOC register, at runtime (specifically - in _eh.o). Only used on AIX. - - The idea is that on AIX, function calls look like this: - bl somefunction-trampoline - lwz r2,20(sp) - - and later, - somefunction-trampoline: - stw r2,20(sp) - ... load function address in the count register ... - bctr - or like this, if the linker determines that this is not a cross-module call - and so the TOC need not be restored: - bl somefunction - nop - or like this, if the compiler could determine that this is not a - cross-module call: - bl somefunction - now, the tricky bit here is that register 2 is saved and restored - by the _linker_, so we can't readily generate debugging information - for it. So we need to go back up the call chain looking at the - insns at return addresses to see which calls saved the TOC register - and so see where it gets restored from. - - Oh, and all this gets done in RTL inside the eh_epilogue pattern, - just before the actual epilogue. - - On the bright side, this incurs no space or time overhead unless an - exception is thrown, except for the extra code in libgcc.a. - - The parameter STACKSIZE is a register containing (at runtime) - the amount to be popped off the stack in addition to the stack frame - of this routine (which will be __throw or __rethrow, and so is - guaranteed to have a stack frame). */ - -void -rs6000_emit_eh_toc_restore (stacksize) - rtx stacksize; -{ - rtx top_of_stack; - rtx bottom_of_stack = gen_reg_rtx (Pmode); - rtx tocompare = gen_reg_rtx (SImode); - rtx opcode = gen_reg_rtx (SImode); - rtx opcode_addr = gen_reg_rtx (Pmode); - rtx mem; - rtx loop_start = gen_label_rtx (); - rtx no_toc_restore_needed = gen_label_rtx (); - rtx loop_exit = gen_label_rtx (); - - mem = gen_rtx_MEM (Pmode, hard_frame_pointer_rtx); - set_mem_alias_set (mem, rs6000_sr_alias_set); - emit_move_insn (bottom_of_stack, mem); - - top_of_stack = expand_binop (Pmode, add_optab, - bottom_of_stack, stacksize, - NULL_RTX, 1, OPTAB_WIDEN); - - emit_move_insn (tocompare, gen_int_mode (TARGET_32BIT ? 0x80410014 + emit_move_insn (opcode, gen_rtx_MEM (SImode, opcode_addr)); + emit_move_insn (tocompare, gen_int_mode (TARGET_32BIT ? 0x80410014 : 0xE8410028, SImode)); - if (insn_after_throw == NULL_RTX) - abort (); - emit_move_insn (opcode, insn_after_throw); - - emit_note (NOTE_INSN_LOOP_BEG); - emit_label (loop_start); - - do_compare_rtx_and_jump (opcode, tocompare, NE, 1, + do_compare_rtx_and_jump (opcode, tocompare, EQ, 1, SImode, NULL_RTX, NULL_RTX, - no_toc_restore_needed); - - mem = gen_rtx_MEM (Pmode, - gen_rtx_PLUS (Pmode, bottom_of_stack, - GEN_INT (5 * GET_MODE_SIZE (Pmode)))); - emit_move_insn (gen_rtx_REG (Pmode, 2), mem); - - emit_label (no_toc_restore_needed); - do_compare_rtx_and_jump (top_of_stack, bottom_of_stack, EQ, 1, - Pmode, NULL_RTX, NULL_RTX, - loop_exit); - - mem = gen_rtx_MEM (Pmode, bottom_of_stack); - set_mem_alias_set (mem, rs6000_sr_alias_set); - emit_move_insn (bottom_of_stack, mem); - - mem = gen_rtx_MEM (Pmode, - gen_rtx_PLUS (Pmode, bottom_of_stack, - GEN_INT (2 * GET_MODE_SIZE (Pmode)))); - emit_move_insn (opcode_addr, mem); - emit_move_insn (opcode, gen_rtx_MEM (SImode, opcode_addr)); + no_toc_save_needed); - emit_note (NOTE_INSN_LOOP_CONT); - emit_jump (loop_start); - emit_note (NOTE_INSN_LOOP_END); - emit_label (loop_exit); + mem = gen_rtx_MEM (Pmode, + gen_rtx_PLUS (Pmode, stack_top, + GEN_INT (5 * GET_MODE_SIZE (Pmode)))); + emit_move_insn (mem, gen_rtx_REG (Pmode, 2)); + emit_label (no_toc_save_needed); } /* This ties together stack memory (MEM with an alias set of rs6000_sr_alias_set) and the change to the stack pointer. */ static void -rs6000_emit_stack_tie () +rs6000_emit_stack_tie (void) { rtx mem = gen_rtx_MEM (BLKmode, gen_rtx_REG (Pmode, STACK_POINTER_REGNUM)); @@ -10908,9 +10556,7 @@ rs6000_emit_stack_tie () The generated code may use hard register 0 as a temporary. */ static void -rs6000_emit_allocate_stack (size, copy_r12) - HOST_WIDE_INT size; - int copy_r12; +rs6000_emit_allocate_stack (HOST_WIDE_INT size, int copy_r12) { rtx insn; rtx stack_reg = gen_rtx_REG (Pmode, STACK_POINTER_REGNUM); @@ -10998,12 +10644,8 @@ rs6000_emit_allocate_stack (size, copy_r12) its hand so much. */ static void -rs6000_frame_related (insn, reg, val, reg2, rreg) - rtx insn; - rtx reg; - HOST_WIDE_INT val; - rtx reg2; - rtx rreg; +rs6000_frame_related (rtx insn, rtx reg, HOST_WIDE_INT val, + rtx reg2, rtx rreg) { rtx real, temp; @@ -11085,8 +10727,7 @@ rs6000_frame_related (insn, reg, val, reg2, rreg) original note, plus a synthetic register save. */ static rtx -spe_synthesize_frame_save (real) - rtx real; +spe_synthesize_frame_save (rtx real) { rtx synth, offset, reg, real2; @@ -11149,10 +10790,7 @@ spe_synthesize_frame_save (real) appropriate CLOBBERs. */ static rtx -generate_set_vrsave (reg, info, epiloguep) - rtx reg; - rs6000_stack_t *info; - int epiloguep; +generate_set_vrsave (rtx reg, rs6000_stack_t *info, int epiloguep) { int nclobs, i; rtx insn, clobs[TOTAL_ALTIVEC_REGS + 1]; @@ -11211,13 +10849,8 @@ generate_set_vrsave (reg, info, epiloguep) Save REGNO into [FRAME_REG + OFFSET] in mode MODE. */ static void -emit_frame_save (frame_reg, frame_ptr, mode, regno, offset, total_size) - rtx frame_reg; - rtx frame_ptr; - enum machine_mode mode; - unsigned int regno; - int offset; - int total_size; +emit_frame_save (rtx frame_reg, rtx frame_ptr, enum machine_mode mode, + unsigned int regno, int offset, int total_size) { rtx reg, offset_rtx, insn, mem, addr, int_rtx; rtx replacea, replaceb; @@ -11259,10 +10892,7 @@ emit_frame_save (frame_reg, frame_ptr, mode, regno, offset, total_size) converting to a valid addressing mode. */ static rtx -gen_frame_mem_offset (mode, reg, offset) - enum machine_mode mode; - rtx reg; - int offset; +gen_frame_mem_offset (enum machine_mode mode, rtx reg, int offset) { rtx int_rtx, offset_rtx; @@ -11282,7 +10912,7 @@ gen_frame_mem_offset (mode, reg, offset) /* Emit function prologue as insns. */ void -rs6000_emit_prologue () +rs6000_emit_prologue (void) { rs6000_stack_t *info = rs6000_stack_info (); enum machine_mode reg_mode = TARGET_POWERPC64 ? DImode : SImode; @@ -11307,10 +10937,14 @@ rs6000_emit_prologue () || info->spe_64bit_regs_used == 0) && info->first_gp_reg_save < 31); saving_FPRs_inline = (info->first_fp_reg_save == 64 - || FP_SAVE_INLINE (info->first_fp_reg_save)); + || FP_SAVE_INLINE (info->first_fp_reg_save) + || current_function_calls_eh_return + || cfun->machine->ra_need_lr); /* For V.4, update stack before we do any saving and set back pointer. */ - if (info->push_p && DEFAULT_ABI == ABI_V4) + if (info->push_p + && (DEFAULT_ABI == ABI_V4 + || current_function_calls_eh_return)) { if (info->total_size < 32767) sp_offset = info->total_size; @@ -11538,6 +11172,23 @@ rs6000_emit_prologue () { unsigned int i, regno; + /* In AIX ABI we need to pretend we save r2 here. */ + if (TARGET_AIX) + { + rtx addr, reg, mem; + + reg = gen_rtx_REG (reg_mode, 2); + addr = gen_rtx_PLUS (Pmode, frame_reg_rtx, + GEN_INT (sp_offset + 5 * reg_size)); + mem = gen_rtx_MEM (reg_mode, addr); + set_mem_alias_set (mem, rs6000_sr_alias_set); + + insn = emit_move_insn (mem, reg); + rs6000_frame_related (insn, frame_ptr_rtx, info->total_size, + NULL_RTX, NULL_RTX); + PATTERN (insn) = gen_blockage (); + } + for (i = 0; ; ++i) { regno = EH_RETURN_DATA_REGNO (i); @@ -11596,7 +11247,8 @@ rs6000_emit_prologue () /* Update stack and set back pointer unless this is V.4, for which it was done previously. */ - if (info->push_p && DEFAULT_ABI != ABI_V4) + if (info->push_p + && !(DEFAULT_ABI == ABI_V4 || current_function_calls_eh_return)) rs6000_emit_allocate_stack (info->total_size, FALSE); /* Set frame pointer, if needed. */ @@ -11652,9 +11304,8 @@ rs6000_emit_prologue () /* Write function prologue. */ static void -rs6000_output_function_prologue (file, size) - FILE *file; - HOST_WIDE_INT size ATTRIBUTE_UNUSED; +rs6000_output_function_prologue (FILE *file, + HOST_WIDE_INT size ATTRIBUTE_UNUSED) { rs6000_stack_t *info = rs6000_stack_info (); @@ -11720,8 +11371,7 @@ rs6000_output_function_prologue (file, size) need special notes to explain where r11 is in relation to the stack. */ void -rs6000_emit_epilogue (sibcall) - int sibcall; +rs6000_emit_epilogue (int sibcall) { rs6000_stack_t *info; int restoring_FPRs_inline; @@ -11775,7 +11425,8 @@ rs6000_emit_epilogue (sibcall) } else if (info->push_p) { - if (DEFAULT_ABI == ABI_V4) + if (DEFAULT_ABI == ABI_V4 + || current_function_calls_eh_return) sp_offset = info->total_size; else { @@ -11860,6 +11511,17 @@ rs6000_emit_epilogue (sibcall) { unsigned int i, regno; + if (TARGET_AIX) + { + rtx addr = gen_rtx_PLUS (Pmode, frame_reg_rtx, + GEN_INT (sp_offset + 5 * reg_size)); + rtx mem = gen_rtx_MEM (reg_mode, addr); + + set_mem_alias_set (mem, rs6000_sr_alias_set); + + emit_move_insn (gen_rtx_REG (reg_mode, 2), mem); + } + for (i = 0; ; ++i) { rtx mem; @@ -12011,7 +11673,8 @@ rs6000_emit_epilogue (sibcall) (which may not have any obvious dependency on the stack). This doesn't hurt performance, because there is no scheduling that can be done after this point. */ - if (DEFAULT_ABI == ABI_V4) + if (DEFAULT_ABI == ABI_V4 + || current_function_calls_eh_return) { if (frame_reg_rtx != sp_reg_rtx) rs6000_emit_stack_tie (); @@ -12088,9 +11751,8 @@ rs6000_emit_epilogue (sibcall) /* Write function epilogue. */ static void -rs6000_output_function_epilogue (file, size) - FILE *file; - HOST_WIDE_INT size ATTRIBUTE_UNUSED; +rs6000_output_function_epilogue (FILE *file, + HOST_WIDE_INT size ATTRIBUTE_UNUSED) { rs6000_stack_t *info = rs6000_stack_info (); @@ -12131,6 +11793,23 @@ rs6000_output_function_epilogue (file, size) } } +#if TARGET_OBJECT_FORMAT == OBJECT_MACHO + /* Mach-O doesn't support labels at the end of objects, so if + it looks like we might want one, insert a NOP. */ + { + rtx insn = get_last_insn (); + while (insn + && NOTE_P (insn) + && NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED_LABEL) + insn = PREV_INSN (insn); + if (insn + && (LABEL_P (insn) + || (NOTE_P (insn) + && NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED_LABEL))) + fputs ("\tnop\n", file); + } +#endif + /* Output a traceback table here. See /usr/include/sys/debug.h for info on its format. @@ -12392,12 +12071,9 @@ rs6000_output_function_epilogue (file, size) not support varargs. */ static void -rs6000_output_mi_thunk (file, thunk_fndecl, delta, vcall_offset, function) - FILE *file; - tree thunk_fndecl ATTRIBUTE_UNUSED; - HOST_WIDE_INT delta; - HOST_WIDE_INT vcall_offset; - tree function; +rs6000_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, + HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset, + tree function) { rtx this, insn, funexp; @@ -12410,7 +12086,7 @@ rs6000_output_mi_thunk (file, thunk_fndecl, delta, vcall_offset, function) /* Find the "this" pointer. If the function returns a structure, the structure return pointer is in r3. */ - if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)))) + if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function)) this = gen_rtx_REG (Pmode, 4); else this = gen_rtx_REG (Pmode, 3); @@ -12524,8 +12200,7 @@ rs6000_output_mi_thunk (file, thunk_fndecl, delta, vcall_offset, function) /* Hash functions for the hash table. */ static unsigned -rs6000_hash_constant (k) - rtx k; +rs6000_hash_constant (rtx k) { enum rtx_code code = GET_CODE (k); enum machine_mode mode = GET_MODE (k); @@ -12598,8 +12273,7 @@ rs6000_hash_constant (k) } static unsigned -toc_hash_function (hash_entry) - const void * hash_entry; +toc_hash_function (const void *hash_entry) { const struct toc_hash_struct *thc = (const struct toc_hash_struct *) hash_entry; @@ -12609,9 +12283,7 @@ toc_hash_function (hash_entry) /* Compare H1 and H2 for equivalence. */ static int -toc_hash_eq (h1, h2) - const void * h1; - const void * h2; +toc_hash_eq (const void *h1, const void *h2) { rtx r1 = ((const struct toc_hash_struct *) h1)->key; rtx r2 = ((const struct toc_hash_struct *) h2)->key; @@ -12635,9 +12307,7 @@ toc_hash_eq (h1, h2) || strncmp ("_ZTC", name, strlen ("_ZTC")) == 0) void -rs6000_output_symbol_ref (file, x) - FILE *file; - rtx x; +rs6000_output_symbol_ref (FILE *file, rtx x) { /* Currently C++ toc references to vtables can be emitted before it is decided whether the vtable is public or private. If this is @@ -12659,11 +12329,7 @@ rs6000_output_symbol_ref (file, x) written. */ void -output_toc (file, x, labelno, mode) - FILE *file; - rtx x; - int labelno; - enum machine_mode mode; +output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode) { char buf[256]; const char *name = buf; @@ -12963,10 +12629,7 @@ output_toc (file, x, labelno, mode) so we must artificially break them up early. */ void -output_ascii (file, p, n) - FILE *file; - const char *p; - int n; +output_ascii (FILE *file, const char *p, int n) { char c; int i, count_string; @@ -13037,10 +12700,8 @@ output_ascii (file, p, n) the name. */ void -rs6000_gen_section_name (buf, filename, section_desc) - char **buf; - const char *filename; - const char *section_desc; +rs6000_gen_section_name (char **buf, const char *filename, + const char *section_desc) { const char *q, *after_last_slash, *last_period = 0; char *p; @@ -13083,8 +12744,7 @@ rs6000_gen_section_name (buf, filename, section_desc) /* Emit profile function. */ void -output_profile_hook (labelno) - int labelno ATTRIBUTE_UNUSED; +output_profile_hook (int labelno ATTRIBUTE_UNUSED) { if (TARGET_PROFILE_KERNEL) return; @@ -13137,9 +12797,7 @@ output_profile_hook (labelno) /* Write function profiler code. */ void -output_function_profiler (file, labelno) - FILE *file; - int labelno; +output_function_profiler (FILE *file, int labelno) { char buf[100]; int save_lr = 8; @@ -13229,7 +12887,7 @@ output_function_profiler (file, labelno) static int -rs6000_use_dfa_pipeline_interface () +rs6000_use_dfa_pipeline_interface (void) { return 1; } @@ -13241,11 +12899,9 @@ rs6000_use_dfa_pipeline_interface () instructions to issue in this cycle. */ static int -rs6000_variable_issue (stream, verbose, insn, more) - FILE *stream ATTRIBUTE_UNUSED; - int verbose ATTRIBUTE_UNUSED; - rtx insn; - int more; +rs6000_variable_issue (FILE *stream ATTRIBUTE_UNUSED, + int verbose ATTRIBUTE_UNUSED, + rtx insn, int more) { if (GET_CODE (PATTERN (insn)) == USE || GET_CODE (PATTERN (insn)) == CLOBBER) @@ -13276,11 +12932,8 @@ rs6000_variable_issue (stream, verbose, insn, more) a dependency LINK or INSN on DEP_INSN. COST is the current cost. */ static int -rs6000_adjust_cost (insn, link, dep_insn, cost) - rtx insn; - rtx link; - rtx dep_insn ATTRIBUTE_UNUSED; - int cost; +rs6000_adjust_cost (rtx insn, rtx link, rtx dep_insn ATTRIBUTE_UNUSED, + int cost) { if (! recog_memoized (insn)) return 0; @@ -13340,9 +12993,7 @@ rs6000_adjust_cost (insn, link, dep_insn, cost) priorities of insns. */ static int -rs6000_adjust_priority (insn, priority) - rtx insn ATTRIBUTE_UNUSED; - int priority; +rs6000_adjust_priority (rtx insn ATTRIBUTE_UNUSED, int priority) { /* On machines (like the 750) which have asymmetric integer units, where one integer unit can do multiply and divides and the other @@ -13380,7 +13031,7 @@ rs6000_adjust_priority (insn, priority) /* Return how many instructions the machine can issue per cycle. */ static int -rs6000_issue_rate () +rs6000_issue_rate (void) { /* Use issue rate of 1 for first scheduling pass to decrease degradation. */ if (!reload_completed) @@ -13414,7 +13065,7 @@ rs6000_issue_rate () scheduling. */ static int -rs6000_use_sched_lookahead () +rs6000_use_sched_lookahead (void) { if (rs6000_cpu_attr == CPU_PPC8540) return 4; @@ -13425,7 +13076,7 @@ rs6000_use_sched_lookahead () /* Length in units of the trampoline for entering a nested function. */ int -rs6000_trampoline_size () +rs6000_trampoline_size (void) { int ret = 0; @@ -13452,10 +13103,7 @@ rs6000_trampoline_size () CXT is an RTX for the static chain value for the function. */ void -rs6000_initialize_trampoline (addr, fnaddr, cxt) - rtx addr; - rtx fnaddr; - rtx cxt; +rs6000_initialize_trampoline (rtx addr, rtx fnaddr, rtx cxt) { enum machine_mode pmode = Pmode; int regsize = (TARGET_32BIT) ? 4 : 8; @@ -13514,12 +13162,10 @@ const struct attribute_spec rs6000_attribute_table[] = struct attribute_spec.handler. */ static tree -rs6000_handle_longcall_attribute (node, name, args, flags, no_add_attrs) - tree *node; - tree name; - tree args ATTRIBUTE_UNUSED; - int flags ATTRIBUTE_UNUSED; - bool *no_add_attrs; +rs6000_handle_longcall_attribute (tree *node, tree name, + tree args ATTRIBUTE_UNUSED, + int flags ATTRIBUTE_UNUSED, + bool *no_add_attrs) { if (TREE_CODE (*node) != FUNCTION_TYPE && TREE_CODE (*node) != FIELD_DECL @@ -13536,8 +13182,7 @@ rs6000_handle_longcall_attribute (node, name, args, flags, no_add_attrs) /* Set longcall attributes on all functions declared when rs6000_default_long_calls is true. */ static void -rs6000_set_default_type_attributes (type) - tree type; +rs6000_set_default_type_attributes (tree type) { if (rs6000_default_long_calls && (TREE_CODE (type) == FUNCTION_TYPE @@ -13551,8 +13196,7 @@ rs6000_set_default_type_attributes (type) longcall attribute. */ struct rtx_def * -rs6000_longcall_ref (call_ref) - rtx call_ref; +rs6000_longcall_ref (rtx call_ref) { const char *call_name; tree node; @@ -13586,10 +13230,8 @@ rs6000_longcall_ref (call_ref) data section. */ static void -rs6000_elf_select_rtx_section (mode, x, align) - enum machine_mode mode; - rtx x; - unsigned HOST_WIDE_INT align; +rs6000_elf_select_rtx_section (enum machine_mode mode, rtx x, + unsigned HOST_WIDE_INT align) { if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (x, mode)) toc_section (); @@ -13603,10 +13245,8 @@ rs6000_elf_select_rtx_section (mode, x, align) the initial value of DECL requires link-time relocations. */ static void -rs6000_elf_select_section (decl, reloc, align) - tree decl; - int reloc; - unsigned HOST_WIDE_INT align; +rs6000_elf_select_section (tree decl, int reloc, + unsigned HOST_WIDE_INT align) { /* Pretend that we're always building for a shared library when ABI_AIX, because otherwise we end up with dynamic relocations @@ -13625,9 +13265,7 @@ rs6000_elf_select_section (decl, reloc, align) initialized data and functions. */ static void -rs6000_elf_unique_section (decl, reloc) - tree decl; - int reloc; +rs6000_elf_unique_section (tree decl, int reloc) { /* As above, pretend that we're always building for a shared library when ABI_AIX, to avoid dynamic relocations in read-only sections. */ @@ -13644,10 +13282,7 @@ rs6000_elf_unique_section (decl, reloc) read the prefixes. */ static void -rs6000_elf_encode_section_info (decl, rtl, first) - tree decl; - rtx rtl; - int first; +rs6000_elf_encode_section_info (tree decl, rtx rtl, int first) { default_encode_section_info (decl, rtl, first); @@ -13666,8 +13301,7 @@ rs6000_elf_encode_section_info (decl, rtl, first) } static bool -rs6000_elf_in_small_data_p (decl) - tree decl; +rs6000_elf_in_small_data_p (tree decl) { if (rs6000_sdata == SDATA_NONE) return false; @@ -13709,8 +13343,7 @@ rs6000_elf_in_small_data_p (decl) increment the returned register via an "la" instruction. */ struct rtx_def * -find_addr_reg (addr) - rtx addr; +find_addr_reg (rtx addr) { while (GET_CODE (addr) == PLUS) { @@ -13733,8 +13366,7 @@ find_addr_reg (addr) } void -rs6000_fatal_bad_address (op) - rtx op; +rs6000_fatal_bad_address (rtx op) { fatal_insn ("bad address", op); } @@ -13746,8 +13378,7 @@ rs6000_fatal_bad_address (op) reference and a constant. */ int -symbolic_operand (op) - rtx op; +symbolic_operand (rtx op) { switch (GET_CODE (op)) { @@ -13774,10 +13405,7 @@ static tree stub_list = 0; procedure calls to the linked list. */ void -add_compiler_stub (label_name, function_name, line_number) - tree label_name; - tree function_name; - int line_number; +add_compiler_stub (tree label_name, tree function_name, int line_number) { tree stub = build_tree_list (function_name, label_name); TREE_TYPE (stub) = build_int_2 (line_number, 0); @@ -13794,7 +13422,7 @@ add_compiler_stub (label_name, function_name, line_number) linked list. */ void -output_compiler_stub () +output_compiler_stub (void) { char tmp_buf[256]; char label_buf[256]; @@ -13841,8 +13469,7 @@ output_compiler_stub () already there or not. */ int -no_previous_def (function_name) - tree function_name; +no_previous_def (tree function_name) { tree stub; for (stub = stub_list; stub; stub = TREE_CHAIN (stub)) @@ -13855,8 +13482,7 @@ no_previous_def (function_name) the function. */ tree -get_prev_label (function_name) - tree function_name; +get_prev_label (tree function_name) { tree stub; for (stub = stub_list; stub; stub = TREE_CHAIN (stub)) @@ -13871,10 +13497,7 @@ get_prev_label (function_name) CALL_DEST is the routine we are calling. */ char * -output_call (insn, call_dest, operand_number) - rtx insn; - rtx call_dest; - int operand_number; +output_call (rtx insn, rtx call_dest, int operand_number) { static char buf[256]; if (GET_CODE (call_dest) == SYMBOL_REF && TARGET_LONG_BRANCH && !flag_pic) @@ -13912,31 +13535,10 @@ output_call (insn, call_dest, operand_number) #endif /* RS6000_LONG_BRANCH */ -#define GEN_LOCAL_LABEL_FOR_SYMBOL(BUF,SYMBOL,LENGTH,N) \ - do { \ - const char *const symbol_ = (SYMBOL); \ - char *buffer_ = (BUF); \ - if (symbol_[0] == '"') \ - { \ - sprintf(buffer_, "\"L%d$%s", (N), symbol_+1); \ - } \ - else if (name_needs_quotes(symbol_)) \ - { \ - sprintf(buffer_, "\"L%d$%s\"", (N), symbol_); \ - } \ - else \ - { \ - sprintf(buffer_, "L%d$%s", (N), symbol_); \ - } \ - } while (0) - - /* Generate PIC and indirect symbol stubs. */ void -machopic_output_stub (file, symb, stub) - FILE *file; - const char *symb, *stub; +machopic_output_stub (FILE *file, const char *symb, const char *stub) { unsigned int length; char *symbol_name, *lazy_ptr_name; @@ -13946,7 +13548,6 @@ machopic_output_stub (file, symb, stub) /* Lose our funky encoding stuff so it doesn't contaminate the stub. */ symb = (*targetm.strip_name_encoding) (symb); - label += 1; length = strlen (symb); symbol_name = alloca (length + 32); @@ -13955,9 +13556,6 @@ machopic_output_stub (file, symb, stub) lazy_ptr_name = alloca (length + 32); GEN_LAZY_PTR_NAME_FOR_SYMBOL (lazy_ptr_name, symb, length); - local_label_0 = alloca (length + 32); - GEN_LOCAL_LABEL_FOR_SYMBOL (local_label_0, symb, length, 0); - if (flag_pic == 2) machopic_picsymbol_stub1_section (); else @@ -13969,6 +13567,10 @@ machopic_output_stub (file, symb, stub) if (flag_pic == 2) { + label++; + local_label_0 = alloca (sizeof("\"L0000000000$spb\"")); + sprintf (local_label_0, "\"L%011d$spb\"", label); + fprintf (file, "\tmflr r0\n"); fprintf (file, "\tbcl 20,31,%s\n", local_label_0); fprintf (file, "%s:\n\tmflr r11\n", local_label_0); @@ -14002,10 +13604,8 @@ machopic_output_stub (file, symb, stub) #define SMALL_INT(X) ((unsigned) (INTVAL(X) + 0x8000) < 0x10000) rtx -rs6000_machopic_legitimize_pic_address (orig, mode, reg) - rtx orig; - enum machine_mode mode; - rtx reg; +rs6000_machopic_legitimize_pic_address (rtx orig, enum machine_mode mode, + rtx reg) { rtx base, offset; @@ -14055,7 +13655,7 @@ rs6000_machopic_legitimize_pic_address (orig, mode, reg) real definition. */ void -toc_section () +toc_section (void) { } @@ -14063,10 +13663,7 @@ toc_section () #if TARGET_ELF static unsigned int -rs6000_elf_section_type_flags (decl, name, reloc) - tree decl; - const char *name; - int reloc; +rs6000_elf_section_type_flags (tree decl, const char *name, int reloc) { unsigned int flags = default_section_type_flags_1 (decl, name, reloc, @@ -14086,9 +13683,7 @@ rs6000_elf_section_type_flags (decl, name, reloc) that we have special handling for -mrelocatable. */ static void -rs6000_elf_asm_out_constructor (symbol, priority) - rtx symbol; - int priority; +rs6000_elf_asm_out_constructor (rtx symbol, int priority) { const char *section = ".ctors"; char buf[16]; @@ -14117,9 +13712,7 @@ rs6000_elf_asm_out_constructor (symbol, priority) } static void -rs6000_elf_asm_out_destructor (symbol, priority) - rtx symbol; - int priority; +rs6000_elf_asm_out_destructor (rtx symbol, int priority) { const char *section = ".dtors"; char buf[16]; @@ -14148,10 +13741,7 @@ rs6000_elf_asm_out_destructor (symbol, priority) } void -rs6000_elf_declare_function_name (file, name, decl) - FILE *file; - const char *name; - tree decl; +rs6000_elf_declare_function_name (FILE *file, const char *name, tree decl) { if (TARGET_64BIT) { @@ -14223,9 +13813,7 @@ rs6000_elf_declare_function_name (file, name, decl) #if TARGET_XCOFF static void -rs6000_xcoff_asm_globalize_label (stream, name) - FILE *stream; - const char *name; +rs6000_xcoff_asm_globalize_label (FILE *stream, const char *name) { fputs (GLOBAL_ASM_OP, stream); RS6000_OUTPUT_BASENAME (stream, name); @@ -14233,9 +13821,7 @@ rs6000_xcoff_asm_globalize_label (stream, name) } static void -rs6000_xcoff_asm_named_section (name, flags) - const char *name; - unsigned int flags; +rs6000_xcoff_asm_named_section (const char *name, unsigned int flags) { int smclass; static const char * const suffix[3] = { "PR", "RO", "RW" }; @@ -14253,10 +13839,8 @@ rs6000_xcoff_asm_named_section (name, flags) } static void -rs6000_xcoff_select_section (decl, reloc, align) - tree decl; - int reloc; - unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED; +rs6000_xcoff_select_section (tree decl, int reloc, + unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED) { if (decl_readonly_section_1 (decl, reloc, 1)) { @@ -14275,9 +13859,7 @@ rs6000_xcoff_select_section (decl, reloc, align) } static void -rs6000_xcoff_unique_section (decl, reloc) - tree decl; - int reloc ATTRIBUTE_UNUSED; +rs6000_xcoff_unique_section (tree decl, int reloc ATTRIBUTE_UNUSED) { const char *name; @@ -14302,10 +13884,8 @@ rs6000_xcoff_unique_section (decl, reloc) toc entry. */ static void -rs6000_xcoff_select_rtx_section (mode, x, align) - enum machine_mode mode; - rtx x; - unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED; +rs6000_xcoff_select_rtx_section (enum machine_mode mode, rtx x, + unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED) { if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (x, mode)) toc_section (); @@ -14316,8 +13896,7 @@ rs6000_xcoff_select_rtx_section (mode, x, align) /* Remove any trailing [DS] or the like from the symbol name. */ static const char * -rs6000_xcoff_strip_name_encoding (name) - const char *name; +rs6000_xcoff_strip_name_encoding (const char *name) { size_t len; if (*name == '*') @@ -14332,10 +13911,7 @@ rs6000_xcoff_strip_name_encoding (name) /* Section attributes. AIX is always PIC. */ static unsigned int -rs6000_xcoff_section_type_flags (decl, name, reloc) - tree decl; - const char *name; - int reloc; +rs6000_xcoff_section_type_flags (tree decl, const char *name, int reloc) { unsigned int align; unsigned int flags = default_section_type_flags_1 (decl, name, reloc, 1); @@ -14365,7 +13941,7 @@ rs6000_xcoff_section_type_flags (decl, name, reloc) Finally, declare mcount when profiling to make the assembler happy. */ static void -rs6000_xcoff_file_start () +rs6000_xcoff_file_start (void) { rs6000_gen_section_name (&xcoff_bss_section_name, main_input_filename, ".bss_"); @@ -14390,7 +13966,7 @@ rs6000_xcoff_file_start () On the RS/6000, referencing data should automatically pull in text. */ static void -rs6000_xcoff_file_end () +rs6000_xcoff_file_end (void) { text_section (); fputs ("_section_.text:\n", asm_out_file); @@ -14406,8 +13982,7 @@ rs6000_xcoff_file_end () functions at dynamic-link time. */ static bool -rs6000_binds_local_p (decl) - tree decl; +rs6000_binds_local_p (tree decl) { return default_binds_local_p_1 (decl, 0); } @@ -14418,10 +13993,8 @@ rs6000_binds_local_p (decl) scanned. In either case, *TOTAL contains the cost result. */ static bool -rs6000_rtx_costs (x, code, outer_code, total) - rtx x; - int code, outer_code ATTRIBUTE_UNUSED; - int *total; +rs6000_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, + int *total) { switch (code) { @@ -14642,9 +14215,8 @@ rs6000_rtx_costs (x, code, outer_code, total) CLASS1 to one of CLASS2. */ int -rs6000_register_move_cost (mode, from, to) - enum machine_mode mode; - enum reg_class from, to; +rs6000_register_move_cost (enum machine_mode mode, + enum reg_class from, enum reg_class to) { /* Moves from/to GENERAL_REGS. */ if (reg_classes_intersect_p (to, GENERAL_REGS) @@ -14680,10 +14252,8 @@ rs6000_register_move_cost (mode, from, to) or from memory. */ int -rs6000_memory_move_cost (mode, class, in) - enum machine_mode mode; - enum reg_class class; - int in ATTRIBUTE_UNUSED; +rs6000_memory_move_cost (enum machine_mode mode, enum reg_class class, + int in ATTRIBUTE_UNUSED) { if (reg_classes_intersect_p (class, GENERAL_REGS)) return 4 * HARD_REGNO_NREGS (0, mode); @@ -14783,24 +14353,16 @@ rs6000_libcall_value (enum machine_mode mode) /* Return true if TYPE is of type __ev64_opaque__. */ static bool -is_ev64_opaque_type (type) - tree type; +is_ev64_opaque_type (tree type) { return (TARGET_SPE && (type == opaque_V2SI_type_node || type == opaque_V2SF_type_node - || type == opaque_p_V2SI_type_node - || (TREE_CODE (type) == VECTOR_TYPE - && TYPE_NAME (type) - && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL - && DECL_NAME (TYPE_NAME (type)) - && strcmp (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))), - "__ev64_opaque__") == 0))); + || type == opaque_p_V2SI_type_node)); } static rtx -rs6000_dwarf_register_span (reg) - rtx reg; +rs6000_dwarf_register_span (rtx reg) { unsigned regno; |