📄 i386.c
字号:
&& !(target_flags_explicit & MASK_MMX)) target_flags |= MASK_MMX; if (processor_alias_table[i].flags & PTA_3DNOW && !(target_flags_explicit & MASK_3DNOW)) target_flags |= MASK_3DNOW; if (processor_alias_table[i].flags & PTA_3DNOW_A && !(target_flags_explicit & MASK_3DNOW_A)) target_flags |= MASK_3DNOW_A; if (processor_alias_table[i].flags & PTA_SSE && !(target_flags_explicit & MASK_SSE)) target_flags |= MASK_SSE; if (processor_alias_table[i].flags & PTA_SSE2 && !(target_flags_explicit & MASK_SSE2)) target_flags |= MASK_SSE2; if (processor_alias_table[i].flags & PTA_SSE3 && !(target_flags_explicit & MASK_SSE3)) target_flags |= MASK_SSE3; if (processor_alias_table[i].flags & PTA_PREFETCH_SSE) x86_prefetch_sse = true; break; } if (i == pta_size) error ("bad value (%s) for -march= switch", ix86_arch_string); for (i = 0; i < pta_size; i++) if (! strcmp (ix86_cpu_string, processor_alias_table[i].name)) { ix86_cpu = processor_alias_table[i].processor; break; } if (processor_alias_table[i].flags & PTA_PREFETCH_SSE) x86_prefetch_sse = true; if (i == pta_size) error ("bad value (%s) for -mcpu= switch", ix86_cpu_string); if (optimize_size) ix86_cost = &size_cost; else ix86_cost = processor_target_table[ix86_cpu].cost; target_flags |= processor_target_table[ix86_cpu].target_enable; target_flags &= ~processor_target_table[ix86_cpu].target_disable; /* Arrange to set up i386_stack_locals for all functions. */ init_machine_status = ix86_init_machine_status; /* Validate -mregparm= value. */ if (ix86_regparm_string) { i = atoi (ix86_regparm_string); if (i < 0 || i > REGPARM_MAX) error ("-mregparm=%d is not between 0 and %d", i, REGPARM_MAX); else ix86_regparm = i; } else if (TARGET_64BIT) ix86_regparm = REGPARM_MAX; /* If the user has provided any of the -malign-* options, warn and use that value only if -falign-* is not set. Remove this code in GCC 3.2 or later. */ if (ix86_align_loops_string) { warning ("-malign-loops is obsolete, use -falign-loops"); if (align_loops == 0) { i = atoi (ix86_align_loops_string); if (i < 0 || i > MAX_CODE_ALIGN) error ("-malign-loops=%d is not between 0 and %d", i, MAX_CODE_ALIGN); else align_loops = 1 << i; } } if (ix86_align_jumps_string) { warning ("-malign-jumps is obsolete, use -falign-jumps"); if (align_jumps == 0) { i = atoi (ix86_align_jumps_string); if (i < 0 || i > MAX_CODE_ALIGN) error ("-malign-loops=%d is not between 0 and %d", i, MAX_CODE_ALIGN); else align_jumps = 1 << i; } } if (ix86_align_funcs_string) { warning ("-malign-functions is obsolete, use -falign-functions"); if (align_functions == 0) { i = atoi (ix86_align_funcs_string); if (i < 0 || i > MAX_CODE_ALIGN) error ("-malign-loops=%d is not between 0 and %d", i, MAX_CODE_ALIGN); else align_functions = 1 << i; } } /* Default align_* from the processor table. */ if (align_loops == 0) { align_loops = processor_target_table[ix86_cpu].align_loop; align_loops_max_skip = processor_target_table[ix86_cpu].align_loop_max_skip; } if (align_jumps == 0) { align_jumps = processor_target_table[ix86_cpu].align_jump; align_jumps_max_skip = processor_target_table[ix86_cpu].align_jump_max_skip; } if (align_functions == 0) { align_functions = processor_target_table[ix86_cpu].align_func; } /* Validate -mpreferred-stack-boundary= value, or provide default. The default of 128 bits is for Pentium III's SSE __m128, but we don't want additional code to keep the stack aligned when optimizing for code size. */ ix86_preferred_stack_boundary = (optimize_size ? TARGET_64BIT ? 128 : 32 : 128); if (ix86_preferred_stack_boundary_string) { i = atoi (ix86_preferred_stack_boundary_string); if (i < (TARGET_64BIT ? 4 : 2) || i > 12) error ("-mpreferred-stack-boundary=%d is not between %d and 12", i, TARGET_64BIT ? 4 : 2); else ix86_preferred_stack_boundary = (1 << i) * BITS_PER_UNIT; } /* Validate -mbranch-cost= value, or provide default. */ ix86_branch_cost = processor_target_table[ix86_cpu].branch_cost; if (ix86_branch_cost_string) { i = atoi (ix86_branch_cost_string); if (i < 0 || i > 5) error ("-mbranch-cost=%d is not between 0 and 5", i); else ix86_branch_cost = i; } if (ix86_tls_dialect_string) { if (strcmp (ix86_tls_dialect_string, "gnu") == 0) ix86_tls_dialect = TLS_DIALECT_GNU; else if (strcmp (ix86_tls_dialect_string, "sun") == 0) ix86_tls_dialect = TLS_DIALECT_SUN; else error ("bad value (%s) for -mtls-dialect= switch", ix86_tls_dialect_string); } /* Keep nonleaf frame pointers. */ if (TARGET_OMIT_LEAF_FRAME_POINTER) flag_omit_frame_pointer = 1; /* If we're doing fast math, we don't care about comparison order wrt NaNs. This lets us use a shorter comparison sequence. */ if (flag_unsafe_math_optimizations) target_flags &= ~MASK_IEEE_FP; /* If the architecture always has an FPU, turn off NO_FANCY_MATH_387, since the insns won't need emulation. */ if (x86_arch_always_fancy_math_387 & (1 << ix86_arch)) target_flags &= ~MASK_NO_FANCY_MATH_387; /* Turn on SSE2 builtins for -msse3. */ if (TARGET_SSE3) target_flags |= MASK_SSE2; /* Turn on SSE builtins for -msse2. */ if (TARGET_SSE2) target_flags |= MASK_SSE; if (TARGET_64BIT) { if (TARGET_ALIGN_DOUBLE) error ("-malign-double makes no sense in the 64bit mode"); if (TARGET_RTD) error ("-mrtd calling convention not supported in the 64bit mode"); /* Enable by default the SSE and MMX builtins. */ target_flags |= (MASK_SSE2 | MASK_SSE | MASK_MMX | MASK_128BIT_LONG_DOUBLE); ix86_fpmath = FPMATH_SSE; } else ix86_fpmath = FPMATH_387; if (ix86_fpmath_string != 0) { if (! strcmp (ix86_fpmath_string, "387")) ix86_fpmath = FPMATH_387; else if (! strcmp (ix86_fpmath_string, "sse")) { if (!TARGET_SSE) { warning ("SSE instruction set disabled, using 387 arithmetics"); ix86_fpmath = FPMATH_387; } else ix86_fpmath = FPMATH_SSE; } else if (! strcmp (ix86_fpmath_string, "387,sse") || ! strcmp (ix86_fpmath_string, "sse,387")) { if (!TARGET_SSE) { warning ("SSE instruction set disabled, using 387 arithmetics"); ix86_fpmath = FPMATH_387; } else if (!TARGET_80387) { warning ("387 instruction set disabled, using SSE arithmetics"); ix86_fpmath = FPMATH_SSE; } else ix86_fpmath = FPMATH_SSE | FPMATH_387; } else error ("bad value (%s) for -mfpmath= switch", ix86_fpmath_string); } /* It makes no sense to ask for just SSE builtins, so MMX is also turned on by -msse. */ if (TARGET_SSE) { target_flags |= MASK_MMX; x86_prefetch_sse = true; } /* If it has 3DNow! it also has MMX so MMX is also turned on by -m3dnow */ if (TARGET_3DNOW) { target_flags |= MASK_MMX; /* If we are targetting the Athlon architecture, enable the 3Dnow/MMX extensions it adds. */ if (x86_3dnow_a & (1 << ix86_arch)) target_flags |= MASK_3DNOW_A; } if ((x86_accumulate_outgoing_args & CPUMASK) && !(target_flags_explicit & MASK_ACCUMULATE_OUTGOING_ARGS) && !optimize_size) target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS; /* Figure out what ASM_GENERATE_INTERNAL_LABEL builds as a prefix. */ { char *p; ASM_GENERATE_INTERNAL_LABEL (internal_label_prefix, "LX", 0); p = strchr (internal_label_prefix, 'X'); internal_label_prefix_len = p - internal_label_prefix; *p = '\0'; }}voidoptimization_options (level, size) int level; int size ATTRIBUTE_UNUSED;{ /* For -O2 and beyond, turn off -fschedule-insns by default. It tends to make the problem with not enough registers even worse. */#ifdef INSN_SCHEDULING if (level > 1) flag_schedule_insns = 0;#endif /* The default values of these switches depend on the TARGET_64BIT that is not known at this moment. Mark these values with 2 and let user the to override these. In case there is no command line option specifying them, we will set the defaults in override_options. */ if (optimize >= 1) flag_omit_frame_pointer = 2; flag_pcc_struct_return = 2; flag_asynchronous_unwind_tables = 2;}/* Table of valid machine attributes. */const struct attribute_spec ix86_attribute_table[] ={ /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */ /* Stdcall attribute says callee is responsible for popping arguments if they are not variable. */ { "stdcall", 0, 0, false, true, true, ix86_handle_cdecl_attribute }, /* Cdecl attribute says the callee is a normal C declaration */ { "cdecl", 0, 0, false, true, true, ix86_handle_cdecl_attribute }, /* Regparm attribute specifies how many integer arguments are to be passed in registers. */ { "regparm", 1, 1, false, true, true, ix86_handle_regparm_attribute },#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES { "dllimport", 0, 0, false, false, false, ix86_handle_dll_attribute }, { "dllexport", 0, 0, false, false, false, ix86_handle_dll_attribute }, { "shared", 0, 0, true, false, false, ix86_handle_shared_attribute },#endif { NULL, 0, 0, false, false, false, NULL }};/* Handle a "cdecl" or "stdcall" attribute; arguments as in struct attribute_spec.handler. */static treeix86_handle_cdecl_attribute (node, name, args, flags, no_add_attrs) 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) != METHOD_TYPE && TREE_CODE (*node) != FIELD_DECL && TREE_CODE (*node) != TYPE_DECL) { warning ("`%s' attribute only applies to functions", IDENTIFIER_POINTER (name)); *no_add_attrs = true; } if (TARGET_64BIT) { warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); *no_add_attrs = true; } return NULL_TREE;}/* Handle a "regparm" attribute; arguments as in struct attribute_spec.handler. */static treeix86_handle_regparm_attribute (node, name, args, flags, no_add_attrs) tree *node; tree name; tree args; int flags ATTRIBUTE_UNUSED; bool *no_add_attrs;{ if (TREE_CODE (*node) != FUNCTION_TYPE && TREE_CODE (*node) != METHOD_TYPE && TREE_CODE (*node) != FIELD_DECL && TREE_CODE (*node) != TYPE_DECL) { warning ("`%s' attribute only applies to functions", IDENTIFIER_POINTER (name)); *no_add_attrs = true; } else { tree cst; cst = TREE_VALUE (args); if (TREE_CODE (cst) != INTEGER_CST) { warning ("`%s' attribute requires an integer constant argument", IDENTIFIER_POINTER (name)); *no_add_attrs = true; } else if (compare_tree_int (cst, REGPARM_MAX) > 0) { warning ("argument to `%s' attribute larger than %d", IDENTIFIER_POINTER (name), REGPARM_MAX); *no_add_attrs = true; } } return NULL_TREE;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -