Studying note of GCC-3.4.6 source (40)

来源:互联网 发布:一个有10个指针的数组 编辑:程序博客网 时间:2024/05/17 20:12

4.1.5. Settle down parameters

After adjusting parameters for options for the target, other parameters can be determined finally now. For each -falign-* flags, there is an *_log variant which is the power of two not less than the variable, for .align output. INSN_SCHEDULING at line 4360 and DELAY_SLOTS at line 4364 below are defined by back-end tool getattrtab according to the target chip. And below, *_DEBUGGING_INFO specifies the format of debug information generated, note that we can only specify one type, even we define more than one macros, the rear will cover the former. For x86, DBX, SDB, DWARF2 are supported formats.

 

process_options (continue)

 

4290   /* Set aux_base_name if not already set.  */

4291   if (aux_base_name)

4292     ;

4293   else if (main_input_filename)

4294   {

4295     char *name = xstrdup (lbasename (main_input_filename));

4296

4297     strip_off_ending (name, strlen (name));

4298     aux_base_name = name;

4299   }

4300   else

4301     aux_base_name = "gccaux";

4302

4303   /* Set up the align_*_log variables, defaulting them to 1 if they

4304     were still unset.  */

4305   if (align_loops <= 0) align_loops = 1;

4306   if (align_loops_max_skip > align_loops || !align_loops)

4307     align_loops_max_skip = align_loops - 1;

4308   align_loops_log = floor_log2 (align_loops * 2 - 1);

4309   if (align_jumps <= 0) align_jumps = 1;

4310   if (align_jumps_max_skip > align_jumps || !align_jumps)

4311     align_jumps_max_skip = align_jumps - 1;

4312   align_jumps_log = floor_log2 (align_jumps * 2 - 1);

4313   if (align_labels <= 0) align_labels = 1;

4314   align_labels_log = floor_log2 (align_labels * 2 - 1);

4315   if (align_labels_max_skip > align_labels || !align_labels)

4316     align_labels_max_skip = align_labels - 1;

4317   if (align_functions <= 0) align_functions = 1;

4318   align_functions_log = floor_log2 (align_functions * 2 - 1);

4319

4320   /* Unrolling all loops implies that standard loop unrolling must also

4321     be done.  */

4322   if (flag_unroll_all_loops)

4323     flag_unroll_loops = 1;

4324

4325   if (flag_unroll_loops)

4326   {

4327     flag_old_unroll_loops = 0;

4328     flag_old_unroll_all_loops = 0;

4329   }

4330

4331   if (flag_old_unroll_all_loops)

4332     flag_old_unroll_loops = 1;

4333

4334   /* Old loop unrolling requires that strength_reduction be on also. Silently

4335     turn on strength reduction here if it isn't already on. Also, the loop

4336     unrolling code assumes that cse will be run after loop, so that must

4337     be turned on also.  */

4338   if (flag_old_unroll_loops)

4339   {

4340     flag_strength_reduce = 1;

4341     flag_rerun_cse_after_loop = 1;

4342   }

4343   if (flag_unroll_loops || flag_peel_loops)

4344     flag_rerun_cse_after_loop = 1;

4345

4346   if (flag_non_call_exceptions)

4347     flag_asynchronous_unwind_tables = 1;

4348   if (flag_asynchronous_unwind_tables)

4349     flag_unwind_tables = 1;

4350

4351   /* Disable unit-at-a-time mode for frontends not supporting callgraph

4352     interface.  */

4353   if (flag_unit_at_a_time && ! lang_hooks.callgraph.expand_function)

4354     flag_unit_at_a_time = 0;

4355

4356   if (flag_value_profile_transformations)

4357     flag_profile_values = 1;

4358

4359   /* Warn about options that are not supported on this machine.  */

4360 #ifndef INSN_SCHEDULING

4361   if (flag_schedule_insns || flag_schedule_insns_after_reload)

4362     warning ("instruction scheduling not supported on this target machine");

4363 #endif

4364 #ifndef DELAY_SLOTS

4365   if (flag_delayed_branch)

4366     warning ("this target machine does not have delayed branches");

4367 #endif

4368

4369   user_label_prefix = USER_LABEL_PREFIX;

4370   if (flag_leading_underscore != -1)

4371   {

4372     /* If the default prefix is more complicated than "" or "_",

4373       issue a warning and ignore this option.  */

4374     if (user_label_prefix[0] == 0 ||

4375        (user_label_prefix[0] == '_' && user_label_prefix[1] == 0))

4376     {

4377       user_label_prefix = flag_leading_underscore ? "_" : "";

4378     }

4379     else

4380       warning ("-f%sleading-underscore not supported on this target machine",

4381              flag_leading_underscore ? "" : "no-");

4382   }

4383

4384   /* If we are in verbose mode, write out the version and maybe all the

4385     option flags in use.  */

4386   if (version_flag)

4387   {

4388     print_version (stderr, "");

4389     if (! quiet_flag)

4390       print_switch_values (stderr, 0, MAX_LINE, "", " ", "/n");

4391   }

4392

4393   if (flag_syntax_only)

4394   {

4395     write_symbols = NO_DEBUG;

4396     profile_flag = 0;

4397   }

4398

4399   /* A lot of code assumes write_symbols == NO_DEBUG if the debugging

4400     level is 0.  */

4401   if (debug_info_level == DINFO_LEVEL_NONE)

4402     write_symbols = NO_DEBUG;

4403

4404   /* Now we know write_symbols, set up the debug hooks based on it.

4405     By default we do nothing for debug output.  */

4406   if (write_symbols == NO_DEBUG)

4407     ;

4408 #if defined(DBX_DEBUGGING_INFO)

4409   else if (write_symbols == DBX_DEBUG)

4410     debug_hooks = &dbx_debug_hooks;

4411 #endif

4412 #if defined(XCOFF_DEBUGGING_INFO)

4413   else if (write_symbols == XCOFF_DEBUG)

4414     debug_hooks = &xcoff_debug_hooks;

4415 #endif

4416 #ifdef SDB_DEBUGGING_INFO

4417   else if (write_symbols == SDB_DEBUG)

4418     debug_hooks = &sdb_debug_hooks;

4419 #endif

4420 #ifdef DWARF2_DEBUGGING_INFO

4421   else if (write_symbols == DWARF2_DEBUG)

4422     debug_hooks = &dwarf2_debug_hooks;

4423 #endif

4424 #ifdef VMS_DEBUGGING_INFO

4425   else if (write_symbols == VMS_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG)

4426     debug_hooks = &vmsdbg_debug_hooks;

4427 #endif

4428   else

4429     error ("target system does not support the /"%s/" debug format",

4430   debug_type_names[write_symbols]);

4431

4432   /* If auxiliary info generation is desired, open the output file.

4433     This goes in the same directory as the source file--unlike

4434     all the other output files.  */

4435   if (flag_gen_aux_info)

4436   {

4437     aux_info_file = fopen (aux_info_file_name, "w");

4438     if (aux_info_file == 0)

4439       fatal_error ("can't open %s: %m", aux_info_file_name);

4440   }

4441

4442   if (! targetm.have_named_sections)

4443   {

4444     if (flag_function_sections)

4445     {

4446       warning ("-ffunction-sections not supported for this target");

4447       flag_function_sections = 0;

4448     }

4449     if (flag_data_sections)

4450     {

4451       warning ("-fdata-sections not supported for this target");

4452       flag_data_sections = 0;

4453     }

4454   }

4455

4456   if (flag_function_sections && profile_flag)

4457   {

4458     warning ("-ffunction-sections disabled; it makes profiling impossible");

4459     flag_function_sections = 0;

4460   }

4461

4462 #ifndef HAVE_prefetch

4463   if (flag_prefetch_loop_arrays)

4464   {

4465     warning ("-fprefetch-loop-arrays not supported for this target");

4466     flag_prefetch_loop_arrays = 0;

4467   }

4468 #else

4469   if (flag_prefetch_loop_arrays && !HAVE_prefetch)

4470   {

4471     warning ("-fprefetch-loop-arrays not supported for this target (try -march switches)");

4472     flag_prefetch_loop_arrays = 0;

4473   }

4474 #endif

4475

4476   /* This combination of options isn't handled for i386 targets and doesn't

4477     make much sense anyway, so don't allow it.  */

4478   if (flag_prefetch_loop_arrays && optimize_size)

4479   {

4480     warning ("-fprefetch-loop-arrays is not supported with -Os");

4481     flag_prefetch_loop_arrays = 0;

4482   }

4483

4484 #ifndef OBJECT_FORMAT_ELF

4485   if (flag_function_sections && write_symbols != NO_DEBUG)

4486     warning ("-ffunction-sections may affect debugging on some targets");

4487 #endif

4488

4489   /* The presence of IEEE signaling NaNs, implies all math can trap.  */

4490   if (flag_signaling_nans)

4491     flag_trapping_math = 1;

4492 }

原创粉丝点击