⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 i386.c

📁 linux下的gcc编译器
💻 C
📖 第 1 页 / 共 5 页
字号:
static void ix86_emit_save_regs PARAMS ((void));static void ix86_emit_save_regs_using_mov PARAMS ((rtx, HOST_WIDE_INT));static void ix86_emit_restore_regs_using_mov PARAMS ((rtx, int, int));static void ix86_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));static void ix86_set_move_mem_attrs_1 PARAMS ((rtx, rtx, rtx, rtx, rtx));static void ix86_sched_reorder_ppro PARAMS ((rtx *, rtx *));static HOST_WIDE_INT ix86_GOT_alias_set PARAMS ((void));static void ix86_adjust_counter PARAMS ((rtx, HOST_WIDE_INT));static rtx ix86_expand_aligntest PARAMS ((rtx, int));static void ix86_expand_strlensi_unroll_1 PARAMS ((rtx, rtx));static int ix86_issue_rate PARAMS ((void));static int ix86_adjust_cost PARAMS ((rtx, rtx, rtx, int));static void ix86_sched_init PARAMS ((FILE *, int, int));static int ix86_sched_reorder PARAMS ((FILE *, int, rtx *, int *, int));static int ix86_variable_issue PARAMS ((FILE *, int, rtx, int));static int ia32_use_dfa_pipeline_interface PARAMS ((void));static int ia32_multipass_dfa_lookahead PARAMS ((void));static void ix86_init_mmx_sse_builtins PARAMS ((void));static rtx x86_this_parameter PARAMS ((tree));static void x86_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT,					 HOST_WIDE_INT, tree));static bool x86_can_output_mi_thunk PARAMS ((tree, HOST_WIDE_INT,					     HOST_WIDE_INT, tree));struct ix86_address{  rtx base, index, disp;  HOST_WIDE_INT scale;};static int ix86_decompose_address PARAMS ((rtx, struct ix86_address *));static bool ix86_cannot_force_const_mem PARAMS ((rtx));static void ix86_encode_section_info PARAMS ((tree, int)) ATTRIBUTE_UNUSED;static const char *ix86_strip_name_encoding PARAMS ((const char *))     ATTRIBUTE_UNUSED;struct builtin_description;static rtx ix86_expand_sse_comi PARAMS ((const struct builtin_description *,					 tree, rtx));static rtx ix86_expand_sse_compare PARAMS ((const struct builtin_description *,					    tree, rtx));static rtx ix86_expand_unop1_builtin PARAMS ((enum insn_code, tree, rtx));static rtx ix86_expand_unop_builtin PARAMS ((enum insn_code, tree, rtx, int));static rtx ix86_expand_binop_builtin PARAMS ((enum insn_code, tree, rtx));static rtx ix86_expand_store_builtin PARAMS ((enum insn_code, tree));static rtx safe_vector_operand PARAMS ((rtx, enum machine_mode));static enum rtx_code ix86_fp_compare_code_to_integer PARAMS ((enum rtx_code));static void ix86_fp_comparison_codes PARAMS ((enum rtx_code code,					      enum rtx_code *,					      enum rtx_code *,					      enum rtx_code *));static rtx ix86_expand_fp_compare PARAMS ((enum rtx_code, rtx, rtx, rtx,					  rtx *, rtx *));static int ix86_fp_comparison_arithmetics_cost PARAMS ((enum rtx_code code));static int ix86_fp_comparison_fcomi_cost PARAMS ((enum rtx_code code));static int ix86_fp_comparison_sahf_cost PARAMS ((enum rtx_code code));static int ix86_fp_comparison_cost PARAMS ((enum rtx_code code));static unsigned int ix86_select_alt_pic_regnum PARAMS ((void));static int ix86_save_reg PARAMS ((unsigned int, int));static void ix86_compute_frame_layout PARAMS ((struct ix86_frame *));static int ix86_comp_type_attributes PARAMS ((tree, tree));static int ix86_fntype_regparm PARAMS ((tree));const struct attribute_spec ix86_attribute_table[];static tree ix86_handle_cdecl_attribute PARAMS ((tree *, tree, tree, int, bool *));static tree ix86_handle_regparm_attribute PARAMS ((tree *, tree, tree, int, bool *));static int ix86_value_regno PARAMS ((enum machine_mode));static bool contains_128bit_aligned_vector_p PARAMS ((tree));#if defined (DO_GLOBAL_CTORS_BODY) && defined (HAS_INIT_SECTION)static void ix86_svr3_asm_out_constructor PARAMS ((rtx, int));#endif/* Register class used for passing given 64bit part of the argument.   These represent classes as documented by the PS ABI, with the exception   of SSESF, SSEDF classes, that are basically SSE class, just gcc will   use SF or DFmode move instead of DImode to avoid reformating penalties.   Similary we play games with INTEGERSI_CLASS to use cheaper SImode moves   whenever possible (upper half does contain padding). */enum x86_64_reg_class  {    X86_64_NO_CLASS,    X86_64_INTEGER_CLASS,    X86_64_INTEGERSI_CLASS,    X86_64_SSE_CLASS,    X86_64_SSESF_CLASS,    X86_64_SSEDF_CLASS,    X86_64_SSEUP_CLASS,    X86_64_X87_CLASS,    X86_64_X87UP_CLASS,    X86_64_MEMORY_CLASS  };static const char * const x86_64_reg_class_name[] =   {"no", "integer", "integerSI", "sse", "sseSF", "sseDF", "sseup", "x87", "x87up", "no"};#define MAX_CLASSES 4static int classify_argument PARAMS ((enum machine_mode, tree,				      enum x86_64_reg_class [MAX_CLASSES],				      int));static int examine_argument PARAMS ((enum machine_mode, tree, int, int *,				     int *));static rtx construct_container PARAMS ((enum machine_mode, tree, int, int, int,					const int *, int));static enum x86_64_reg_class merge_classes PARAMS ((enum x86_64_reg_class,						    enum x86_64_reg_class));/* Initialize the GCC target structure.  */#undef TARGET_ATTRIBUTE_TABLE#define TARGET_ATTRIBUTE_TABLE ix86_attribute_table#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES#  undef TARGET_MERGE_DECL_ATTRIBUTES#  define TARGET_MERGE_DECL_ATTRIBUTES merge_dllimport_decl_attributes#endif#undef TARGET_COMP_TYPE_ATTRIBUTES#define TARGET_COMP_TYPE_ATTRIBUTES ix86_comp_type_attributes#undef TARGET_INIT_BUILTINS#define TARGET_INIT_BUILTINS ix86_init_builtins#undef TARGET_EXPAND_BUILTIN#define TARGET_EXPAND_BUILTIN ix86_expand_builtin#undef TARGET_ASM_FUNCTION_EPILOGUE#define TARGET_ASM_FUNCTION_EPILOGUE ix86_output_function_epilogue#undef TARGET_ASM_OPEN_PAREN#define TARGET_ASM_OPEN_PAREN ""#undef TARGET_ASM_CLOSE_PAREN#define TARGET_ASM_CLOSE_PAREN ""#undef TARGET_ASM_ALIGNED_HI_OP#define TARGET_ASM_ALIGNED_HI_OP ASM_SHORT#undef TARGET_ASM_ALIGNED_SI_OP#define TARGET_ASM_ALIGNED_SI_OP ASM_LONG#ifdef ASM_QUAD#undef TARGET_ASM_ALIGNED_DI_OP#define TARGET_ASM_ALIGNED_DI_OP ASM_QUAD#endif#undef TARGET_ASM_UNALIGNED_HI_OP#define TARGET_ASM_UNALIGNED_HI_OP TARGET_ASM_ALIGNED_HI_OP#undef TARGET_ASM_UNALIGNED_SI_OP#define TARGET_ASM_UNALIGNED_SI_OP TARGET_ASM_ALIGNED_SI_OP#undef TARGET_ASM_UNALIGNED_DI_OP#define TARGET_ASM_UNALIGNED_DI_OP TARGET_ASM_ALIGNED_DI_OP#undef TARGET_SCHED_ADJUST_COST#define TARGET_SCHED_ADJUST_COST ix86_adjust_cost#undef TARGET_SCHED_ISSUE_RATE#define TARGET_SCHED_ISSUE_RATE ix86_issue_rate#undef TARGET_SCHED_VARIABLE_ISSUE#define TARGET_SCHED_VARIABLE_ISSUE ix86_variable_issue#undef TARGET_SCHED_INIT#define TARGET_SCHED_INIT ix86_sched_init#undef TARGET_SCHED_REORDER#define TARGET_SCHED_REORDER ix86_sched_reorder#undef TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE#define TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE \  ia32_use_dfa_pipeline_interface#undef TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD#define TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD \  ia32_multipass_dfa_lookahead#ifdef HAVE_AS_TLS#undef TARGET_HAVE_TLS#define TARGET_HAVE_TLS true#endif#undef TARGET_CANNOT_FORCE_CONST_MEM#define TARGET_CANNOT_FORCE_CONST_MEM ix86_cannot_force_const_mem#undef TARGET_ASM_OUTPUT_MI_THUNK#define TARGET_ASM_OUTPUT_MI_THUNK x86_output_mi_thunk#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK#define TARGET_ASM_CAN_OUTPUT_MI_THUNK x86_can_output_mi_thunk#undef TARGET_FIXED_CONDITION_CODE_REGS#define TARGET_FIXED_CONDITION_CODE_REGS ix86_fixed_condition_code_regs#undef TARGET_CC_MODES_COMPATIBLE#define TARGET_CC_MODES_COMPATIBLE ix86_cc_modes_compatiblestruct gcc_target targetm = TARGET_INITIALIZER;/* The svr4 ABI for the i386 says that records and unions are returned   in memory.  */#ifndef DEFAULT_PCC_STRUCT_RETURN#define DEFAULT_PCC_STRUCT_RETURN 1#endif/* Sometimes certain combinations of command options do not make   sense on a particular target machine.  You can define a macro   `OVERRIDE_OPTIONS' to take account of this.  This macro, if   defined, is executed once just after all the command options have   been parsed.   Don't use this macro to turn on various extra optimizations for   `-O'.  That is what `OPTIMIZATION_OPTIONS' is for.  */voidoverride_options (){  int i;  /* Comes from final.c -- no real reason to change it.  */#define MAX_CODE_ALIGN 16  static struct ptt    {      const struct processor_costs *cost;	/* Processor costs */      const int target_enable;			/* Target flags to enable.  */      const int target_disable;			/* Target flags to disable.  */      const int align_loop;			/* Default alignments.  */      const int align_loop_max_skip;      const int align_jump;      const int align_jump_max_skip;      const int align_func;      const int branch_cost;    }  const processor_target_table[PROCESSOR_max] =    {      {&i386_cost, 0, 0, 4, 3, 4, 3, 4, 1},      {&i486_cost, 0, 0, 16, 15, 16, 15, 16, 1},      {&pentium_cost, 0, 0, 16, 7, 16, 7, 16, 1},      {&pentiumpro_cost, 0, 0, 16, 15, 16, 7, 16, 1},      {&k6_cost, 0, 0, 32, 7, 32, 7, 32, 1},      {&athlon_cost, 0, 0, 16, 7, 64, 7, 16, 1},      {&pentium4_cost, 0, 0, 0, 0, 0, 0, 0, 1}    };  static const char * const cpu_names[] = TARGET_CPU_DEFAULT_NAMES;  static struct pta    {      const char *const name;		/* processor name or nickname.  */      const enum processor_type processor;      const enum pta_flags	{	  PTA_SSE = 1,	  PTA_SSE2 = 2,	  PTA_SSE3 = 4,	  PTA_MMX = 8,	  PTA_PREFETCH_SSE = 16,	  PTA_3DNOW = 32,	  PTA_3DNOW_A = 64	} flags;    }  const processor_alias_table[] =    {      {"i386", PROCESSOR_I386, 0},      {"i486", PROCESSOR_I486, 0},      {"i586", PROCESSOR_PENTIUM, 0},      {"pentium", PROCESSOR_PENTIUM, 0},      {"pentium-mmx", PROCESSOR_PENTIUM, PTA_MMX},      {"winchip-c6", PROCESSOR_I486, PTA_MMX},      {"winchip2", PROCESSOR_I486, PTA_MMX | PTA_3DNOW},      {"c3", PROCESSOR_I486, PTA_MMX | PTA_3DNOW},      {"i686", PROCESSOR_PENTIUMPRO, 0},      {"pentiumpro", PROCESSOR_PENTIUMPRO, 0},      {"pentium2", PROCESSOR_PENTIUMPRO, PTA_MMX},      {"pentium3", PROCESSOR_PENTIUMPRO, PTA_MMX | PTA_SSE | PTA_PREFETCH_SSE},      {"pentium4", PROCESSOR_PENTIUM4, PTA_SSE | PTA_SSE2				       | PTA_MMX | PTA_PREFETCH_SSE},      {"prescott", PROCESSOR_PENTIUM4, PTA_SSE | PTA_SSE2 | PTA_SSE3				       | PTA_MMX | PTA_PREFETCH_SSE},      {"nocona", PROCESSOR_PENTIUM4, PTA_SSE | PTA_SSE2 | PTA_SSE3				     | PTA_MMX | PTA_PREFETCH_SSE},      {"k6", PROCESSOR_K6, PTA_MMX},      {"k6-2", PROCESSOR_K6, PTA_MMX | PTA_3DNOW},      {"k6-3", PROCESSOR_K6, PTA_MMX | PTA_3DNOW},      {"athlon", PROCESSOR_ATHLON, PTA_MMX | PTA_PREFETCH_SSE | PTA_3DNOW				   | PTA_3DNOW_A},      {"athlon-tbird", PROCESSOR_ATHLON, PTA_MMX | PTA_PREFETCH_SSE					 | PTA_3DNOW | PTA_3DNOW_A},      {"x86-64", PROCESSOR_ATHLON, PTA_MMX | PTA_PREFETCH_SSE | PTA_SSE},      {"athlon-4", PROCESSOR_ATHLON, PTA_MMX | PTA_PREFETCH_SSE | PTA_3DNOW				    | PTA_3DNOW_A | PTA_SSE},      {"athlon-xp", PROCESSOR_ATHLON, PTA_MMX | PTA_PREFETCH_SSE | PTA_3DNOW				      | PTA_3DNOW_A | PTA_SSE},      {"athlon-mp", PROCESSOR_ATHLON, PTA_MMX | PTA_PREFETCH_SSE | PTA_3DNOW				      | PTA_3DNOW_A | PTA_SSE},    };  int const pta_size = ARRAY_SIZE (processor_alias_table);  /* By default our XFmode is the 80-bit extended format.  If we have     use TFmode instead, it's also the 80-bit format, but with padding.  */  real_format_for_mode[XFmode - QFmode] = &ieee_extended_intel_96_format;  real_format_for_mode[TFmode - QFmode] = &ieee_extended_intel_128_format;  /* Set the default values for switches whose default depends on TARGET_64BIT     in case they weren't overwriten by command line options.  */  if (TARGET_64BIT)    {      if (flag_omit_frame_pointer == 2)	flag_omit_frame_pointer = 1;      if (flag_asynchronous_unwind_tables == 2)	flag_asynchronous_unwind_tables = 1;      if (flag_pcc_struct_return == 2)	flag_pcc_struct_return = 0;    }  else    {      if (flag_omit_frame_pointer == 2)	flag_omit_frame_pointer = 0;      if (flag_asynchronous_unwind_tables == 2)	flag_asynchronous_unwind_tables = 0;      if (flag_pcc_struct_return == 2)	flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;    }#ifdef SUBTARGET_OVERRIDE_OPTIONS  SUBTARGET_OVERRIDE_OPTIONS;#endif  if (!ix86_cpu_string && ix86_arch_string)    ix86_cpu_string = ix86_arch_string;  if (!ix86_cpu_string)    ix86_cpu_string = cpu_names [TARGET_CPU_DEFAULT];  if (!ix86_arch_string)    ix86_arch_string = TARGET_64BIT ? "x86-64" : "i386";  if (ix86_cmodel_string != 0)    {      if (!strcmp (ix86_cmodel_string, "small"))	ix86_cmodel = flag_pic ? CM_SMALL_PIC : CM_SMALL;      else if (flag_pic)	sorry ("code model %s not supported in PIC mode", ix86_cmodel_string);      else if (!strcmp (ix86_cmodel_string, "32"))	ix86_cmodel = CM_32;      else if (!strcmp (ix86_cmodel_string, "kernel") && !flag_pic)	ix86_cmodel = CM_KERNEL;      else if (!strcmp (ix86_cmodel_string, "medium") && !flag_pic)	ix86_cmodel = CM_MEDIUM;      else if (!strcmp (ix86_cmodel_string, "large") && !flag_pic)	ix86_cmodel = CM_LARGE;      else	error ("bad value (%s) for -mcmodel= switch", ix86_cmodel_string);    }  else    {      ix86_cmodel = CM_32;      if (TARGET_64BIT)	ix86_cmodel = flag_pic ? CM_SMALL_PIC : CM_SMALL;    }  if (ix86_asm_string != 0)    {      if (!strcmp (ix86_asm_string, "intel"))	ix86_asm_dialect = ASM_INTEL;      else if (!strcmp (ix86_asm_string, "att"))	ix86_asm_dialect = ASM_ATT;      else	error ("bad value (%s) for -masm= switch", ix86_asm_string);    }  if ((TARGET_64BIT == 0) != (ix86_cmodel == CM_32))    error ("code model `%s' not supported in the %s bit mode",	   ix86_cmodel_string, TARGET_64BIT ? "64" : "32");  if (ix86_cmodel == CM_LARGE)    sorry ("code model `large' not supported yet");  if ((TARGET_64BIT != 0) != ((target_flags & MASK_64BIT) != 0))    sorry ("%i-bit mode not compiled in",	   (target_flags & MASK_64BIT) ? 64 : 32);  for (i = 0; i < pta_size; i++)    if (! strcmp (ix86_arch_string, processor_alias_table[i].name))      {	ix86_arch = processor_alias_table[i].processor;	/* Default cpu tuning to the architecture.  */	ix86_cpu = ix86_arch;	if (processor_alias_table[i].flags & PTA_MMX

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -