📄 rs6000.c
字号:
COSTS_N_INSNS (5), /* muldi */ COSTS_N_INSNS (35), /* divsi */ COSTS_N_INSNS (35), /* divdi */ COSTS_N_INSNS (11), /* fp */ COSTS_N_INSNS (11), /* dmul */ COSTS_N_INSNS (11), /* sdiv */ COSTS_N_INSNS (11), /* ddiv */};/* Instruction costs on PPC440 processors. */static conststruct processor_costs ppc440_cost = { COSTS_N_INSNS (3), /* mulsi */ COSTS_N_INSNS (2), /* mulsi_const */ COSTS_N_INSNS (2), /* mulsi_const9 */ COSTS_N_INSNS (3), /* muldi */ COSTS_N_INSNS (34), /* divsi */ COSTS_N_INSNS (34), /* divdi */ COSTS_N_INSNS (5), /* fp */ COSTS_N_INSNS (5), /* dmul */ COSTS_N_INSNS (19), /* sdiv */ COSTS_N_INSNS (33), /* ddiv */};/* Instruction costs on PPC601 processors. */static conststruct processor_costs ppc601_cost = { COSTS_N_INSNS (5), /* mulsi */ COSTS_N_INSNS (5), /* mulsi_const */ COSTS_N_INSNS (5), /* mulsi_const9 */ COSTS_N_INSNS (5), /* muldi */ COSTS_N_INSNS (36), /* divsi */ COSTS_N_INSNS (36), /* divdi */ COSTS_N_INSNS (4), /* fp */ COSTS_N_INSNS (5), /* dmul */ COSTS_N_INSNS (17), /* sdiv */ COSTS_N_INSNS (31), /* ddiv */};/* Instruction costs on PPC603 processors. */static conststruct processor_costs ppc603_cost = { COSTS_N_INSNS (5), /* mulsi */ COSTS_N_INSNS (3), /* mulsi_const */ COSTS_N_INSNS (2), /* mulsi_const9 */ COSTS_N_INSNS (5), /* muldi */ COSTS_N_INSNS (37), /* divsi */ COSTS_N_INSNS (37), /* divdi */ COSTS_N_INSNS (3), /* fp */ COSTS_N_INSNS (4), /* dmul */ COSTS_N_INSNS (18), /* sdiv */ COSTS_N_INSNS (33), /* ddiv */};/* Instruction costs on PPC604 processors. */static conststruct processor_costs ppc604_cost = { COSTS_N_INSNS (4), /* mulsi */ COSTS_N_INSNS (4), /* mulsi_const */ COSTS_N_INSNS (4), /* mulsi_const9 */ COSTS_N_INSNS (4), /* muldi */ COSTS_N_INSNS (20), /* divsi */ COSTS_N_INSNS (20), /* divdi */ COSTS_N_INSNS (3), /* fp */ COSTS_N_INSNS (3), /* dmul */ COSTS_N_INSNS (18), /* sdiv */ COSTS_N_INSNS (32), /* ddiv */};/* Instruction costs on PPC604e processors. */static conststruct processor_costs ppc604e_cost = { COSTS_N_INSNS (2), /* mulsi */ COSTS_N_INSNS (2), /* mulsi_const */ COSTS_N_INSNS (2), /* mulsi_const9 */ COSTS_N_INSNS (2), /* muldi */ COSTS_N_INSNS (20), /* divsi */ COSTS_N_INSNS (20), /* divdi */ COSTS_N_INSNS (3), /* fp */ COSTS_N_INSNS (3), /* dmul */ COSTS_N_INSNS (18), /* sdiv */ COSTS_N_INSNS (32), /* ddiv */};/* Instruction costs on PPC620 processors. */static conststruct processor_costs ppc620_cost = { COSTS_N_INSNS (5), /* mulsi */ COSTS_N_INSNS (4), /* mulsi_const */ COSTS_N_INSNS (3), /* mulsi_const9 */ COSTS_N_INSNS (7), /* muldi */ COSTS_N_INSNS (21), /* divsi */ COSTS_N_INSNS (37), /* divdi */ COSTS_N_INSNS (3), /* fp */ COSTS_N_INSNS (3), /* dmul */ COSTS_N_INSNS (18), /* sdiv */ COSTS_N_INSNS (32), /* ddiv */};/* Instruction costs on PPC630 processors. */static conststruct processor_costs ppc630_cost = { COSTS_N_INSNS (5), /* mulsi */ COSTS_N_INSNS (4), /* mulsi_const */ COSTS_N_INSNS (3), /* mulsi_const9 */ COSTS_N_INSNS (7), /* muldi */ COSTS_N_INSNS (21), /* divsi */ COSTS_N_INSNS (37), /* divdi */ COSTS_N_INSNS (3), /* fp */ COSTS_N_INSNS (3), /* dmul */ COSTS_N_INSNS (17), /* sdiv */ COSTS_N_INSNS (21), /* ddiv */};/* Instruction costs on PPC750 and PPC7400 processors. */static conststruct processor_costs ppc750_cost = { COSTS_N_INSNS (5), /* mulsi */ COSTS_N_INSNS (3), /* mulsi_const */ COSTS_N_INSNS (2), /* mulsi_const9 */ COSTS_N_INSNS (5), /* muldi */ COSTS_N_INSNS (17), /* divsi */ COSTS_N_INSNS (17), /* divdi */ COSTS_N_INSNS (3), /* fp */ COSTS_N_INSNS (3), /* dmul */ COSTS_N_INSNS (17), /* sdiv */ COSTS_N_INSNS (31), /* ddiv */};/* Instruction costs on PPC7450 processors. */static conststruct processor_costs ppc7450_cost = { COSTS_N_INSNS (4), /* mulsi */ COSTS_N_INSNS (3), /* mulsi_const */ COSTS_N_INSNS (3), /* mulsi_const9 */ COSTS_N_INSNS (4), /* muldi */ COSTS_N_INSNS (23), /* divsi */ COSTS_N_INSNS (23), /* divdi */ COSTS_N_INSNS (5), /* fp */ COSTS_N_INSNS (5), /* dmul */ COSTS_N_INSNS (21), /* sdiv */ COSTS_N_INSNS (35), /* ddiv */};/* Instruction costs on PPC8540 processors. */static conststruct processor_costs ppc8540_cost = { COSTS_N_INSNS (4), /* mulsi */ COSTS_N_INSNS (4), /* mulsi_const */ COSTS_N_INSNS (4), /* mulsi_const9 */ COSTS_N_INSNS (4), /* muldi */ COSTS_N_INSNS (19), /* divsi */ COSTS_N_INSNS (19), /* divdi */ COSTS_N_INSNS (4), /* fp */ COSTS_N_INSNS (4), /* dmul */ COSTS_N_INSNS (29), /* sdiv */ COSTS_N_INSNS (29), /* ddiv */};/* Instruction costs on POWER4 and POWER5 processors. */static conststruct processor_costs power4_cost = { COSTS_N_INSNS (3), /* mulsi */ COSTS_N_INSNS (2), /* mulsi_const */ COSTS_N_INSNS (2), /* mulsi_const9 */ COSTS_N_INSNS (4), /* muldi */ COSTS_N_INSNS (18), /* divsi */ COSTS_N_INSNS (34), /* divdi */ COSTS_N_INSNS (3), /* fp */ COSTS_N_INSNS (3), /* dmul */ COSTS_N_INSNS (17), /* sdiv */ COSTS_N_INSNS (17), /* ddiv */};static bool rs6000_function_ok_for_sibcall (tree, tree);static const char *rs6000_invalid_within_doloop (rtx);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, HOST_WIDE_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 legitimate_indexed_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);static bool no_global_regs_above (int);#ifdef HAVE_GAS_HIDDENstatic void rs6000_assemble_visibility (tree, int);#endifstatic int rs6000_ra_ever_killed (void);static tree rs6000_handle_longcall_attribute (tree *, tree, tree, int, bool *);static tree rs6000_handle_altivec_attribute (tree *, tree, tree, int, bool *);static void rs6000_eliminate_indexed_memrefs (rtx operands[2]);static const char *rs6000_mangle_fundamental_type (tree);extern const struct attribute_spec rs6000_attribute_table[];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 bool rs6000_return_in_memory (tree, tree);static void rs6000_file_start (void);#if TARGET_ELFstatic 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_end_indicate_exec_stack (void) ATTRIBUTE_UNUSED;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 (tree);#endif#if TARGET_XCOFFstatic void rs6000_xcoff_asm_globalize_label (FILE *, const char *);static void rs6000_xcoff_asm_named_section (const char *, unsigned int, tree);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);#endifstatic 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 bool is_microcoded_insn (rtx);static int is_dispatch_slot_restricted (rtx);static bool is_cracked_insn (rtx);static bool is_branch_slot_insn (rtx);static int rs6000_adjust_priority (rtx, int);static int rs6000_issue_rate (void);static bool rs6000_is_costly_dependence (rtx, rtx, rtx, int, int);static rtx get_next_active_insn (rtx, rtx);static bool insn_terminates_group_p (rtx , enum group_termination);static bool is_costly_group (rtx *, rtx);static int force_new_group (int, FILE *, rtx *, rtx, bool *, int, int *);static int redefine_groups (FILE *, int, rtx, rtx);static int pad_groups (FILE *, int, rtx, rtx);static void rs6000_sched_finish (FILE *, int);static int rs6000_use_sched_lookahead (void);static tree rs6000_builtin_mask_for_load (void);static void def_builtin (int, const char *, tree, int);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 rs6000_init_libfuncs (void);static void enable_mask_for_builtins (struct builtin_description *, int, enum rs6000_builtins, enum rs6000_builtins);static tree build_opaque_vector_type (tree, int);static void spe_init_builtins (void);static rtx spe_expand_builtin (tree, rtx, bool *);static rtx spe_expand_stv_builtin (enum insn_code, tree);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 rs6000_stack_t *rs6000_stack_info (void);static void debug_stack_info (rs6000_stack_t *);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_lv_builtin (enum insn_code, tree, rtx);static rtx altivec_expand_stv_builtin (enum insn_code, tree);static rtx altivec_expand_vec_init_builtin (tree, tree, rtx);static rtx altivec_expand_vec_set_builtin (tree);static rtx altivec_expand_vec_ext_builtin (tree, rtx);static int get_element_number (tree, tree);static bool rs6000_handle_option (size_t, const char *, int);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 (void);static unsigned int compute_vrsave_mask (void);static void compute_save_world_info (rs6000_stack_t *info_ptr);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 bool rs6000_is_opaque_type (tree);static rtx rs6000_dwarf_register_span (rtx);static rtx rs6000_legitimize_tls_address (rtx, enum tls_model);static void rs6000_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;static rtx rs6000_tls_get_addr (void);static rtx rs6000_got_sym (void);static 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 void rs6000_darwin64_record_arg_advance_flush (CUMULATIVE_ARGS *, HOST_WIDE_INT);static void rs6000_darwin64_record_arg_advance_recurse (CUMULATIVE_ARGS *, tree, HOST_WIDE_INT);static void rs6000_darwin64_record_arg_flush (CUMULATIVE_ARGS *, HOST_WIDE_INT, rtx[], int *);static void rs6000_darwin64_record_arg_recurse (CUMULATIVE_ARGS *, tree, HOST_WIDE_INT, rtx[], int *);static rtx rs6000_darwin64_record_arg (CUMULATIVE_ARGS *, tree, int, bool);static rtx rs6000_mixed_function_arg (enum machine_mode, tree, int);static void rs6000_move_block_from_reg (int regno, rtx x, int nregs);static void setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int);static bool rs6000_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode, tree, bool);static int rs6000_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode, tree, bool);static const char *invalid_arg_for_unprototyped_fn (tree, tree, tree);#if TARGET_MACHOstatic void macho_branch_islands (void);static void add_compiler_branch_island (tree, tree, int);static int no_previous_def (tree function_name);static tree get_prev_label (tree function_name);static void rs6000_darwin_file_start (void);#endifstatic tree rs6000_build_builtin_va_list (void);static tree rs6000_gimplify_va_arg (tree, tree, tree *, tree *);static bool rs6000_must_pass_in_stack (enum machine_mode, tree);static bool rs6000_vector_mode_supported_p (enum machine_mode);static int get_vec_cmp_insn (enum rtx_code, enum machine_mode, enum machine_mode);static rtx rs6000_emit_vector_compare (enum rtx_code, rtx, rtx, enum machine_mode);static int get_vsel_insn (enum machine_mode);static void rs6000_emit_vector_select (rtx, rtx, rtx, rtx);static tree rs6000_stack_protect_fail (void);const int INSN_NOT_AVAILABLE = -1;static enum machine_mode rs6000_eh_return_filter_mode (void);/* Hash table stuff for keeping track of TOC entries. */struct toc_hash_struct GTY(()){ /* `key' will satisfy CONSTANT_P; in fact, it will satisfy ASM_OUTPUT_SPECIAL_POOL_ENTRY_P. */ rtx key; enum machine_mode key_mode; int labelno;};static GTY ((param_is (struct toc_hash_struct))) htab_t toc_hash_table;/* Default register names. */char rs6000_reg_names[][8] ={ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "mq", "lr", "ctr","ap", "0", "1", "2", "3", "4", "5", "6", "7", "xer", /* AltiVec registers. */ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "vrsave", "vscr", /* SPE registers. */ "spe_acc", "spefscr", /* Soft frame pointer. */ "sfp"};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -