00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include "config.h"
00038 #undef FLOAT
00039 #undef FFS
00040 #include "system.h"
00041 #include <signal.h>
00042
00043 #ifdef HAVE_SYS_RESOURCE_H
00044 # include <sys/resource.h>
00045 #endif
00046
00047 #ifdef HAVE_SYS_TIMES_H
00048 # include <sys/times.h>
00049 #endif
00050
00051 #include "input.h"
00052 #ifdef SGI_MONGOOSE
00053
00054 #include "rtl.h"
00055 #endif
00056 #include "tree.h"
00057 #ifndef SGI_MONGOOSE
00058 #include "rtl.h"
00059 #endif
00060 #include "tm_p.h"
00061 #include "flags.h"
00062 #include "insn-attr.h"
00063 #include "insn-config.h"
00064 #include "insn-flags.h"
00065 #include "hard-reg-set.h"
00066 #include "recog.h"
00067 #include "output.h"
00068 #include "except.h"
00069 #include "function.h"
00070 #include "toplev.h"
00071 #include "expr.h"
00072 #include "basic-block.h"
00073 #include "intl.h"
00074 #include "ggc.h"
00075 #include "graph.h"
00076 #include "loop.h"
00077 #include "regs.h"
00078 #include "timevar.h"
00079 #include "diagnostic.h"
00080 #include "ssa.h"
00081 #include "params.h"
00082 #include "reload.h"
00083 #include "dwarf2asm.h"
00084 #include "integrate.h"
00085 #include "real.h"
00086 #include "debug.h"
00087 #include "target.h"
00088 #include "langhooks.h"
00089 #include "cfglayout.h"
00090 #ifdef SGI_MONGOOSE
00091
00092 #include "defaults.h"
00093 #endif
00094
00095 #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
00096 #include "dwarf2out.h"
00097 #endif
00098
00099 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
00100 #include "dbxout.h"
00101 #endif
00102
00103 #ifdef SDB_DEBUGGING_INFO
00104 #include "sdbout.h"
00105 #endif
00106
00107 #ifdef XCOFF_DEBUGGING_INFO
00108 #include "xcoffout.h"
00109
00110 #endif
00111
00112
00113
00114
00115 extern int size_directive_output;
00116 extern tree last_assemble_variable_decl;
00117
00118 extern void reg_alloc PARAMS ((void));
00119
00120 static void general_init PARAMS ((char *));
00121 static void parse_options_and_default_flags PARAMS ((int, char **));
00122 static void do_compile PARAMS ((void));
00123 static void process_options PARAMS ((void));
00124 static void backend_init PARAMS ((void));
00125 static int lang_dependent_init PARAMS ((const char *));
00126 static void init_asm_output PARAMS ((const char *));
00127 static void finalize PARAMS ((void));
00128
00129 static void set_target_switch PARAMS ((const char *));
00130
00131 static void crash_signal PARAMS ((int)) ATTRIBUTE_NORETURN;
00132 #ifdef SGI_MONGOOSE
00133 #ifdef KEY
00134 extern void mark_referenced_funcs PARAMS ((tree));
00135 extern void gxx_emits_decl PARAMS ((tree));
00136 #endif
00137 void compile_file PARAMS ((char *));
00138 int parse_tree_dump = 0;
00139 #else
00140 static void compile_file PARAMS ((void));
00141 #endif
00142 static void display_help PARAMS ((void));
00143 static void display_target_options PARAMS ((void));
00144
00145 static void decode_d_option PARAMS ((const char *));
00146 static int decode_f_option PARAMS ((const char *));
00147 static int decode_W_option PARAMS ((const char *));
00148 static int decode_g_option PARAMS ((const char *));
00149 static unsigned int independent_decode_option PARAMS ((int, char **));
00150
00151 static void print_version PARAMS ((FILE *, const char *));
00152 static int print_single_switch PARAMS ((FILE *, int, int, const char *,
00153 const char *, const char *,
00154 const char *, const char *));
00155 static void print_switch_values PARAMS ((FILE *, int, int, const char *,
00156 const char *, const char *));
00157
00158
00159 static int set_yydebug;
00160
00161 #ifdef TARG_SL
00162
00163 bool Long_Long_Support = FALSE;
00164
00165
00166 bool Float_Point_Support = FALSE;
00167 #endif
00168
00169
00170 #define MAX_LINE 75
00171
00172
00173
00174 const char *progname;
00175
00176
00177 int save_argc;
00178 char **save_argv;
00179
00180
00181
00182
00183 const char *input_filename;
00184
00185
00186
00187
00188
00189 const char *main_input_filename;
00190
00191
00192
00193 int lineno;
00194
00195
00196 int no_new_pseudos;
00197
00198
00199
00200 struct file_stack *input_file_stack;
00201
00202
00203 int input_file_stack_tick;
00204
00205
00206
00207 const char *dump_base_name;
00208
00209
00210
00211 const char *aux_base_name;
00212
00213
00214 #ifndef DUMPFILE_FORMAT
00215 #define DUMPFILE_FORMAT ".%02d."
00216 #endif
00217
00218
00219
00220
00221
00222 extern int target_flags;
00223
00224
00225
00226
00227 int target_flags_explicit;
00228
00229
00230
00231 const struct gcc_debug_hooks *debug_hooks = &do_nothing_debug_hooks;
00232
00233
00234
00235 struct dump_file_info
00236 {
00237
00238 const char *const extension;
00239
00240
00241 char const debug_switch;
00242
00243
00244 char const graph_dump_p;
00245
00246
00247 char enabled;
00248
00249
00250 char initialized;
00251 };
00252
00253
00254
00255 enum dump_file_index
00256 {
00257 DFI_rtl,
00258 DFI_sibling,
00259 DFI_eh,
00260 DFI_jump,
00261 DFI_ssa,
00262 DFI_ssa_ccp,
00263 DFI_ssa_dce,
00264 DFI_ussa,
00265 DFI_null,
00266 DFI_cse,
00267 DFI_addressof,
00268 DFI_gcse,
00269 DFI_loop,
00270 DFI_cfg,
00271 DFI_bp,
00272 DFI_ce1,
00273 DFI_tracer,
00274 DFI_cse2,
00275 DFI_life,
00276 DFI_combine,
00277 DFI_ce2,
00278 DFI_regmove,
00279 DFI_sched,
00280 DFI_lreg,
00281 DFI_greg,
00282 DFI_postreload,
00283 DFI_flow2,
00284 DFI_peephole2,
00285 DFI_rnreg,
00286 DFI_ce3,
00287 DFI_sched2,
00288 DFI_stack,
00289 DFI_bbro,
00290 DFI_mach,
00291 DFI_dbr,
00292 #ifdef SGI_MONGOOSE
00293 DFI_sgi_parse_tree,
00294 #endif
00295 DFI_MAX
00296 };
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307 static struct dump_file_info dump_file[DFI_MAX] =
00308 {
00309 { "rtl", 'r', 0, 0, 0 },
00310 { "sibling", 'i', 0, 0, 0 },
00311 { "eh", 'h', 0, 0, 0 },
00312 { "jump", 'j', 0, 0, 0 },
00313 { "ssa", 'e', 1, 0, 0 },
00314 { "ssaccp", 'W', 1, 0, 0 },
00315 { "ssadce", 'X', 1, 0, 0 },
00316 { "ussa", 'e', 1, 0, 0 },
00317 { "null", 'u', 0, 0, 0 },
00318 { "cse", 's', 0, 0, 0 },
00319 { "addressof", 'F', 0, 0, 0 },
00320 { "gcse", 'G', 1, 0, 0 },
00321 { "loop", 'L', 1, 0, 0 },
00322 { "cfg", 'f', 1, 0, 0 },
00323 { "bp", 'b', 1, 0, 0 },
00324 { "ce1", 'C', 1, 0, 0 },
00325 { "tracer", 'T', 1, 0, 0 },
00326 { "cse2", 't', 1, 0, 0 },
00327 { "life", 'f', 1, 0, 0 },
00328 { "combine", 'c', 1, 0, 0 },
00329 { "ce2", 'C', 1, 0, 0 },
00330 { "regmove", 'N', 1, 0, 0 },
00331 { "sched", 'S', 1, 0, 0 },
00332 { "lreg", 'l', 1, 0, 0 },
00333 { "greg", 'g', 1, 0, 0 },
00334 { "postreload", 'o', 1, 0, 0 },
00335 { "flow2", 'w', 1, 0, 0 },
00336 { "peephole2", 'z', 1, 0, 0 },
00337 { "rnreg", 'n', 1, 0, 0 },
00338 { "ce3", 'E', 1, 0, 0 },
00339 { "sched2", 'R', 1, 0, 0 },
00340 { "stack", 'k', 1, 0, 0 },
00341 { "bbro", 'B', 1, 0, 0 },
00342 { "mach", 'M', 1, 0, 0 },
00343 { "dbr", 'd', 0, 0, 0 },
00344 #ifdef SGI_MONGOOSE
00345 #ifdef KEY
00346 { "tree", 'P', 0, 0, 0 },
00347 #else
00348 { "sgi_parse_tree", 'P', 0, 0, 0 },
00349 #endif
00350 #endif
00351 };
00352
00353 static int open_dump_file PARAMS ((enum dump_file_index, tree));
00354 static void close_dump_file PARAMS ((enum dump_file_index,
00355 void (*) (FILE *, rtx), rtx));
00356
00357
00358
00359 int rtl_dump_and_exit;
00360 int flag_print_asm_name;
00361 static int version_flag;
00362 static char *filename;
00363 enum graph_dump_types graph_dump_format;
00364
00365
00366
00367 char *asm_file_name;
00368
00369
00370 int g_switch_value;
00371 int g_switch_set;
00372
00373
00374
00375
00376 enum debug_info_type write_symbols = NO_DEBUG;
00377
00378
00379
00380 enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
00381
00382
00383
00384
00385
00386 int use_gnu_debug_info_extensions = 0;
00387
00388
00389
00390
00391
00392
00393
00394
00395 int optimize = 0;
00396
00397
00398
00399
00400
00401
00402 int optimize_size = 0;
00403
00404
00405 static int exit_after_options = 0;
00406
00407
00408
00409 tree current_function_decl;
00410
00411
00412
00413 tree current_function_func_begin_label;
00414
00415
00416
00417 int flag_eliminate_dwarf2_dups = 0;
00418
00419
00420
00421 int profile_flag = 0;
00422
00423
00424
00425 int profile_arc_flag = 0;
00426
00427
00428
00429 int flag_test_coverage = 0;
00430
00431
00432
00433 int flag_branch_probabilities = 0;
00434
00435
00436
00437 int flag_reorder_blocks = 0;
00438
00439
00440
00441 int flag_reorder_functions = 0;
00442
00443
00444
00445 int flag_rename_registers = 0;
00446 int flag_cprop_registers = 0;
00447
00448
00449
00450
00451 int pedantic = 0;
00452
00453
00454
00455
00456 int in_system_header = 0;
00457
00458
00459
00460 #ifdef SGI_MONGOOSE
00461 int quiet_flag = 1;
00462 #else
00463 int quiet_flag = 0;
00464 #endif
00465
00466 #ifdef SGI_MONGOOSE
00467 #ifdef KEY
00468 int pstatic_as_global = 1;
00469 #else
00470 int pstatic_as_global = 0;
00471 #endif
00472 #endif
00473
00474
00475
00476 int time_report = 0;
00477
00478
00479
00480
00481 int mem_report = 0;
00482
00483
00484
00485 int flag_detailed_statistics = 0;
00486
00487
00488
00489
00490
00491
00492 int flag_signed_char;
00493
00494
00495
00496 int flag_short_enums;
00497
00498
00499
00500
00501
00502 #ifdef DEFAULT_CALLER_SAVES
00503 int flag_caller_saves = 1;
00504 #else
00505 int flag_caller_saves = 0;
00506 #endif
00507
00508
00509
00510
00511
00512
00513 #ifndef DEFAULT_PCC_STRUCT_RETURN
00514 #define DEFAULT_PCC_STRUCT_RETURN 1
00515 #endif
00516
00517
00518
00519 int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
00520
00521
00522
00523
00524 int flag_force_mem = 0;
00525
00526
00527
00528
00529 int flag_force_addr = 0;
00530
00531
00532
00533
00534 int flag_defer_pop = 0;
00535
00536
00537
00538
00539 int flag_float_store = 0;
00540
00541
00542
00543
00544 int flag_cse_follow_jumps;
00545
00546
00547
00548 int flag_cse_skip_blocks;
00549
00550
00551
00552 int flag_expensive_optimizations;
00553
00554
00555
00556
00557 int flag_thread_jumps;
00558
00559
00560
00561 int flag_strength_reduce = 0;
00562
00563
00564
00565
00566
00567
00568 int flag_unroll_loops;
00569
00570
00571
00572
00573 int flag_unroll_all_loops;
00574
00575
00576
00577 int flag_prefetch_loop_arrays;
00578
00579
00580
00581
00582 int flag_move_all_movables = 0;
00583
00584
00585
00586
00587 int flag_reduce_all_givs = 0;
00588
00589
00590
00591
00592 int flag_regmove = 0;
00593
00594
00595
00596
00597 int flag_writable_strings = 0;
00598
00599
00600
00601
00602
00603 int flag_no_function_cse = 0;
00604
00605
00606
00607
00608 int flag_omit_frame_pointer = 0;
00609
00610
00611
00612
00613 int flag_function_sections = 0;
00614
00615
00616
00617 int flag_data_sections = 0;
00618
00619
00620
00621 int flag_no_peephole = 0;
00622
00623
00624
00625 int flag_optimize_sibling_calls = 0;
00626
00627
00628
00629
00630 int flag_errno_math = 1;
00631
00632
00633
00634
00635
00636
00637 int flag_unsafe_math_optimizations = 0;
00638
00639
00640
00641 int flag_finite_math_only = 0;
00642
00643
00644
00645
00646
00647
00648
00649 int flag_trapping_math = 1;
00650
00651
00652
00653
00654
00655 int flag_signaling_nans = 0;
00656
00657
00658
00659
00660
00661 int flag_complex_divide_method = 0;
00662
00663
00664
00665 int flag_volatile;
00666
00667
00668
00669 int flag_volatile_global;
00670
00671
00672
00673 int flag_volatile_static;
00674
00675
00676
00677 int flag_syntax_only = 0;
00678
00679
00680
00681 static int flag_gcse;
00682
00683
00684
00685 static int flag_loop_optimize;
00686
00687
00688
00689 static int flag_crossjumping;
00690
00691
00692
00693 static int flag_if_conversion;
00694
00695
00696
00697 static int flag_if_conversion2;
00698
00699
00700
00701
00702 static int flag_delete_null_pointer_checks;
00703
00704
00705
00706
00707
00708 int flag_gcse_lm = 1;
00709
00710
00711
00712
00713
00714 int flag_gcse_sm = 1;
00715
00716
00717
00718
00719 static int flag_rerun_cse_after_loop;
00720
00721
00722
00723 int flag_rerun_loop_opt;
00724
00725
00726
00727
00728 int flag_inline_functions;
00729
00730
00731
00732
00733
00734 int flag_keep_inline_functions;
00735
00736
00737
00738 #ifdef KEY
00739 int flag_no_inline = 1;
00740 #else
00741 int flag_no_inline = 2;
00742 #endif // KEY
00743
00744
00745
00746
00747 int flag_really_no_inline = 2;
00748
00749 #ifdef KEY
00750
00751 int flag_openmp = 0;
00752 #endif // KEY
00753
00754
00755
00756
00757 int flag_keep_static_consts = 1;
00758
00759
00760
00761 int flag_gen_aux_info = 0;
00762
00763
00764
00765 static char *aux_info_file_name;
00766
00767
00768
00769 int flag_shared_data;
00770
00771
00772
00773 int flag_delayed_branch;
00774
00775
00776
00777
00778
00779 int flag_pic;
00780
00781
00782
00783
00784
00785 int flag_pie;
00786
00787
00788
00789
00790 int flag_shlib;
00791
00792
00793
00794 enum tls_model flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
00795
00796
00797
00798
00799 int flag_exceptions;
00800
00801 #ifdef KEY
00802 int key_exceptions;
00803 int opt_regions;
00804 #endif // KEY
00805
00806
00807
00808 int flag_unwind_tables = 0;
00809
00810
00811
00812 int flag_asynchronous_unwind_tables = 0;
00813
00814
00815
00816
00817 int flag_no_common;
00818
00819
00820
00821
00822 int flag_pedantic_errors = 0;
00823
00824
00825
00826
00827
00828
00829 int flag_schedule_insns = 0;
00830 int flag_schedule_insns_after_reload = 0;
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842 int flag_schedule_interblock = 1;
00843 int flag_schedule_speculative = 1;
00844 int flag_schedule_speculative_load = 0;
00845 int flag_schedule_speculative_load_dangerous = 0;
00846
00847 int flag_single_precision_constant;
00848
00849
00850
00851 int flag_branch_on_count_reg = 1;
00852
00853
00854
00855
00856
00857 int flag_inhibit_size_directive = 0;
00858
00859
00860
00861
00862
00863
00864
00865
00866 int flag_verbose_asm = 0;
00867
00868
00869
00870
00871
00872
00873
00874
00875 int flag_debug_asm = 0;
00876
00877 #ifdef SGI_MONGOOSE
00878
00879
00880
00881
00882
00883 int flag_bad_asm_constraint_kills_stmt = 0;
00884
00885 #endif
00886
00887
00888
00889 int flag_dump_rtl_in_asm = 0;
00890
00891
00892
00893
00894 #ifdef USE_COLLECT2
00895 int flag_gnu_linker = 0;
00896 #else
00897 int flag_gnu_linker = 1;
00898 #endif
00899
00900
00901 int flag_zero_initialized_in_bss = 1;
00902
00903
00904 int flag_ssa = 0;
00905
00906
00907 int flag_ssa_ccp = 0;
00908
00909
00910 int flag_ssa_dce = 0;
00911
00912
00913 int flag_pack_struct = 0;
00914
00915
00916
00917 int flag_stack_check;
00918
00919
00920
00921
00922
00923
00924
00925
00926 rtx stack_limit_rtx;
00927
00928
00929
00930
00931
00932
00933
00934 int flag_argument_noalias = 0;
00935
00936
00937
00938
00939
00940 int flag_strict_aliasing = 0;
00941
00942
00943 int flag_instrument_function_entry_exit = 0;
00944
00945
00946
00947
00948
00949 int flag_no_ident = 0;
00950
00951
00952 int flag_peephole2 = 0;
00953
00954
00955 int flag_guess_branch_prob = 0;
00956
00957
00958
00959
00960
00961 int flag_bounds_check = 0;
00962
00963
00964
00965
00966 int flag_merge_constants = 1;
00967
00968
00969
00970
00971 int flag_renumber_insns = 1;
00972
00973
00974 int flag_new_regalloc = 0;
00975
00976 #ifdef KEY
00977
00978
00979 int flag_honor_shift = 1;
00980 #endif
00981
00982
00983
00984 int flag_tracer = 0;
00985
00986
00987
00988
00989
00990
00991 int align_loops;
00992 int align_loops_log;
00993 int align_loops_max_skip;
00994 int align_jumps;
00995 int align_jumps_log;
00996 int align_jumps_max_skip;
00997 int align_labels;
00998 int align_labels_log;
00999 int align_labels_max_skip;
01000 int align_functions;
01001 int align_functions_log;
01002
01003
01004
01005 int force_align_functions_log;
01006
01007
01008 static const struct
01009 {
01010 const char *const arg;
01011
01012
01013 const enum debug_info_type debug_type;
01014 const int use_extensions_p;
01015 const char *const description;
01016 } *da,
01017 debug_args[] =
01018 {
01019 { "", NO_DEBUG, DEFAULT_GDB_EXTENSIONS,
01020 N_("Generate debugging info in default format") },
01021 { "gdb", NO_DEBUG, 1, N_("Generate debugging info in default extended format") },
01022 #ifdef DBX_DEBUGGING_INFO
01023 { "stabs", DBX_DEBUG, 0, N_("Generate STABS format debug info") },
01024 { "stabs+", DBX_DEBUG, 1, N_("Generate extended STABS format debug info") },
01025 #endif
01026 #ifdef DWARF_DEBUGGING_INFO
01027 { "dwarf", DWARF_DEBUG, 0, N_("Generate DWARF-1 format debug info") },
01028 { "dwarf+", DWARF_DEBUG, 1,
01029 N_("Generate extended DWARF-1 format debug info") },
01030 #endif
01031 #ifdef DWARF2_DEBUGGING_INFO
01032 { "dwarf-2", DWARF2_DEBUG, 0, N_("Generate DWARF-2 debug info") },
01033 #endif
01034 #ifdef XCOFF_DEBUGGING_INFO
01035 { "xcoff", XCOFF_DEBUG, 0, N_("Generate XCOFF format debug info") },
01036 { "xcoff+", XCOFF_DEBUG, 1, N_("Generate extended XCOFF format debug info") },
01037 #endif
01038 #ifdef SDB_DEBUGGING_INFO
01039 { "coff", SDB_DEBUG, 0, N_("Generate COFF format debug info") },
01040 #endif
01041 #ifdef VMS_DEBUGGING_INFO
01042 { "vms", VMS_DEBUG, 0, N_("Generate VMS format debug info") },
01043 #endif
01044 { 0, 0, 0, 0 }
01045 };
01046
01047 typedef struct
01048 {
01049 const char *const string;
01050 int *const variable;
01051 const int on_value;
01052 const char *const description;
01053 }
01054 lang_independent_options;
01055
01056 int flag_trapv = 0;
01057
01058
01059 int flag_leading_underscore = -1;
01060
01061
01062 const char *user_label_prefix;
01063
01064 static const param_info lang_independent_params[] = {
01065 #define DEFPARAM(ENUM, OPTION, HELP, DEFAULT) \
01066 { OPTION, DEFAULT, HELP },
01067 #include "params.def"
01068 #undef DEFPARAM
01069 { NULL, 0, NULL }
01070 };
01071
01072
01073
01074
01075
01076
01077
01078 static const lang_independent_options f_options[] =
01079 {
01080 {"eliminate-dwarf2-dups", &flag_eliminate_dwarf2_dups, 1,
01081 N_("Perform DWARF2 duplicate elimination") },
01082 {"float-store", &flag_float_store, 1,
01083 N_("Do not store floats in registers") },
01084 {"volatile", &flag_volatile, 1,
01085 N_("Consider all mem refs through pointers as volatile") },
01086 {"volatile-global", &flag_volatile_global, 1,
01087 N_("Consider all mem refs to global data to be volatile") },
01088 {"volatile-static", &flag_volatile_static, 1,
01089 N_("Consider all mem refs to static data to be volatile") },
01090 {"defer-pop", &flag_defer_pop, 1,
01091 N_("Defer popping functions args from stack until later") },
01092 {"omit-frame-pointer", &flag_omit_frame_pointer, 1,
01093 N_("When possible do not generate stack frames") },
01094 {"optimize-sibling-calls", &flag_optimize_sibling_calls, 1,
01095 N_("Optimize sibling and tail recursive calls") },
01096 {"tracer", &flag_tracer, 1,
01097 N_("Perform superblock formation via tail duplication") },
01098 {"cse-follow-jumps", &flag_cse_follow_jumps, 1,
01099 N_("When running CSE, follow jumps to their targets") },
01100 {"cse-skip-blocks", &flag_cse_skip_blocks, 1,
01101 N_("When running CSE, follow conditional jumps") },
01102 {"expensive-optimizations", &flag_expensive_optimizations, 1,
01103 N_("Perform a number of minor, expensive optimizations") },
01104 {"thread-jumps", &flag_thread_jumps, 1,
01105 N_("Perform jump threading optimizations") },
01106 {"strength-reduce", &flag_strength_reduce, 1,
01107 N_("Perform strength reduction optimizations") },
01108 {"unroll-loops", &flag_unroll_loops, 1,
01109 N_("Perform loop unrolling when iteration count is known") },
01110 {"unroll-all-loops", &flag_unroll_all_loops, 1,
01111 N_("Perform loop unrolling for all loops") },
01112 {"prefetch-loop-arrays", &flag_prefetch_loop_arrays, 1,
01113 N_("Generate prefetch instructions, if available, for arrays in loops") },
01114 {"move-all-movables", &flag_move_all_movables, 1,
01115 N_("Force all loop invariant computations out of loops") },
01116 {"reduce-all-givs", &flag_reduce_all_givs, 1,
01117 N_("Strength reduce all loop general induction variables") },
01118 {"writable-strings", &flag_writable_strings, 1,
01119 N_("Store strings in writable data section") },
01120 {"peephole", &flag_no_peephole, 0,
01121 N_("Enable machine specific peephole optimizations") },
01122 {"force-mem", &flag_force_mem, 1,
01123 N_("Copy memory operands into registers before using") },
01124 {"force-addr", &flag_force_addr, 1,
01125 N_("Copy memory address constants into regs before using") },
01126 {"function-cse", &flag_no_function_cse, 0,
01127 N_("Allow function addresses to be held in registers") },
01128 {"inline-functions", &flag_inline_functions, 1,
01129 N_("Integrate simple functions into their callers") },
01130 {"keep-inline-functions", &flag_keep_inline_functions, 1,
01131 N_("Generate code for funcs even if they are fully inlined") },
01132 {"inline", &flag_no_inline, 0,
01133 N_("Pay attention to the 'inline' keyword") },
01134 {"keep-static-consts", &flag_keep_static_consts, 1,
01135 N_("Emit static const variables even if they are not used") },
01136 {"syntax-only", &flag_syntax_only, 1,
01137 N_("Check for syntax errors, then stop") },
01138 {"shared-data", &flag_shared_data, 1,
01139 N_("Mark data as shared rather than private") },
01140 {"caller-saves", &flag_caller_saves, 1,
01141 N_("Enable saving registers around function calls") },
01142 {"pcc-struct-return", &flag_pcc_struct_return, 1,
01143 N_("Return 'short' aggregates in memory, not registers") },
01144 {"reg-struct-return", &flag_pcc_struct_return, 0,
01145 N_("Return 'short' aggregates in registers") },
01146 {"delayed-branch", &flag_delayed_branch, 1,
01147 N_("Attempt to fill delay slots of branch instructions") },
01148 {"gcse", &flag_gcse, 1,
01149 N_("Perform the global common subexpression elimination") },
01150 {"gcse-lm", &flag_gcse_lm, 1,
01151 N_("Perform enhanced load motion during global subexpression elimination") },
01152 {"gcse-sm", &flag_gcse_sm, 1,
01153 N_("Perform store motion after global subexpression elimination") },
01154 {"loop-optimize", &flag_loop_optimize, 1,
01155 N_("Perform the loop optimizations") },
01156 {"crossjumping", &flag_crossjumping, 1,
01157 N_("Perform cross-jumping optimization") },
01158 {"if-conversion", &flag_if_conversion, 1,
01159 N_("Perform conversion of conditional jumps to branchless equivalents") },
01160 {"if-conversion2", &flag_if_conversion2, 1,
01161 N_("Perform conversion of conditional jumps to conditional execution") },
01162 {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1,
01163 N_("Run CSE pass after loop optimizations") },
01164 {"rerun-loop-opt", &flag_rerun_loop_opt, 1,
01165 N_("Run the loop optimizer twice") },
01166 {"delete-null-pointer-checks", &flag_delete_null_pointer_checks, 1,
01167 N_("Delete useless null pointer checks") },
01168 {"schedule-insns", &flag_schedule_insns, 1,
01169 N_("Reschedule instructions before register allocation") },
01170 {"schedule-insns2", &flag_schedule_insns_after_reload, 1,
01171 N_("Reschedule instructions after register allocation") },
01172 {"sched-interblock",&flag_schedule_interblock, 1,
01173 N_("Enable scheduling across basic blocks") },
01174 {"sched-spec",&flag_schedule_speculative, 1,
01175 N_("Allow speculative motion of non-loads") },
01176 {"sched-spec-load",&flag_schedule_speculative_load, 1,
01177 N_("Allow speculative motion of some loads") },
01178 {"sched-spec-load-dangerous",&flag_schedule_speculative_load_dangerous, 1,
01179 N_("Allow speculative motion of more loads") },
01180 {"branch-count-reg",&flag_branch_on_count_reg, 1,
01181 N_("Replace add,compare,branch with branch on count reg") },
01182 {"pic", &flag_pic, 1,
01183 N_("Generate position independent code, if possible") },
01184 {"PIC", &flag_pic, 2, ""},
01185 {"pie", &flag_pie, 1,
01186 N_("Generate position independent code for executables, if possible") },
01187 {"PIE", &flag_pie, 2, ""},
01188 #ifndef KEY
01189 {"exceptions", &flag_exceptions, 1,
01190 N_("Enable exception handling") },
01191 #else
01192 {"exceptions", &key_exceptions, 1,
01193 N_("Enable exception handling") },
01194 {"optimize-regions", &opt_regions, 1,
01195 N_("Optimize EH region formation") },
01196 #endif
01197 {"unwind-tables", &flag_unwind_tables, 1,
01198 N_("Just generate unwind tables for exception handling") },
01199 {"asynchronous-unwind-tables", &flag_asynchronous_unwind_tables, 1,
01200 N_("Generate unwind tables exact at each instruction boundary") },
01201 {"non-call-exceptions", &flag_non_call_exceptions, 1,
01202 N_("Support synchronous non-call exceptions") },
01203 {"profile-arcs", &profile_arc_flag, 1,
01204 N_("Insert arc based program profiling code") },
01205 {"test-coverage", &flag_test_coverage, 1,
01206 N_("Create data files needed by gcov") },
01207 {"branch-probabilities", &flag_branch_probabilities, 1,
01208 N_("Use profiling information for branch probabilities") },
01209 {"profile", &profile_flag, 1,
01210 N_("Enable basic program profiling code") },
01211 {"reorder-blocks", &flag_reorder_blocks, 1,
01212 N_("Reorder basic blocks to improve code placement") },
01213 {"reorder-functions", &flag_reorder_functions, 1,
01214 N_("Reorder functions to improve code placement") },
01215 {"rename-registers", &flag_rename_registers, 1,
01216 N_("Do the register renaming optimization pass") },
01217 {"cprop-registers", &flag_cprop_registers, 1,
01218 N_("Do the register copy-propagation optimization pass") },
01219 {"common", &flag_no_common, 0,
01220 N_("Do not put uninitialized globals in the common section") },
01221 {"inhibit-size-directive", &flag_inhibit_size_directive, 1,
01222 N_("Do not generate .size directives") },
01223 {"function-sections", &flag_function_sections, 1,
01224 N_("place each function into its own section") },
01225 {"data-sections", &flag_data_sections, 1,
01226 N_("place data items into their own section") },
01227 {"verbose-asm", &flag_verbose_asm, 1,
01228 N_("Add extra commentary to assembler output") },
01229 {"gnu-linker", &flag_gnu_linker, 1,
01230 N_("Output GNU ld formatted global initializers") },
01231 {"regmove", &flag_regmove, 1,
01232 N_("Enables a register move optimization") },
01233 {"optimize-register-move", &flag_regmove, 1,
01234 N_("Do the full regmove optimization pass") },
01235 {"pack-struct", &flag_pack_struct, 1,
01236 N_("Pack structure members together without holes") },
01237 {"stack-check", &flag_stack_check, 1,
01238 N_("Insert stack checking code into the program") },
01239 {"argument-alias", &flag_argument_noalias, 0,
01240 N_("Specify that arguments may alias each other & globals") },
01241 {"argument-noalias", &flag_argument_noalias, 1,
01242 N_("Assume arguments may alias globals but not each other") },
01243 {"argument-noalias-global", &flag_argument_noalias, 2,
01244 N_("Assume arguments do not alias each other or globals") },
01245 {"strict-aliasing", &flag_strict_aliasing, 1,
01246 N_("Assume strict aliasing rules apply") },
01247 {"align-loops", &align_loops, 0,
01248 N_("Align the start of loops") },
01249 {"align-jumps", &align_jumps, 0,
01250 N_("Align labels which are only reached by jumping") },
01251 {"align-labels", &align_labels, 0,
01252 N_("Align all labels") },
01253 {"align-functions", &align_functions, 0,
01254 N_("Align the start of functions") },
01255 {"merge-constants", &flag_merge_constants, 1,
01256 N_("Attempt to merge identical constants across compilation units") },
01257 {"merge-all-constants", &flag_merge_constants, 2,
01258 N_("Attempt to merge identical constants and constant variables") },
01259 {"dump-unnumbered", &flag_dump_unnumbered, 1,
01260 N_("Suppress output of instruction numbers and line number notes in debugging dumps") },
01261 {"instrument-functions", &flag_instrument_function_entry_exit, 1,
01262 N_("Instrument function entry/exit with profiling calls") },
01263 {"zero-initialized-in-bss", &flag_zero_initialized_in_bss, 1,
01264 N_("Put zero initialized data in the bss section") },
01265 {"ssa", &flag_ssa, 1,
01266 N_("Enable SSA optimizations") },
01267 {"ssa-ccp", &flag_ssa_ccp, 1,
01268 N_("Enable SSA conditional constant propagation") },
01269 {"ssa-dce", &flag_ssa_dce, 1,
01270 N_("Enable aggressive SSA dead code elimination") },
01271 {"leading-underscore", &flag_leading_underscore, 1,
01272 N_("External symbols have a leading underscore") },
01273 {"ident", &flag_no_ident, 0,
01274 N_("Process #ident directives") },
01275 { "peephole2", &flag_peephole2, 1,
01276 N_("Enables an rtl peephole pass run before sched2") },
01277 {"finite-math-only", &flag_finite_math_only, 1,
01278 N_("Assume no NaNs or +-Infs are generated") },
01279 { "guess-branch-probability", &flag_guess_branch_prob, 1,
01280 N_("Enables guessing of branch probabilities") },
01281 {"math-errno", &flag_errno_math, 1,
01282 N_("Set errno after built-in math functions") },
01283 {"trapping-math", &flag_trapping_math, 1,
01284 N_("Floating-point operations can trap") },
01285 {"unsafe-math-optimizations", &flag_unsafe_math_optimizations, 1,
01286 N_("Allow math optimizations that may violate IEEE or ANSI standards") },
01287 {"signaling-nans", &flag_signaling_nans, 1,
01288 N_("Disable optimizations observable by IEEE signaling NaNs") },
01289 {"bounds-check", &flag_bounds_check, 1,
01290 N_("Generate code to check bounds before indexing arrays") },
01291 {"single-precision-constant", &flag_single_precision_constant, 1,
01292 N_("Convert floating point constant to single precision constant") },
01293 {"time-report", &time_report, 1,
01294 N_("Report time taken by each compiler pass at end of run") },
01295 {"mem-report", &mem_report, 1,
01296 N_("Report on permanent memory allocation at end of run") },
01297 { "trapv", &flag_trapv, 1,
01298 N_("Trap for signed overflow in addition / subtraction / multiplication") },
01299 { "new-ra", &flag_new_regalloc, 1,
01300 N_("Use graph coloring register allocation.") },
01301 #ifdef KEY
01302
01303 { "honor-shift", &flag_honor_shift, 1,
01304 N_("Retain shift operation as specified by the user.") },
01305 #endif
01306 };
01307
01308
01309
01310 static const struct lang_opt
01311 {
01312 const char *const option;
01313 const char *const description;
01314 }
01315 documented_lang_options[] =
01316 {
01317
01318
01319
01320
01321 { "-ansi",
01322 N_("Compile just for ISO C90") },
01323 { "-std= ",
01324 N_("Determine language standard") },
01325
01326 { "-fsigned-bitfields", "" },
01327 { "-funsigned-bitfields",
01328 N_("Make bit-fields by unsigned by default") },
01329 { "-fno-signed-bitfields", "" },
01330 { "-fno-unsigned-bitfields","" },
01331 { "-fsigned-char",
01332 N_("Make 'char' be signed by default") },
01333 { "-funsigned-char",
01334 N_("Make 'char' be unsigned by default") },
01335 { "-fno-signed-char", "" },
01336 { "-fno-unsigned-char", "" },
01337
01338 { "-fasm", "" },
01339 { "-fno-asm",
01340 N_("Do not recognize the 'asm' keyword") },
01341 { "-fbuiltin", "" },
01342 { "-fno-builtin",
01343 N_("Do not recognize any built in functions") },
01344 { "-fhosted",
01345 N_("Assume normal C execution environment") },
01346 { "-fno-hosted", "" },
01347 { "-ffreestanding",
01348 N_("Assume that standard libraries & main might not exist") },
01349 { "-fno-freestanding", "" },
01350 { "-fcond-mismatch",
01351 N_("Allow different types as args of ? operator") },
01352 { "-fno-cond-mismatch", "" },
01353 { "-fdollars-in-identifiers",
01354 N_("Allow the use of $ inside identifiers") },
01355 { "-fno-dollars-in-identifiers", "" },
01356 { "-fpreprocessed", "" },
01357 { "-fno-preprocessed", "" },
01358 { "-fshort-double",
01359 N_("Use the same size for double as for float") },
01360 { "-fno-short-double", "" },
01361 { "-fshort-enums",
01362 N_("Use the smallest fitting integer to hold enums") },
01363 { "-fno-short-enums", "" },
01364 { "-fshort-wchar",
01365 N_("Override the underlying type for wchar_t to `unsigned short'") },
01366 { "-fno-short-wchar", "" },
01367
01368 #ifdef TARG_SL
01369 {"-mlong-long",
01370 N_("Long long supported") },
01371 {"-msoft-float",
01372 N_("Float point emulation supported") },
01373 #endif
01374
01375 { "-Wall",
01376 N_("Enable most warning messages") },
01377 { "-Wbad-function-cast",
01378 N_("Warn about casting functions to incompatible types") },
01379 { "-Wno-bad-function-cast", "" },
01380 { "-Wmissing-format-attribute",
01381 N_("Warn about functions which might be candidates for format attributes") },
01382 { "-Wno-missing-format-attribute", "" },
01383 { "-Wcast-qual",
01384 N_("Warn about casts which discard qualifiers") },
01385 { "-Wno-cast-qual", "" },
01386 { "-Wchar-subscripts",
01387 N_("Warn about subscripts whose type is 'char'") },
01388 { "-Wno-char-subscripts", "" },
01389 { "-Wcomment",
01390 N_("Warn if nested comments are detected") },
01391 { "-Wno-comment", "" },
01392 { "-Wcomments",
01393 N_("Warn if nested comments are detected") },
01394 { "-Wno-comments", "" },
01395 { "-Wconversion",
01396 N_("Warn about possibly confusing type conversions") },
01397 { "-Wno-conversion", "" },
01398 { "-Wdeclaration-after-statement",
01399 N_("Warn when a declaration is found after a statement") },
01400 { "-Wno-declaration-after-statement", "" },
01401 { "-Wdiv-by-zero", "" },
01402 { "-Wno-div-by-zero",
01403 N_("Do not warn about compile-time integer division by zero") },
01404 { "-Wfloat-equal",
01405 N_("Warn about testing equality of floating point numbers") },
01406 { "-Wno-float-equal", "" },
01407 { "-Wformat",
01408 N_("Warn about printf/scanf/strftime/strfmon format anomalies") },
01409 { "-Wno-format", "" },
01410 { "-Wformat-extra-args", "" },
01411 { "-Wno-format-extra-args",
01412 N_("Don't warn about too many arguments to format functions") },
01413 { "-Wformat-nonliteral",
01414 N_("Warn about non-string-literal format strings") },
01415 { "-Wno-format-nonliteral", "" },
01416 { "-Wformat-security",
01417 N_("Warn about possible security problems with format functions") },
01418 { "-Wno-format-security", "" },
01419 { "-Wformat-y2k", "" },
01420 { "-Wno-format-y2k",
01421 N_("Don't warn about strftime formats yielding 2 digit years") },
01422 { "-Wimplicit-function-declaration",
01423 N_("Warn about implicit function declarations") },
01424 { "-Wno-implicit-function-declaration", "" },
01425 { "-Werror-implicit-function-declaration", "" },
01426 { "-Wimplicit-int",
01427 N_("Warn when a declaration does not specify a type") },
01428 { "-Wno-implicit-int", "" },
01429 { "-Wimplicit", "" },
01430 { "-Wno-implicit", "" },
01431 { "-Wimport",
01432 N_("Warn about the use of the #import directive") },
01433 { "-Wno-import", "" },
01434 { "-Wlong-long","" },
01435 { "-Wno-long-long",
01436 N_("Do not warn about using 'long long' when -pedantic") },
01437 { "-Wmain",
01438 N_("Warn about suspicious declarations of main") },
01439 { "-Wno-main", "" },
01440 { "-Wmissing-braces",
01441 N_("Warn about possibly missing braces around initializers") },
01442 { "-Wno-missing-braces", "" },
01443 { "-Wmissing-declarations",
01444 N_("Warn about global funcs without previous declarations") },
01445 { "-Wno-missing-declarations", "" },
01446 { "-Wmissing-prototypes",
01447 N_("Warn about global funcs without prototypes") },
01448 { "-Wno-missing-prototypes", "" },
01449 { "-Wmultichar",
01450 N_("Warn about use of multicharacter literals") },
01451 { "-Wno-multichar", "" },
01452 { "-Wnested-externs",
01453 N_("Warn about externs not at file scope level") },
01454 { "-Wno-nested-externs", "" },
01455 { "-Wparentheses",
01456 N_("Warn about possible missing parentheses") },
01457 { "-Wno-parentheses", "" },
01458 { "-Wpointer-arith",
01459 N_("Warn about function pointer arithmetic") },
01460 { "-Wno-pointer-arith", "" },
01461 { "-Wredundant-decls",
01462 N_("Warn about multiple declarations of the same object") },
01463 { "-Wno-redundant-decls", "" },
01464 { "-Wreturn-type",
01465 N_("Warn whenever a function's return-type defaults to int") },
01466 { "-Wno-return-type", "" },
01467 { "-Wsequence-point",
01468 N_("Warn about possible violations of sequence point rules") },
01469 { "-Wno-sequence-point", "" },
01470 { "-Wsign-compare",
01471 N_("Warn about signed/unsigned comparisons") },
01472 { "-Wno-sign-compare", "" },
01473 { "-Wstrict-prototypes",
01474 N_("Warn about non-prototyped function decls") },
01475 { "-Wno-strict-prototypes", "" },
01476 { "-Wtraditional",
01477 N_("Warn about constructs whose meanings change in ISO C") },
01478 { "-Wno-traditional", "" },
01479 { "-Wtrigraphs",
01480 N_("Warn when trigraphs are encountered") },
01481 { "-Wno-trigraphs", "" },
01482 { "-Wundef", "" },
01483 { "-Wno-undef", "" },
01484 { "-Wunknown-pragmas",
01485 N_("Warn about unrecognized pragmas") },
01486 { "-Wno-unknown-pragmas", "" },
01487 { "-Wwrite-strings",
01488 N_("Mark strings as 'const char *'") },
01489 { "-Wno-write-strings", "" },
01490
01491 #define DEFINE_LANG_NAME(NAME) { NULL, NAME },
01492
01493 #include "options.h"
01494
01495 };
01496
01497
01498
01499
01500
01501
01502
01503 static const struct
01504 {
01505 const char *const name;
01506 const int value;
01507 const char *const description;
01508 }
01509 target_switches[] = TARGET_SWITCHES;
01510
01511
01512
01513 #ifdef TARGET_OPTIONS
01514 static const struct
01515 {
01516 const char *const prefix;
01517 const char **const variable;
01518 const char *const description;
01519 }
01520 target_options[] = TARGET_OPTIONS;
01521 #endif
01522
01523
01524
01525
01526
01527 int inhibit_warnings = 0;
01528
01529
01530
01531 int warn_system_headers = 0;
01532
01533
01534
01535 int extra_warnings = 0;
01536
01537
01538
01539 int warnings_are_errors = 0;
01540
01541
01542
01543 int warn_unused_function;
01544 int warn_unused_label;
01545 int warn_unused_parameter;
01546 int warn_unused_variable;
01547 int warn_unused_value;
01548
01549
01550
01551 int warn_notreached;
01552
01553
01554
01555 int warn_uninitialized;
01556
01557
01558
01559 int warn_shadow;
01560
01561
01562
01563
01564 int warn_switch;
01565
01566
01567
01568 int warn_switch_default;
01569
01570
01571
01572
01573 int warn_switch_enum;
01574
01575
01576
01577
01578 int warn_return_type;
01579
01580
01581
01582
01583
01584 int warn_cast_align;
01585
01586
01587
01588
01589
01590 int warn_larger_than;
01591 HOST_WIDE_INT larger_than_size;
01592
01593
01594
01595 int warn_inline;
01596
01597
01598
01599
01600 int warn_aggregate_return;
01601
01602
01603
01604 int warn_packed;
01605
01606
01607
01608 int warn_padded;
01609
01610
01611
01612 int warn_disabled_optimization;
01613
01614
01615
01616 int warn_missing_noreturn;
01617
01618
01619
01620
01621 int warn_deprecated_decl = 1;
01622
01623
01624
01625
01626 int warn_strict_aliasing;
01627
01628
01629
01630 static const lang_independent_options W_options[] =
01631 {
01632 {"unused-function", &warn_unused_function, 1,
01633 N_("Warn when a function is unused") },
01634 {"unused-label", &warn_unused_label, 1,
01635 N_("Warn when a label is unused") },
01636 {"unused-parameter", &warn_unused_parameter, 1,
01637 N_("Warn when a function parameter is unused") },
01638 {"unused-variable", &warn_unused_variable, 1,
01639 N_("Warn when a variable is unused") },
01640 {"unused-value", &warn_unused_value, 1,
01641 N_("Warn when an expression value is unused") },
01642 {"system-headers", &warn_system_headers, 1,
01643 N_("Do not suppress warnings from system headers") },
01644 {"error", &warnings_are_errors, 1,
01645 N_("Treat all warnings as errors") },
01646 {"shadow", &warn_shadow, 1,
01647 N_("Warn when one local variable shadows another") },
01648 {"switch", &warn_switch, 1,
01649 N_("Warn about enumerated switches, with no default, missing a case") },
01650 {"switch-default", &warn_switch_default, 1,
01651 N_("Warn about enumerated switches missing a default case") },
01652 {"switch-enum", &warn_switch_enum, 1,
01653 N_("Warn about all enumerated switches missing a specific case") },
01654 {"aggregate-return", &warn_aggregate_return, 1,
01655 N_("Warn about returning structures, unions or arrays") },
01656 {"cast-align", &warn_cast_align, 1,
01657 N_("Warn about pointer casts which increase alignment") },
01658 {"unreachable-code", &warn_notreached, 1,
01659 N_("Warn about code that will never be executed") },
01660 {"uninitialized", &warn_uninitialized, 1,
01661 N_("Warn about uninitialized automatic variables") },
01662 {"inline", &warn_inline, 1,
01663 N_("Warn when an inlined function cannot be inlined") },
01664 {"packed", &warn_packed, 1,
01665 N_("Warn when the packed attribute has no effect on struct layout") },
01666 {"padded", &warn_padded, 1,
01667 N_("Warn when padding is required to align struct members") },
01668 {"disabled-optimization", &warn_disabled_optimization, 1,
01669 N_("Warn when an optimization pass is disabled") },
01670 {"deprecated-declarations", &warn_deprecated_decl, 1,
01671 N_("Warn about uses of __attribute__((deprecated)) declarations") },
01672 {"missing-noreturn", &warn_missing_noreturn, 1,
01673 N_("Warn about functions which might be candidates for attribute noreturn") },
01674 {"strict-aliasing", &warn_strict_aliasing, 1,
01675 N_ ("Warn about code which might break the strict aliasing rules") }
01676 };
01677
01678 void
01679 set_Wunused (setting)
01680 int setting;
01681 {
01682 warn_unused_function = setting;
01683 warn_unused_label = setting;
01684
01685
01686
01687 if (!setting)
01688 warn_unused_parameter = 0;
01689 else if (!warn_unused_parameter)
01690 warn_unused_parameter = -1;
01691 warn_unused_variable = setting;
01692 warn_unused_value = setting;
01693 }
01694
01695
01696
01697
01698 void
01699 set_fast_math_flags (set)
01700 int set;
01701 {
01702 flag_trapping_math = !set;
01703 flag_unsafe_math_optimizations = set;
01704 flag_finite_math_only = set;
01705 flag_errno_math = !set;
01706 if (set)
01707 flag_signaling_nans = 0;
01708 }
01709
01710
01711 bool
01712 fast_math_flags_set_p ()
01713 {
01714 return (!flag_trapping_math
01715 && flag_unsafe_math_optimizations
01716 && flag_finite_math_only
01717 && !flag_errno_math);
01718 }
01719
01720
01721
01722
01723
01724 FILE *asm_out_file;
01725 FILE *aux_info_file;
01726 FILE *rtl_dump_file = NULL;
01727
01728 #ifdef SGI_MONGOOSE
01729 FILE *tree_dump_file = NULL;
01730 #endif
01731
01732
01733
01734
01735
01736
01737 int
01738 read_integral_parameter (p, pname, defval)
01739 const char *p;
01740 const char *pname;
01741 const int defval;
01742 {
01743 const char *endp = p;
01744
01745 while (*endp)
01746 {
01747 if (ISDIGIT (*endp))
01748 endp++;
01749 else
01750 break;
01751 }
01752
01753 if (*endp != 0)
01754 {
01755 if (pname != 0)
01756 error ("invalid option `%s'", pname);
01757 return defval;
01758 }
01759
01760 return atoi (p);
01761 }
01762
01763
01764 #ifdef SGI_MONGOOSE
01765 void
01766 dump_parse_tree (char *msg, tree node)
01767 {
01768 if (parse_tree_dump) {
01769 #ifdef KEY
01770 fprintf (rtl_dump_file, "%s:\n", msg);
01771 print_tree (rtl_dump_file, node);
01772 #else
01773 fprintf (tree_dump_file, "%s:\n", msg);
01774 print_tree (tree_dump_file, node);
01775 #endif
01776 }
01777 }
01778 #endif
01779
01780
01781
01782
01783 void
01784 do_abort ()
01785 {
01786 abort ();
01787 }
01788
01789
01790
01791
01792 void
01793 botch (s)
01794 const char *s ATTRIBUTE_UNUSED;
01795 {
01796 abort ();
01797 }
01798
01799
01800
01801
01802
01803
01804 int
01805 exact_log2_wide (x)
01806 unsigned HOST_WIDE_INT x;
01807 {
01808 int log = 0;
01809
01810 if (x == 0 || x != (x & -x))
01811 return -1;
01812 while ((x >>= 1) != 0)
01813 log++;
01814 return log;
01815 }
01816
01817
01818
01819
01820
01821
01822 int
01823 floor_log2_wide (x)
01824 unsigned HOST_WIDE_INT x;
01825 {
01826 int log = -1;
01827 while (x != 0)
01828 log++,
01829 x >>= 1;
01830 return log;
01831 }
01832
01833
01834
01835
01836 static void
01837 crash_signal (signo)
01838 int signo;
01839 {
01840 internal_error ("%s", strsignal (signo));
01841 }
01842
01843
01844
01845
01846
01847
01848 void
01849 strip_off_ending (name, len)
01850 char *name;
01851 int len;
01852 {
01853 int i;
01854 for (i = 2; i < 6 && len > i; i++)
01855 {
01856 if (name[len - i] == '.')
01857 {
01858 name[len - i] = '\0';
01859 break;
01860 }
01861 }
01862 }
01863
01864
01865
01866 void
01867 output_quoted_string (asm_file, string)
01868 FILE *asm_file;
01869 const char *string;
01870 {
01871 #ifdef OUTPUT_QUOTED_STRING
01872 OUTPUT_QUOTED_STRING (asm_file, string);
01873 #else
01874 char c;
01875
01876 putc ('\"', asm_file);
01877 while ((c = *string++) != 0)
01878 {
01879 if (ISPRINT (c))
01880 {
01881 if (c == '\"' || c == '\\')
01882 putc ('\\', asm_file);
01883 putc (c, asm_file);
01884 }
01885 else
01886 fprintf (asm_file, "\\%03o", (unsigned char) c);
01887 }
01888 putc ('\"', asm_file);
01889 #endif
01890 }
01891
01892
01893
01894 void
01895 output_clean_symbol_name (file, name)
01896 FILE *file;
01897 const char *name;
01898 {
01899
01900 char *id = xstrdup (name);
01901
01902
01903 clean_symbol_name (id);
01904
01905 fputs (id, file);
01906 free (id);
01907 }
01908
01909
01910
01911
01912 void
01913 output_file_directive (asm_file, input_name)
01914 FILE *asm_file;
01915 const char *input_name;
01916 {
01917 int len = strlen (input_name);
01918 const char *na = input_name + len;
01919
01920
01921 while (na > input_name)
01922 {
01923 if (IS_DIR_SEPARATOR (na[-1]))
01924 break;
01925 na--;
01926 }
01927
01928 #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
01929 ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file, na);
01930 #else
01931 #ifdef ASM_OUTPUT_SOURCE_FILENAME
01932 ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
01933 #else
01934 fprintf (asm_file, "\t.file\t");
01935 output_quoted_string (asm_file, na);
01936 fputc ('\n', asm_file);
01937 #endif
01938 #endif
01939 }
01940
01941
01942
01943 static int
01944 open_dump_file (index, decl)
01945 enum dump_file_index index;
01946 tree decl;
01947 {
01948 char *dump_name;
01949 const char *open_arg;
01950 char seq[16];
01951
01952 if (! dump_file[index].enabled)
01953 return 0;
01954
01955 timevar_push (TV_DUMP);
01956 if (rtl_dump_file != NULL)
01957 fclose (rtl_dump_file);
01958
01959 sprintf (seq, DUMPFILE_FORMAT, index);
01960
01961 if (! dump_file[index].initialized)
01962 {
01963
01964 if (graph_dump_format != no_graph
01965 && dump_file[index].graph_dump_p)
01966 {
01967 dump_name = concat (seq, dump_file[index].extension, NULL);
01968 clean_graph_dump_file (dump_base_name, dump_name);
01969 free (dump_name);
01970 }
01971 dump_file[index].initialized = 1;
01972 open_arg = "w";
01973 }
01974 else
01975 open_arg = "a";
01976
01977 dump_name = concat (dump_base_name, seq,
01978 dump_file[index].extension, NULL);
01979
01980 rtl_dump_file = fopen (dump_name, open_arg);
01981 if (rtl_dump_file == NULL)
01982 fatal_io_error ("can't open %s", dump_name);
01983
01984 free (dump_name);
01985
01986 if (decl)
01987 fprintf (rtl_dump_file, "\n;; Function %s%s\n\n",
01988 (*lang_hooks.decl_printable_name) (decl, 2),
01989 cfun->function_frequency == FUNCTION_FREQUENCY_HOT
01990 ? " (hot)"
01991 : cfun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED
01992 ? " (unlikely executed)"
01993 : "");
01994
01995 timevar_pop (TV_DUMP);
01996 return 1;
01997 }
01998
01999
02000
02001 static void
02002 close_dump_file (index, func, insns)
02003 enum dump_file_index index;
02004 void (*func) PARAMS ((FILE *, rtx));
02005 rtx insns;
02006 {
02007 if (! rtl_dump_file)
02008 return;
02009
02010 timevar_push (TV_DUMP);
02011 if (insns
02012 && graph_dump_format != no_graph
02013 && dump_file[index].graph_dump_p)
02014 {
02015 char seq[16];
02016 char *suffix;
02017
02018 sprintf (seq, DUMPFILE_FORMAT, index);
02019 suffix = concat (seq, dump_file[index].extension, NULL);
02020 print_rtl_graph_with_bb (dump_base_name, suffix, insns);
02021 free (suffix);
02022 }
02023
02024 if (func && insns)
02025 func (rtl_dump_file, insns);
02026
02027 fflush (rtl_dump_file);
02028 fclose (rtl_dump_file);
02029
02030 rtl_dump_file = NULL;
02031 timevar_pop (TV_DUMP);
02032 }
02033
02034
02035
02036
02037
02038
02039 int
02040 wrapup_global_declarations (vec, len)
02041 tree *vec;
02042 int len;
02043 {
02044 tree decl;
02045 int i;
02046 int reconsider;
02047 int output_something = 0;
02048
02049 for (i = 0; i < len; i++)
02050 {
02051 decl = vec[i];
02052
02053
02054
02055 if (DECL_DEFER_OUTPUT (decl) != 0)
02056 DECL_DEFER_OUTPUT (decl) = 0;
02057
02058 if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0)
02059 (*lang_hooks.finish_incomplete_decl) (decl);
02060 }
02061
02062
02063
02064
02065 do
02066 {
02067 reconsider = 0;
02068 for (i = 0; i < len; i++)
02069 {
02070 decl = vec[i];
02071
02072 if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
02073 continue;
02074
02075
02076
02077
02078
02079
02080
02081
02082
02083
02084
02085
02086
02087
02088
02089
02090
02091
02092
02093
02094
02095
02096
02097
02098
02099
02100 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
02101 {
02102 bool needed = 1;
02103
02104 if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
02105 ;
02106 else if (DECL_COMDAT (decl))
02107 needed = 0;
02108 else if (TREE_READONLY (decl) && !TREE_PUBLIC (decl)
02109 && (optimize || !flag_keep_static_consts
02110 || DECL_ARTIFICIAL (decl)))
02111 needed = 0;
02112
02113 if (needed)
02114 {
02115 reconsider = 1;
02116 rest_of_decl_compilation (decl, NULL, 1, 1);
02117 }
02118 }
02119
02120 if (TREE_CODE (decl) == FUNCTION_DECL
02121 && DECL_INITIAL (decl) != 0
02122 && DECL_SAVED_INSNS (decl) != 0
02123 && (flag_keep_inline_functions
02124 || (TREE_PUBLIC (decl) && !DECL_COMDAT (decl))
02125 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
02126 {
02127 reconsider = 1;
02128 output_inline_function (decl);
02129 }
02130 }
02131
02132 if (reconsider)
02133 output_something = 1;
02134 }
02135 while (reconsider);
02136
02137 return output_something;
02138 }
02139
02140
02141
02142
02143 void
02144 check_global_declarations (vec, len)
02145 tree *vec;
02146 int len;
02147 {
02148 tree decl;
02149 int i;
02150
02151 for (i = 0; i < len; i++)
02152 {
02153 decl = vec[i];
02154
02155 if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
02156 && ! TREE_ASM_WRITTEN (decl))
02157
02158
02159
02160 SET_DECL_RTL (decl, NULL_RTX);
02161
02162
02163
02164
02165
02166
02167 if (TREE_CODE (decl) == FUNCTION_DECL
02168 && (warn_unused_function
02169 || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
02170 && DECL_INITIAL (decl) == 0
02171 && DECL_EXTERNAL (decl)
02172 && ! DECL_ARTIFICIAL (decl)
02173 && ! TREE_PUBLIC (decl))
02174 {
02175 if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
02176 pedwarn_with_decl (decl,
02177 "`%s' used but never defined");
02178 else
02179 warning_with_decl (decl,
02180 "`%s' declared `static' but never defined");
02181
02182 TREE_PUBLIC (decl) = 1;
02183 assemble_external (decl);
02184 }
02185
02186
02187 if (((warn_unused_function && TREE_CODE (decl) == FUNCTION_DECL)
02188
02189
02190 || (warn_unused_variable
02191 && TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl)))
02192 && ! DECL_IN_SYSTEM_HEADER (decl)
02193 && ! TREE_USED (decl)
02194
02195
02196 && ! TREE_USED (DECL_NAME (decl))
02197 && ! DECL_EXTERNAL (decl)
02198 && ! TREE_PUBLIC (decl)
02199
02200 && ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
02201
02202 && (*lang_hooks.decls.warn_unused_global) (decl))
02203 warning_with_decl (decl, "`%s' defined but not used");
02204
02205
02206
02207 if (errorcount == 0 && sorrycount == 0)
02208 {
02209 timevar_push (TV_SYMOUT);
02210 #ifndef SGI_MONGOOSE
02211 (*debug_hooks->global_decl) (decl);
02212 #endif
02213 timevar_pop (TV_SYMOUT);
02214 }
02215 }
02216 }
02217
02218
02219
02220
02221
02222 void
02223 push_srcloc (file, line)
02224 const char *file;
02225 int line;
02226 {
02227 struct file_stack *fs;
02228
02229 if (input_file_stack)
02230 {
02231 input_file_stack->name = input_filename;
02232 input_file_stack->line = lineno;
02233 }
02234
02235 fs = (struct file_stack *) xmalloc (sizeof (struct file_stack));
02236 fs->name = input_filename = file;
02237 fs->line = lineno = line;
02238 fs->next = input_file_stack;
02239 input_file_stack = fs;
02240 input_file_stack_tick++;
02241 }
02242
02243
02244
02245
02246
02247 void
02248 pop_srcloc ()
02249 {
02250 struct file_stack *fs;
02251
02252 fs = input_file_stack;
02253 input_file_stack = fs->next;
02254 free (fs);
02255 input_file_stack_tick++;
02256
02257 if (!input_file_stack)
02258 abort ();
02259 input_filename = input_file_stack->name;
02260 lineno = input_file_stack->line;
02261 }
02262
02263
02264
02265
02266 #ifndef SGI_MONGOOSE
02267 static void
02268 compile_file ()
02269 #else
02270 void
02271 compile_file (name)
02272 char *name;
02273 #endif
02274 {
02275
02276
02277 #ifdef KEY
02278 if (aux_base_name == 0)
02279 aux_base_name = name ? name : "gccaux";
02280 #endif // KEY
02281
02282 init_final (main_input_filename);
02283 init_branch_prob (aux_base_name);
02284
02285 timevar_push (TV_PARSE);
02286
02287
02288
02289 (*lang_hooks.parse_file) (set_yydebug);
02290
02291
02292
02293 (*lang_hooks.clear_binding_stack) ();
02294
02295 #ifdef SGI_MONGOOSE
02296 if (parse_tree_dump)
02297 {
02298 close_dump_file (DFI_sgi_parse_tree, NULL, NULL_RTX);
02299 }
02300 #endif
02301
02302
02303
02304 timevar_pop (TV_PARSE);
02305
02306 if (flag_syntax_only)
02307 return;
02308
02309 (*lang_hooks.decls.final_write_globals)();
02310
02311
02312
02313
02314
02315
02316
02317
02318 output_func_start_profiler ();
02319
02320
02321
02322 weak_finish ();
02323
02324 #ifndef KEY
02325
02326 timevar_push (TV_SYMOUT);
02327
02328 #ifdef DWARF2_UNWIND_INFO
02329 if (dwarf2out_do_frame ())
02330 dwarf2out_frame_finish ();
02331 #endif
02332
02333 (*debug_hooks->finish) (main_input_filename);
02334 timevar_pop (TV_SYMOUT);
02335 #endif
02336
02337
02338
02339 dw2_output_indirect_constants ();
02340
02341 end_final (aux_base_name);
02342
02343 if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
02344 {
02345 timevar_push (TV_DUMP);
02346 open_dump_file (DFI_bp, NULL);
02347
02348 end_branch_prob ();
02349
02350 close_dump_file (DFI_bp, NULL, NULL_RTX);
02351 timevar_pop (TV_DUMP);
02352 }
02353
02354 #ifndef SGI_MONGOOSE
02355 #ifdef ASM_FILE_END
02356 ASM_FILE_END (asm_out_file);
02357 #endif
02358 #endif
02359
02360
02361
02362
02363 #ifdef IDENT_ASM_OP
02364 if (!flag_no_ident)
02365 fprintf (asm_out_file, "%s\"GCC: (GNU) %s\"\n",
02366 IDENT_ASM_OP, version_string);
02367 #endif
02368
02369 if (optimize > 0 && open_dump_file (DFI_combine, NULL))
02370 {
02371 timevar_push (TV_DUMP);
02372 dump_combine_total_stats (rtl_dump_file);
02373 close_dump_file (DFI_combine, NULL, NULL_RTX);
02374 timevar_pop (TV_DUMP);
02375 }
02376
02377 #ifdef SGI_MONGOOSE
02378
02379
02380
02381
02382 finalize ();
02383
02384
02385 timevar_stop (TV_TOTAL);
02386 timevar_print (stderr);
02387 #endif
02388 }
02389
02390
02391
02392
02393
02394
02395
02396
02397
02398
02399
02400
02401
02402
02403 void
02404 rest_of_decl_compilation (decl, asmspec, top_level, at_end)
02405 tree decl;
02406 const char *asmspec;
02407 int top_level;
02408 int at_end;
02409 {
02410
02411
02412
02413
02414 #ifndef ASM_FINISH_DECLARE_OBJECT
02415 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
02416 #endif
02417
02418
02419
02420 {
02421 tree alias;
02422 alias = lookup_attribute ("alias", DECL_ATTRIBUTES (decl));
02423 if (alias)
02424 {
02425 alias = TREE_VALUE (TREE_VALUE (alias));
02426 alias = get_identifier (TREE_STRING_POINTER (alias));
02427 assemble_alias (decl, alias);
02428 #ifdef KEY
02429
02430
02431
02432
02433 gxx_emits_decl (decl);
02434 #endif
02435 }
02436 }
02437
02438
02439
02440 if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
02441 || TREE_CODE (decl) == FUNCTION_DECL)
02442 {
02443 timevar_push (TV_VARCONST);
02444
02445 if (asmspec)
02446 make_decl_rtl (decl, asmspec);
02447
02448
02449
02450 if (at_end || !DECL_DEFER_OUTPUT (decl))
02451 assemble_variable (decl, top_level, at_end, 0);
02452 if (decl == last_assemble_variable_decl)
02453 {
02454 ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
02455 top_level, at_end);
02456 }
02457
02458 timevar_pop (TV_VARCONST);
02459 }
02460 else if (DECL_REGISTER (decl) && asmspec != 0)
02461 {
02462 if (decode_reg_name (asmspec) >= 0)
02463 {
02464 SET_DECL_RTL (decl, NULL_RTX);
02465 make_decl_rtl (decl, asmspec);
02466 #ifdef SGI_MONGOOSE
02467 #ifdef KEY
02468
02469
02470 DECL_ASMREG(decl) = decode_reg_name (asmspec) + 1;
02471 #else
02472 WFE_Record_Asmspec_For_ST (decl, asmspec, decode_reg_name (asmspec));
02473 #endif
02474 #endif
02475 }
02476 else
02477 {
02478 error ("invalid register name `%s' for register variable", asmspec);
02479 DECL_REGISTER (decl) = 0;
02480 if (!top_level)
02481 expand_decl (decl);
02482 }
02483 }
02484 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
02485 else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
02486 && TREE_CODE (decl) == TYPE_DECL)
02487 {
02488 timevar_push (TV_SYMOUT);
02489 dbxout_symbol (decl, 0);
02490 timevar_pop (TV_SYMOUT);
02491 }
02492 #endif
02493 #ifdef SDB_DEBUGGING_INFO
02494 else if (write_symbols == SDB_DEBUG && top_level
02495 && TREE_CODE (decl) == TYPE_DECL)
02496 {
02497 timevar_push (TV_SYMOUT);
02498 sdbout_symbol (decl, 0);
02499 timevar_pop (TV_SYMOUT);
02500 }
02501 #endif
02502 #ifdef DWARF2_DEBUGGING_INFO
02503 else if ((write_symbols == DWARF2_DEBUG
02504 || write_symbols == VMS_AND_DWARF2_DEBUG)
02505 && top_level
02506 && TREE_CODE (decl) == TYPE_DECL)
02507 {
02508 timevar_push (TV_SYMOUT);
02509 dwarf2out_decl (decl);
02510 timevar_pop (TV_SYMOUT);
02511 }
02512 #endif
02513 }
02514
02515
02516
02517 void
02518 rest_of_type_compilation (type, toplev)
02519 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO) || defined (SDB_DEBUGGING_INFO)
02520 tree type;
02521 int toplev;
02522 #else
02523 tree type ATTRIBUTE_UNUSED;
02524 int toplev ATTRIBUTE_UNUSED;
02525 #endif
02526 {
02527
02528
02529 if (errorcount != 0 || sorrycount != 0)
02530 return;
02531
02532 timevar_push (TV_SYMOUT);
02533 #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
02534 if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
02535 dbxout_symbol (TYPE_STUB_DECL (type), !toplev);
02536 #endif
02537 #ifdef SDB_DEBUGGING_INFO
02538 if (write_symbols == SDB_DEBUG)
02539 sdbout_symbol (TYPE_STUB_DECL (type), !toplev);
02540 #endif
02541 #ifdef DWARF2_DEBUGGING_INFO
02542 if ((write_symbols == DWARF2_DEBUG
02543 || write_symbols == VMS_AND_DWARF2_DEBUG)
02544 && toplev)
02545 dwarf2out_decl (TYPE_STUB_DECL (type));
02546 #endif
02547 timevar_pop (TV_SYMOUT);
02548 }
02549
02550
02551
02552
02553
02554
02555
02556 void
02557 rest_of_compilation (decl)
02558 tree decl;
02559 {
02560 rtx insns;
02561 int tem;
02562 int failure = 0;
02563 int rebuild_label_notes_after_reload;
02564 int register_life_up_to_date;
02565
02566 timevar_push (TV_REST_OF_COMPILATION);
02567
02568
02569
02570 generating_concat_p = 0;
02571
02572
02573
02574 cse_not_expected = ! optimize;
02575
02576
02577
02578 if (!cfun->x_whole_function_mode_p)
02579 identify_blocks ();
02580
02581
02582
02583 if (cfun->x_whole_function_mode_p)
02584 reorder_blocks ();
02585
02586 init_flow ();
02587
02588
02589
02590
02591 if (DECL_SAVED_INSNS (decl) == 0)
02592 {
02593 int inlinable = 0;
02594 tree parent;
02595 const char *lose;
02596
02597
02598
02599
02600
02601 for (parent = DECL_CONTEXT (current_function_decl);
02602 parent != NULL_TREE;
02603 parent = get_containing_scope (parent))
02604 if (TREE_CODE (parent) == FUNCTION_DECL
02605 && DECL_INLINE (parent) && DECL_EXTERNAL (parent))
02606 {
02607 DECL_INITIAL (decl) = 0;
02608 goto exit_rest_of_compilation;
02609 }
02610 else if (TYPE_P (parent))
02611
02612 break;
02613
02614
02615 if ((DECL_INLINE (decl) && !flag_no_inline)
02616 || flag_inline_functions)
02617 {
02618 timevar_push (TV_INTEGRATION);
02619 lose = function_cannot_inline_p (decl);
02620 timevar_pop (TV_INTEGRATION);
02621 if (lose || ! optimize)
02622 {
02623 if (warn_inline && DECL_INLINE (decl))
02624 warning_with_decl (decl, lose);
02625 DECL_ABSTRACT_ORIGIN (decl) = 0;
02626
02627
02628
02629 if (DECL_EXTERNAL (decl))
02630 {
02631 DECL_INITIAL (decl) = 0;
02632 goto exit_rest_of_compilation;
02633 }
02634 }
02635 else
02636 {
02637
02638
02639
02640
02641
02642 if (!DECL_INLINE (decl))
02643 DID_INLINE_FUNC (decl) = 1;
02644 inlinable = DECL_INLINE (decl) = 1;
02645 }
02646 }
02647
02648 insns = get_insns ();
02649
02650
02651
02652 if (open_dump_file (DFI_rtl, decl))
02653 {
02654 if (DECL_SAVED_INSNS (decl))
02655 fprintf (rtl_dump_file, ";; (integrable)\n\n");
02656 close_dump_file (DFI_rtl, print_rtl, insns);
02657 }
02658
02659
02660
02661
02662 convert_from_eh_region_ranges ();
02663
02664
02665
02666
02667
02668
02669
02670
02671 if (inlinable
02672 || (DECL_INLINE (decl)
02673 && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
02674 && ! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))
02675 && ! flag_keep_inline_functions)
02676 || DECL_EXTERNAL (decl))))
02677 DECL_DEFER_OUTPUT (decl) = 1;
02678
02679 if (DECL_INLINE (decl))
02680
02681
02682
02683
02684
02685 (*debug_hooks->deferred_inline_function) (decl);
02686
02687 if (DECL_DEFER_OUTPUT (decl))
02688 {
02689
02690
02691
02692
02693 if (warn_return_type)
02694 {
02695 int saved_optimize = optimize;
02696
02697 optimize = 0;
02698 rebuild_jump_labels (insns);
02699 find_exception_handler_labels ();
02700 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
02701 cleanup_cfg (CLEANUP_PRE_SIBCALL | CLEANUP_PRE_LOOP);
02702 optimize = saved_optimize;
02703
02704
02705 free_bb_for_insn ();
02706 }
02707
02708 set_nothrow_function_flags ();
02709 if (current_function_nothrow)
02710
02711
02712 TREE_NOTHROW (current_function_decl) = 1;
02713
02714 timevar_push (TV_INTEGRATION);
02715 save_for_inline (decl);
02716 timevar_pop (TV_INTEGRATION);
02717 DECL_SAVED_INSNS (decl)->inlinable = inlinable;
02718 goto exit_rest_of_compilation;
02719 }
02720
02721
02722
02723
02724 if (DECL_EXTERNAL (decl))
02725 goto exit_rest_of_compilation;
02726 }
02727
02728
02729
02730 {
02731 tree parent;
02732 for (parent = DECL_CONTEXT (current_function_decl);
02733 parent != NULL_TREE;
02734 parent = get_containing_scope (parent))
02735 if (TREE_CODE (parent) == FUNCTION_DECL)
02736 TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (parent)) = 1;
02737 }
02738
02739
02740
02741
02742 if (DECL_INLINE (decl))
02743 (*debug_hooks->outlining_inline_function) (decl);
02744
02745
02746
02747
02748 remove_unnecessary_notes ();
02749 reorder_blocks ();
02750
02751 ggc_collect ();
02752
02753
02754 init_function_for_compilation ();
02755
02756 if (! DECL_DEFER_OUTPUT (decl))
02757 TREE_ASM_WRITTEN (decl) = 1;
02758
02759
02760
02761
02762
02763
02764
02765 rtx_equal_function_value_matters = 0;
02766 purge_hard_subreg_sets (get_insns ());
02767
02768 #ifdef KEY
02769 goto turn_rtl_into_assembler_code;
02770 #endif
02771
02772
02773
02774
02775 if (((rtl_dump_and_exit || flag_syntax_only)
02776 #ifndef KEY
02777
02778
02779 && !warn_return_type
02780 #endif
02781 ) || errorcount || sorrycount)
02782 goto exit_rest_of_compilation;
02783
02784 timevar_push (TV_JUMP);
02785 open_dump_file (DFI_sibling, decl);
02786 insns = get_insns ();
02787 rebuild_jump_labels (insns);
02788 find_exception_handler_labels ();
02789 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
02790
02791 delete_unreachable_blocks ();
02792
02793
02794
02795 check_function_return_warnings ();
02796
02797
02798 if (flag_guess_branch_prob)
02799 {
02800 timevar_push (TV_BRANCH_PROB);
02801 note_prediction_to_br_prob ();
02802 timevar_pop (TV_BRANCH_PROB);
02803 }
02804
02805
02806
02807 if (flag_optimize_sibling_calls)
02808 {
02809 rtx insn;
02810 optimize_sibling_and_tail_recursive_calls ();
02811
02812
02813 free_bb_for_insn ();
02814 find_exception_handler_labels ();
02815 rebuild_jump_labels (insns);
02816 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
02817
02818
02819
02820
02821
02822
02823
02824 for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
02825 if (GET_CODE (insn) == NOTE
02826 && NOTE_LINE_NUMBER (insn) == NOTE_INSN_PREDICTION)
02827 delete_insn (insn);
02828 }
02829 close_dump_file (DFI_sibling, print_rtl, get_insns ());
02830 timevar_pop (TV_JUMP);
02831
02832 scope_to_insns_initialize ();
02833
02834 if (doing_eh (0))
02835 {
02836 timevar_push (TV_JUMP);
02837 open_dump_file (DFI_eh, decl);
02838
02839 finish_eh_generation ();
02840
02841 close_dump_file (DFI_eh, print_rtl, get_insns ());
02842 timevar_pop (TV_JUMP);
02843 }
02844
02845
02846
02847 emit_initial_value_sets ();
02848
02849 #ifdef FINALIZE_PIC
02850
02851
02852
02853
02854 if (flag_pic)
02855 FINALIZE_PIC;
02856 #endif
02857
02858 insns = get_insns ();
02859
02860
02861 unshare_all_rtl (current_function_decl, insns);
02862
02863 #ifdef SETJMP_VIA_SAVE_AREA
02864
02865
02866
02867
02868 if (current_function_calls_alloca)
02869 optimize_save_area_alloca (insns);
02870 #endif
02871
02872
02873 instantiate_virtual_regs (current_function_decl, insns);
02874
02875 open_dump_file (DFI_jump, decl);
02876
02877
02878
02879
02880
02881 timevar_push (TV_JUMP);
02882
02883
02884 if (flag_guess_branch_prob)
02885 expected_value_to_br_prob ();
02886
02887 reg_scan (insns, max_reg_num (), 0);
02888 rebuild_jump_labels (insns);
02889 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
02890 delete_trivially_dead_insns (insns, max_reg_num ());
02891 if (rtl_dump_file)
02892 dump_flow_info (rtl_dump_file);
02893 cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_PRE_LOOP
02894 | (flag_thread_jumps ? CLEANUP_THREADING : 0));
02895
02896
02897 if (optimize)
02898 {
02899 free_bb_for_insn ();
02900 copy_loop_headers (insns);
02901 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
02902 }
02903 purge_line_number_notes (insns);
02904
02905 timevar_pop (TV_JUMP);
02906 close_dump_file (DFI_jump, print_rtl, insns);
02907
02908
02909 if (rtl_dump_and_exit || flag_syntax_only || DECL_DEFER_OUTPUT (decl))
02910 {
02911 goto exit_rest_of_compilation;
02912 }
02913
02914
02915
02916
02917 if (optimize > 0 && flag_ssa)
02918 {
02919
02920
02921 timevar_push (TV_TO_SSA);
02922 open_dump_file (DFI_ssa, decl);
02923
02924 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
02925 convert_to_ssa ();
02926
02927 close_dump_file (DFI_ssa, print_rtl_with_bb, insns);
02928 timevar_pop (TV_TO_SSA);
02929
02930
02931 if (flag_ssa_ccp)
02932 {
02933 timevar_push (TV_SSA_CCP);
02934 open_dump_file (DFI_ssa_ccp, decl);
02935
02936 ssa_const_prop ();
02937
02938 close_dump_file (DFI_ssa_ccp, print_rtl_with_bb, get_insns ());
02939 timevar_pop (TV_SSA_CCP);
02940 }
02941
02942
02943
02944
02945
02946
02947
02948
02949
02950
02951 if (flag_ssa_dce)
02952 {
02953
02954
02955 timevar_push (TV_SSA_DCE);
02956 open_dump_file (DFI_ssa_dce, decl);
02957
02958 insns = get_insns ();
02959 ssa_eliminate_dead_code ();
02960
02961 close_dump_file (DFI_ssa_dce, print_rtl_with_bb, insns);
02962 timevar_pop (TV_SSA_DCE);
02963 }
02964
02965
02966
02967 timevar_push (TV_FROM_SSA);
02968 open_dump_file (DFI_ussa, decl);
02969
02970 convert_from_ssa ();
02971
02972 reg_scan (insns, max_reg_num (), 1);
02973
02974 close_dump_file (DFI_ussa, print_rtl_with_bb, insns);
02975 timevar_pop (TV_FROM_SSA);
02976
02977 ggc_collect ();
02978 }
02979
02980 timevar_push (TV_JUMP);
02981 if (optimize)
02982 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
02983
02984
02985 if (flag_delete_null_pointer_checks)
02986 {
02987 open_dump_file (DFI_null, decl);
02988 if (rtl_dump_file)
02989 dump_flow_info (rtl_dump_file);
02990
02991 if (delete_null_pointer_checks (insns))
02992 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
02993
02994 close_dump_file (DFI_null, print_rtl_with_bb, insns);
02995 }
02996
02997
02998
02999
03000
03001
03002 renumber_insns (rtl_dump_file);
03003 timevar_pop (TV_JUMP);
03004
03005 close_dump_file (DFI_jump, print_rtl_with_bb, insns);
03006
03007 ggc_collect ();
03008
03009
03010
03011
03012
03013
03014 if (optimize > 0)
03015 {
03016 open_dump_file (DFI_cse, decl);
03017 if (rtl_dump_file)
03018 dump_flow_info (rtl_dump_file);
03019 timevar_push (TV_CSE);
03020
03021 reg_scan (insns, max_reg_num (), 1);
03022
03023 tem = cse_main (insns, max_reg_num (), 0, rtl_dump_file);
03024 if (tem)
03025 rebuild_jump_labels (insns);
03026 purge_all_dead_edges (0);
03027
03028 delete_trivially_dead_insns (insns, max_reg_num ());
03029
03030
03031
03032 cse_not_expected = !flag_rerun_cse_after_loop && !flag_gcse;
03033
03034 if (tem || optimize > 1)
03035 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
03036
03037 if (flag_delete_null_pointer_checks)
03038 {
03039 timevar_push (TV_JUMP);
03040
03041 if (delete_null_pointer_checks (insns))
03042 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
03043 timevar_pop (TV_JUMP);
03044 }
03045
03046
03047
03048 renumber_insns (rtl_dump_file);
03049
03050 timevar_pop (TV_CSE);
03051 close_dump_file (DFI_cse, print_rtl_with_bb, insns);
03052 }
03053
03054 open_dump_file (DFI_addressof, decl);
03055
03056 purge_addressof (insns);
03057 if (optimize && purge_all_dead_edges (0))
03058 delete_unreachable_blocks ();
03059 reg_scan (insns, max_reg_num (), 1);
03060
03061 close_dump_file (DFI_addressof, print_rtl, insns);
03062
03063 ggc_collect ();
03064
03065
03066
03067 if (optimize > 0 && flag_gcse)
03068 {
03069 int save_csb, save_cfj;
03070 int tem2 = 0;
03071
03072 timevar_push (TV_GCSE);
03073 open_dump_file (DFI_gcse, decl);
03074
03075 tem = gcse_main (insns, rtl_dump_file);
03076 rebuild_jump_labels (insns);
03077 delete_trivially_dead_insns (insns, max_reg_num ());
03078
03079 save_csb = flag_cse_skip_blocks;
03080 save_cfj = flag_cse_follow_jumps;
03081 flag_cse_skip_blocks = flag_cse_follow_jumps = 0;
03082
03083
03084
03085 if (flag_expensive_optimizations)
03086 {
03087 timevar_push (TV_CSE);
03088 reg_scan (insns, max_reg_num (), 1);
03089 tem2 = cse_main (insns, max_reg_num (), 0, rtl_dump_file);
03090 purge_all_dead_edges (0);
03091 delete_trivially_dead_insns (insns, max_reg_num ());
03092 timevar_pop (TV_CSE);
03093 cse_not_expected = !flag_rerun_cse_after_loop;
03094 }
03095
03096
03097
03098 while (tem || tem2)
03099 {
03100 tem = tem2 = 0;
03101 timevar_push (TV_JUMP);
03102 rebuild_jump_labels (insns);
03103 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
03104 timevar_pop (TV_JUMP);
03105
03106 if (flag_expensive_optimizations)
03107 {
03108 timevar_push (TV_CSE);
03109 reg_scan (insns, max_reg_num (), 1);
03110 tem2 = cse_main (insns, max_reg_num (), 0, rtl_dump_file);
03111 purge_all_dead_edges (0);
03112 delete_trivially_dead_insns (insns, max_reg_num ());
03113 timevar_pop (TV_CSE);
03114 }
03115 }
03116
03117 close_dump_file (DFI_gcse, print_rtl_with_bb, insns);
03118 timevar_pop (TV_GCSE);
03119
03120 ggc_collect ();
03121 flag_cse_skip_blocks = save_csb;
03122 flag_cse_follow_jumps = save_cfj;
03123 #ifdef ENABLE_CHECKING
03124 verify_flow_info ();
03125 #endif
03126 }
03127
03128
03129
03130 if (optimize > 0 && flag_loop_optimize)
03131 {
03132 int do_unroll, do_prefetch;
03133
03134 timevar_push (TV_LOOP);
03135 delete_dead_jumptables ();
03136 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
03137 open_dump_file (DFI_loop, decl);
03138
03139 free_bb_for_insn ();
03140
03141 do_unroll = flag_unroll_loops ? LOOP_UNROLL : LOOP_AUTO_UNROLL;
03142 do_prefetch = flag_prefetch_loop_arrays ? LOOP_PREFETCH : 0;
03143 if (flag_rerun_loop_opt)
03144 {
03145 cleanup_barriers ();
03146
03147
03148 loop_optimize (insns, rtl_dump_file, do_unroll);
03149 do_unroll = 0;
03150
03151
03152
03153
03154
03155 delete_trivially_dead_insns (insns, max_reg_num ());
03156
03157
03158
03159 reg_scan (insns, max_reg_num (), 1);
03160 }
03161 cleanup_barriers ();
03162 loop_optimize (insns, rtl_dump_file, do_unroll | LOOP_BCT | do_prefetch);
03163
03164
03165 delete_trivially_dead_insns (insns, max_reg_num ());
03166 close_dump_file (DFI_loop, print_rtl, insns);
03167 timevar_pop (TV_LOOP);
03168 find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
03169
03170 ggc_collect ();
03171 }
03172
03173
03174
03175
03176 timevar_push (TV_FLOW);
03177 open_dump_file (DFI_cfg, decl);
03178 if (rtl_dump_file)
03179 dump_flow_info (rtl_dump_file);
03180 if (optimize)
03181 cleanup_cfg (CLEANUP_EXPENSIVE
03182 | (flag_thread_jumps ? CLEANUP_THREADING : 0));
03183
03184
03185
03186
03187
03188
03189
03190
03191 if (optimize)
03192 mark_constant_function ();
03193
03194 close_dump_file (DFI_cfg, print_rtl_with_bb, insns);
03195
03196
03197 if (optimize > 0 || cfun->arc_profile || flag_branch_probabilities)
03198 {
03199 struct loops loops;
03200
03201 timevar_push (TV_BRANCH_PROB);
03202 open_dump_file (DFI_bp, decl);
03203 if (cfun->arc_profile || flag_branch_probabilities)
03204 branch_prob ();
03205
03206
03207
03208 flow_loops_find (&loops, LOOP_TREE);
03209
03210 if (rtl_dump_file)
03211 flow_loops_dump (&loops, rtl_dump_file, NULL, 0);
03212
03213
03214 if (flag_guess_branch_prob)
03215 estimate_probability (&loops);
03216
03217 flow_loops_free (&loops);
03218 close_dump_file (DFI_bp, print_rtl_with_bb, insns);
03219 timevar_pop (TV_BRANCH_PROB);
03220 }
03221 if (optimize > 0)
03222 {
03223 open_dump_file (DFI_ce1, decl);
03224 if (flag_if_conversion)
03225 {
03226 timevar_push (TV_IFCVT);
03227 if (rtl_dump_file)
03228 dump_flow_info (rtl_dump_file);
03229 cleanup_cfg (CLEANUP_EXPENSIVE);
03230 reg_scan (insns, max_reg_num (), 0);
03231 if_convert (0);
03232 timevar_pop (TV_IFCVT);
03233 }
03234 timevar_push (TV_JUMP);
03235 cleanup_cfg (CLEANUP_EXPENSIVE);
03236 reg_scan (insns, max_reg_num (), 0);
03237 timevar_pop (TV_JUMP);
03238 close_dump_file (DFI_ce1, print_rtl_with_bb, get_insns ());
03239 }
03240 if (flag_tracer)
03241 {
03242 timevar_push (TV_TRACER);
03243 open_dump_file (DFI_tracer, decl);
03244 if (rtl_dump_file)
03245 dump_flow_info (rtl_dump_file);
03246 tracer ();
03247 cleanup_cfg (CLEANUP_EXPENSIVE);
03248 reg_scan (insns, max_reg_num (), 0);
03249 close_dump_file (DFI_tracer, print_rtl_with_bb, get_insns ());
03250 timevar_pop (TV_TRACER);
03251 }
03252
03253 if (flag_rerun_cse_after_loop)
03254 {
03255 timevar_push (TV_CSE2);
03256 open_dump_file (DFI_cse2, decl);
03257 if (rtl_dump_file)
03258 dump_flow_info (rtl_dump_file);
03259
03260 tem = cse_main (insns, max_reg_num (), 1, rtl_dump_file);
03261 purge_all_dead_edges (0);
03262 delete_trivially_dead_insns (insns, max_reg_num ());
03263
03264 if (tem)
03265 {
03266 timevar_push (TV_JUMP);
03267 rebuild_jump_labels (insns);
03268 cleanup_cfg (CLEANUP_EXPENSIVE);
03269 timevar_pop (TV_JUMP);
03270 }
03271 reg_scan (insns, max_reg_num (), 0);
03272 close_dump_file (DFI_cse2, print_rtl_with_bb, insns);
03273 ggc_collect ();
03274 timevar_pop (TV_CSE2);
03275 }
03276
03277 cse_not_expected = 1;
03278
03279 open_dump_file (DFI_life, decl);
03280 regclass_init ();
03281
03282 #ifdef ENABLE_CHECKING
03283 verify_flow_info ();
03284 #endif
03285 life_analysis (insns, rtl_dump_file, PROP_FINAL);
03286 if (optimize)
03287 cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_UPDATE_LIFE
03288 | (flag_thread_jumps ? CLEANUP_THREADING : 0));
03289 timevar_pop (TV_FLOW);
03290
03291 if (warn_uninitialized || extra_warnings)
03292 {
03293 uninitialized_vars_warning (DECL_INITIAL (decl));
03294 if (extra_warnings)
03295 setjmp_args_warning ();
03296 }
03297
03298 if (optimize)
03299 {
03300 if (!flag_new_regalloc && initialize_uninitialized_subregs ())
03301 {
03302
03303
03304 insns = get_insns ();
03305 allocate_reg_life_data ();
03306 update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES,
03307 PROP_LOG_LINKS | PROP_REG_INFO | PROP_DEATH_NOTES);
03308 }
03309 }
03310
03311 no_new_pseudos = 1;
03312
03313 close_dump_file (DFI_life, print_rtl_with_bb, insns);
03314
03315 ggc_collect ();
03316
03317
03318
03319 if (optimize > 0)
03320 {
03321 int rebuild_jump_labels_after_combine = 0;
03322
03323 timevar_push (TV_COMBINE);
03324 open_dump_file (DFI_combine, decl);
03325
03326 rebuild_jump_labels_after_combine
03327 = combine_instructions (insns, max_reg_num ());
03328
03329
03330
03331
03332 if (rebuild_jump_labels_after_combine)
03333 {
03334 timevar_push (TV_JUMP);
03335 rebuild_jump_labels (insns);
03336 timevar_pop (TV_JUMP);
03337
03338 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE);
03339 }
03340
03341 close_dump_file (DFI_combine, print_rtl_with_bb, insns);
03342 timevar_pop (TV_COMBINE);
03343
03344 ggc_collect ();
03345 }
03346
03347
03348
03349 if (flag_if_conversion)
03350 {
03351 timevar_push (TV_IFCVT);
03352 open_dump_file (DFI_ce2, decl);
03353
03354 no_new_pseudos = 0;
03355 if_convert (1);
03356 no_new_pseudos = 1;
03357
03358 close_dump_file (DFI_ce2, print_rtl_with_bb, insns);
03359 timevar_pop (TV_IFCVT);
03360 }
03361
03362
03363
03364 if (optimize > 0 && (flag_regmove || flag_expensive_optimizations))
03365 {
03366 timevar_push (TV_REGMOVE);
03367 open_dump_file (DFI_regmove, decl);
03368
03369 regmove_optimize (insns, max_reg_num (), rtl_dump_file);
03370
03371 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE);
03372 close_dump_file (DFI_regmove, print_rtl_with_bb, insns);
03373 timevar_pop (TV_REGMOVE);
03374
03375 ggc_collect ();
03376 }
03377
03378
03379
03380 split_all_insns (1);
03381
03382
03383
03384 register_life_up_to_date = 0;
03385
03386 #ifdef OPTIMIZE_MODE_SWITCHING
03387 timevar_push (TV_MODE_SWITCH);
03388
03389 no_new_pseudos = 0;
03390 optimize_mode_switching (NULL);
03391 no_new_pseudos = 1;
03392
03393 timevar_pop (TV_MODE_SWITCH);
03394 #endif
03395
03396 timevar_push (TV_SCHED);
03397
03398 #ifdef INSN_SCHEDULING
03399
03400
03401
03402 if (optimize > 0 && flag_schedule_insns)
03403 {
03404 open_dump_file (DFI_sched, decl);
03405
03406
03407
03408
03409 schedule_insns (rtl_dump_file);
03410
03411 close_dump_file (DFI_sched, print_rtl_with_bb, insns);
03412
03413
03414
03415 register_life_up_to_date = 1;
03416 }
03417 #endif
03418 timevar_pop (TV_SCHED);
03419
03420 ggc_collect ();
03421
03422
03423
03424
03425 current_function_is_leaf = leaf_function_p ();
03426
03427 timevar_push (TV_LOCAL_ALLOC);
03428 open_dump_file (DFI_lreg, decl);
03429
03430
03431
03432
03433
03434
03435 if (! register_life_up_to_date)
03436 recompute_reg_usage (insns, ! optimize_size);
03437
03438 if (flag_new_regalloc)
03439 {
03440 delete_trivially_dead_insns (insns, max_reg_num ());
03441 reg_alloc ();
03442
03443 timevar_pop (TV_LOCAL_ALLOC);
03444 if (dump_file[DFI_lreg].enabled)
03445 {
03446 timevar_push (TV_DUMP);
03447
03448 close_dump_file (DFI_lreg, NULL, NULL);
03449 timevar_pop (TV_DUMP);
03450 }
03451
03452
03453 timevar_push (TV_GLOBAL_ALLOC);
03454 open_dump_file (DFI_greg, decl);
03455
03456 build_insn_chain (insns);
03457 failure = reload (insns, 0);
03458
03459 timevar_pop (TV_GLOBAL_ALLOC);
03460
03461 if (dump_file[DFI_greg].enabled)
03462 {
03463 timevar_push (TV_DUMP);
03464
03465 dump_global_regs (rtl_dump_file);
03466
03467 close_dump_file (DFI_greg, print_rtl_with_bb, insns);
03468 timevar_pop (TV_DUMP);
03469 }
03470
03471 if (failure)
03472 goto exit_rest_of_compilation;
03473 reload_completed = 1;
03474 rebuild_label_notes_after_reload = 0;
03475 }
03476 else
03477 {
03478
03479 allocate_reg_info (max_regno, FALSE, TRUE);
03480
03481
03482 reg_equiv_memory_loc = (rtx *) xcalloc (max_regno, sizeof (rtx));
03483
03484 allocate_initial_values (reg_equiv_memory_loc);
03485
03486 regclass (insns, max_reg_num (), rtl_dump_file);
03487 rebuild_label_notes_after_reload = local_alloc ();
03488
03489 timevar_pop (TV_LOCAL_ALLOC);
03490
03491 if (dump_file[DFI_lreg].enabled)
03492 {
03493 timevar_push (TV_DUMP);
03494
03495 dump_flow_info (rtl_dump_file);
03496 dump_local_alloc (rtl_dump_file);
03497
03498 close_dump_file (DFI_lreg, print_rtl_with_bb, insns);
03499 timevar_pop (TV_DUMP);
03500 }
03501
03502 ggc_collect ();
03503
03504 timevar_push (TV_GLOBAL_ALLOC);
03505 open_dump_file (DFI_greg, decl);
03506
03507
03508
03509
03510 if (optimize)
03511 failure = global_alloc (rtl_dump_file);
03512 else
03513 {
03514 build_insn_chain (insns);
03515 failure = reload (insns, 0);
03516 }
03517
03518 timevar_pop (TV_GLOBAL_ALLOC);
03519
03520 if (dump_file[DFI_greg].enabled)
03521 {
03522 timevar_push (TV_DUMP);
03523
03524 dump_global_regs (rtl_dump_file);
03525
03526 close_dump_file (DFI_greg, print_rtl_with_bb, insns);
03527 timevar_pop (TV_DUMP);
03528 }
03529
03530 if (failure)
03531 goto exit_rest_of_compilation;
03532 }
03533
03534 ggc_collect ();
03535
03536 open_dump_file (DFI_postreload, decl);
03537
03538
03539 if (optimize > 0)
03540 {
03541 timevar_push (TV_RELOAD_CSE_REGS);
03542 reload_cse_regs (insns);
03543 timevar_pop (TV_RELOAD_CSE_REGS);
03544 }
03545
03546
03547
03548
03549 if (rebuild_label_notes_after_reload)
03550 {
03551 timevar_push (TV_JUMP);
03552
03553 rebuild_jump_labels (insns);
03554 purge_all_dead_edges (0);
03555
03556 timevar_pop (TV_JUMP);
03557 }
03558
03559 close_dump_file (DFI_postreload, print_rtl_with_bb, insns);
03560
03561
03562 timevar_push (TV_FLOW2);
03563 open_dump_file (DFI_flow2, decl);
03564
03565 #ifdef ENABLE_CHECKING
03566 verify_flow_info ();
03567 #endif
03568
03569
03570 #ifndef STACK_REGS
03571 if (optimize > 0)
03572 #endif
03573 split_all_insns (0);
03574
03575 if (optimize)
03576 cleanup_cfg (CLEANUP_EXPENSIVE);
03577
03578
03579
03580
03581
03582 thread_prologue_and_epilogue_insns (insns);
03583
03584 if (optimize)
03585 {
03586 life_analysis (insns, rtl_dump_file, PROP_FINAL);
03587 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE
03588 | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0));
03589
03590
03591
03592
03593
03594 #ifndef PUSH_ROUNDING
03595 if (!ACCUMULATE_OUTGOING_ARGS)
03596 #endif
03597 combine_stack_adjustments ();
03598
03599 ggc_collect ();
03600 }
03601
03602 flow2_completed = 1;
03603
03604 close_dump_file (DFI_flow2, print_rtl_with_bb, insns);
03605 timevar_pop (TV_FLOW2);
03606
03607 #ifdef HAVE_peephole2
03608 if (optimize > 0 && flag_peephole2)
03609 {
03610 timevar_push (TV_PEEPHOLE2);
03611 open_dump_file (DFI_peephole2, decl);
03612
03613 peephole2_optimize (rtl_dump_file);
03614
03615 close_dump_file (DFI_peephole2, print_rtl_with_bb, insns);
03616 timevar_pop (TV_PEEPHOLE2);
03617 }
03618 #endif
03619
03620 if (optimize > 0 && (flag_rename_registers || flag_cprop_registers))
03621 {
03622 timevar_push (TV_RENAME_REGISTERS);
03623 open_dump_file (DFI_rnreg, decl);
03624
03625 if (flag_rename_registers)
03626 regrename_optimize ();
03627 if (flag_cprop_registers)
03628 copyprop_hardreg_forward ();
03629
03630 close_dump_file (DFI_rnreg, print_rtl_with_bb, insns);
03631 timevar_pop (TV_RENAME_REGISTERS);
03632 }
03633
03634 if (flag_if_conversion2)
03635 {
03636 timevar_push (TV_IFCVT2);
03637 open_dump_file (DFI_ce3, decl);
03638
03639 if_convert (1);
03640
03641 close_dump_file (DFI_ce3, print_rtl_with_bb, insns);
03642 timevar_pop (TV_IFCVT2);
03643 }
03644
03645 #ifdef INSN_SCHEDULING
03646 if (optimize > 0 && flag_schedule_insns_after_reload)
03647 {
03648 timevar_push (TV_SCHED2);
03649 open_dump_file (DFI_sched2, decl);
03650
03651
03652
03653
03654 split_all_insns (1);
03655
03656 schedule_insns (rtl_dump_file);
03657
03658 close_dump_file (DFI_sched2, print_rtl_with_bb, insns);
03659 timevar_pop (TV_SCHED2);
03660
03661 ggc_collect ();
03662 }
03663 #endif
03664
03665 #ifdef LEAF_REGISTERS
03666 current_function_uses_only_leaf_regs
03667 = optimize > 0 && only_leaf_regs_used () && leaf_function_p ();
03668 #endif
03669
03670 #ifdef STACK_REGS
03671
03672 #if defined (HAVE_ATTR_length)
03673
03674
03675
03676
03677 #ifdef INSN_SCHEDULING
03678 if (optimize && !flag_schedule_insns_after_reload)
03679 #else
03680 if (optimize)
03681 #endif
03682 {
03683 timevar_push (TV_SHORTEN_BRANCH);
03684 split_all_insns (1);
03685 timevar_pop (TV_SHORTEN_BRANCH);
03686 }
03687 #endif
03688
03689 timevar_push (TV_REG_STACK);
03690 open_dump_file (DFI_stack, decl);
03691
03692 reg_to_stack (insns, rtl_dump_file);
03693
03694 close_dump_file (DFI_stack, print_rtl_with_bb, insns);
03695 timevar_pop (TV_REG_STACK);
03696
03697 ggc_collect ();
03698 #endif
03699 if (optimize > 0)
03700 {
03701 timevar_push (TV_REORDER_BLOCKS);
03702 open_dump_file (DFI_bbro, decl);
03703
03704
03705
03706
03707
03708 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK
03709 | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0));
03710 if (flag_reorder_blocks)
03711 {
03712 reorder_basic_blocks ();
03713 cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK);
03714 }
03715
03716 close_dump_file (DFI_bbro, print_rtl_with_bb, insns);
03717 timevar_pop (TV_REORDER_BLOCKS);
03718 }
03719 compute_alignments ();
03720
03721
03722 free_bb_for_insn ();
03723
03724
03725 #ifdef MACHINE_DEPENDENT_REORG
03726 timevar_push (TV_MACH_DEP);
03727 open_dump_file (DFI_mach, decl);
03728
03729 MACHINE_DEPENDENT_REORG (insns);
03730
03731 close_dump_file (DFI_mach, print_rtl, insns);
03732 timevar_pop (TV_MACH_DEP);
03733
03734 ggc_collect ();
03735 #endif
03736
03737 purge_line_number_notes (insns);
03738 cleanup_barriers ();
03739
03740
03741
03742
03743 #ifdef DELAY_SLOTS
03744 if (optimize > 0 && flag_delayed_branch)
03745 {
03746 timevar_push (TV_DBR_SCHED);
03747 open_dump_file (DFI_dbr, decl);
03748
03749 dbr_schedule (insns, rtl_dump_file);
03750
03751 close_dump_file (DFI_dbr, print_rtl, insns);
03752 timevar_pop (TV_DBR_SCHED);
03753
03754 ggc_collect ();
03755 }
03756 #endif
03757
03758 #if defined (HAVE_ATTR_length) && !defined (STACK_REGS)
03759 timevar_push (TV_SHORTEN_BRANCH);
03760 split_all_insns_noflow ();
03761 timevar_pop (TV_SHORTEN_BRANCH);
03762 #endif
03763
03764 convert_to_eh_region_ranges ();
03765
03766
03767 timevar_push (TV_SHORTEN_BRANCH);
03768 shorten_branches (get_insns ());
03769 timevar_pop (TV_SHORTEN_BRANCH);
03770
03771 set_nothrow_function_flags ();
03772 if (current_function_nothrow)
03773
03774
03775 TREE_NOTHROW (current_function_decl) = 1;
03776
03777 #ifdef KEY
03778
03779
03780
03781
03782
03783 turn_rtl_into_assembler_code:
03784
03785
03786
03787
03788
03789
03790
03791
03792
03793
03794
03795
03796
03797
03798
03799
03800
03801
03802 gxx_emits_decl (decl);
03803 #endif
03804
03805
03806
03807 timevar_push (TV_FINAL);
03808 {
03809 rtx x;
03810 const char *fnname;
03811
03812
03813
03814
03815 x = DECL_RTL (decl);
03816 if (GET_CODE (x) != MEM)
03817 abort ();
03818 x = XEXP (x, 0);
03819 if (GET_CODE (x) != SYMBOL_REF)
03820 abort ();
03821 fnname = XSTR (x, 0);
03822
03823 assemble_start_function (decl, fnname);
03824 final_start_function (insns, asm_out_file, optimize);
03825 final (insns, asm_out_file, optimize, 0);
03826 final_end_function ();
03827
03828 #ifdef IA64_UNWIND_INFO
03829
03830
03831 output_function_exception_table ();
03832 #endif
03833
03834 assemble_end_function (decl, fnname);
03835
03836 #ifndef IA64_UNWIND_INFO
03837
03838 output_function_exception_table ();
03839 #endif
03840
03841 if (! quiet_flag)
03842 fflush (asm_out_file);
03843
03844 #ifdef KEY
03845 goto exit_rest_of_compilation;
03846 #endif
03847
03848
03849 free_basic_block_vars (0);
03850
03851
03852 regset_release_memory ();
03853 }
03854 timevar_pop (TV_FINAL);
03855
03856 ggc_collect ();
03857
03858
03859
03860
03861
03862
03863
03864
03865
03866
03867
03868
03869 timevar_push (TV_SYMOUT);
03870 (*debug_hooks->function_decl) (decl);
03871 timevar_pop (TV_SYMOUT);
03872
03873 exit_rest_of_compilation:
03874
03875
03876
03877
03878 #ifdef SDB_DEBUGGING_INFO
03879 if (write_symbols == SDB_DEBUG)
03880 sdbout_types (NULL_TREE);
03881 #endif
03882
03883 reload_completed = 0;
03884 flow2_completed = 0;
03885 no_new_pseudos = 0;
03886
03887 timevar_push (TV_FINAL);
03888
03889
03890
03891 init_insn_lengths ();
03892
03893
03894 init_temp_slots ();
03895
03896 free_basic_block_vars (0);
03897 free_bb_for_insn ();
03898
03899 timevar_pop (TV_FINAL);
03900
03901
03902
03903
03904
03905
03906
03907
03908
03909
03910 init_recog_no_volatile ();
03911
03912
03913 free_after_parsing (cfun);
03914 if (! DECL_DEFER_OUTPUT (decl))
03915 {
03916 free_after_compilation (cfun);
03917
03918
03919
03920 DECL_SAVED_INSNS (decl) = 0;
03921 }
03922 cfun = 0;
03923
03924 ggc_collect ();
03925
03926 timevar_pop (TV_REST_OF_COMPILATION);
03927 }
03928
03929 static void
03930 display_help ()
03931 {
03932 int undoc;
03933 unsigned long i;
03934 const char *lang;
03935
03936 printf (_(" -ffixed-<register> Mark <register> as being unavailable to the compiler\n"));
03937 printf (_(" -fcall-used-<register> Mark <register> as being corrupted by function calls\n"));
03938 printf (_(" -fcall-saved-<register> Mark <register> as being preserved across functions\n"));
03939 printf (_(" -finline-limit=<number> Limits the size of inlined functions to <number>\n"));
03940 printf (_(" -fmessage-length=<number> Limits diagnostics messages lengths to <number> characters per line. 0 suppresses line-wrapping\n"));
03941 printf (_(" -fdiagnostics-show-location=[once | every-line] Indicates how often source location information should be emitted, as prefix, at the beginning of diagnostics when line-wrapping\n"));
03942 printf (_(" -ftls-model=[global-dynamic | local-dynamic | initial-exec | local-exec] Indicates the default thread-local storage code generation model\n"));
03943 printf (_(" -fstack-limit-register=<register> Trap if the stack goes past <register>\n"));
03944 printf (_(" -fstack-limit-symbol=<name> Trap if the stack goes past symbol <name>\n"));
03945 printf (_(" -frandom-seed=<string> Make compile reproducible using <string>\n"));
03946
03947
03948 for (i = ARRAY_SIZE (f_options); i--;)
03949 {
03950 const char *description = f_options[i].description;
03951
03952 if (description != NULL && *description != 0)
03953 printf (" -f%-21s %s\n",
03954 f_options[i].string, _(description));
03955 }
03956
03957 printf (_(" -O[number] Set optimization level to [number]\n"));
03958 printf (_(" -Os Optimize for space rather than speed\n"));
03959 for (i = LAST_PARAM; i--;)
03960 {
03961 const char *description = compiler_params[i].help;
03962 const int length = 21 - strlen (compiler_params[i].option);
03963
03964 if (description != NULL && *description != 0)
03965 printf (" --param %s=<value>%.*s%s\n",
03966 compiler_params[i].option,
03967 length > 0 ? length : 1, " ",
03968 _(description));
03969 }
03970 printf (_(" -pedantic Issue warnings needed by strict compliance to ISO C\n"));
03971 printf (_(" -pedantic-errors Like -pedantic except that errors are produced\n"));
03972 printf (_(" -w Suppress warnings\n"));
03973 printf (_(" -W Enable extra warnings\n"));
03974
03975 for (i = ARRAY_SIZE (W_options); i--;)
03976 {
03977 const char *description = W_options[i].description;
03978
03979 if (description != NULL && *description != 0)
03980 printf (" -W%-21s %s\n",
03981 W_options[i].string, _(description));
03982 }
03983
03984 printf (_(" -Wunused Enable unused warnings\n"));
03985 printf (_(" -Wlarger-than-<number> Warn if an object is larger than <number> bytes\n"));
03986 printf (_(" -p Enable function profiling\n"));
03987 printf (_(" -o <file> Place output into <file> \n"));
03988 printf (_("\
03989 -G <number> Put global and static data smaller than <number>\n\
03990 bytes into a special section (on some targets)\n"));
03991
03992 for (i = ARRAY_SIZE (debug_args); i--;)
03993 {
03994 if (debug_args[i].description != NULL)
03995 printf (" -g%-21s %s\n",
03996 debug_args[i].arg, _(debug_args[i].description));
03997 }
03998
03999 printf (_(" -aux-info <file> Emit declaration info into <file>\n"));
04000 printf (_(" -quiet Do not display functions compiled or elapsed time\n"));
04001 printf (_(" -version Display the compiler's version\n"));
04002 printf (_(" -d[letters] Enable dumps from specific passes of the compiler\n"));
04003 printf (_(" -dumpbase <file> Base name to be used for dumps from specific passes\n"));
04004 #if defined INSN_SCHEDULING
04005 printf (_(" -fsched-verbose=<number> Set the verbosity level of the scheduler\n"));
04006 #endif
04007 printf (_(" --help Display this information\n"));
04008
04009 undoc = 0;
04010 lang = "language";
04011
04012
04013
04014
04015
04016
04017
04018
04019
04020 if (ARRAY_SIZE (documented_lang_options) > 1)
04021 {
04022 printf (_("\nLanguage specific options:\n"));
04023
04024 for (i = 0; i < ARRAY_SIZE (documented_lang_options); i++)
04025 {
04026 const char *description = documented_lang_options[i].description;
04027 const char *option = documented_lang_options[i].option;
04028
04029 if (description == NULL)
04030 {
04031 undoc = 1;
04032
04033 if (extra_warnings)
04034 printf (_(" %-23.23s [undocumented]\n"), option);
04035 }
04036 else if (*description == 0)
04037 continue;
04038 else if (option == NULL)
04039 {
04040 if (undoc)
04041 printf
04042 (_("\nThere are undocumented %s specific options as well.\n"),
04043 lang);
04044 undoc = 0;
04045
04046 printf (_("\n Options for %s:\n"), description);
04047
04048 lang = description;
04049 }
04050 else
04051 printf (" %-23.23s %s\n", option, _(description));
04052 }
04053 }
04054
04055 if (undoc)
04056 printf (_("\nThere are undocumented %s specific options as well.\n"),
04057 lang);
04058
04059 display_target_options ();
04060 }
04061
04062 static void
04063 display_target_options ()
04064 {
04065 int undoc, i;
04066 static bool displayed = false;
04067
04068
04069 if (displayed)
04070 return;
04071 displayed = true;
04072
04073 if (ARRAY_SIZE (target_switches) > 1
04074 #ifdef TARGET_OPTIONS
04075 || ARRAY_SIZE (target_options) > 1
04076 #endif
04077 )
04078 {
04079 int doc = 0;
04080
04081 undoc = 0;
04082
04083 printf (_("\nTarget specific options:\n"));
04084
04085 for (i = ARRAY_SIZE (target_switches); i--;)
04086 {
04087 const char *option = target_switches[i].name;
04088 const char *description = target_switches[i].description;
04089
04090 if (option == NULL || *option == 0)
04091 continue;
04092 else if (description == NULL)
04093 {
04094 undoc = 1;
04095
04096 if (extra_warnings)
04097 printf (_(" -m%-23.23s [undocumented]\n"), option);
04098 }
04099 else if (*description != 0)
04100 doc += printf (" -m%-23.23s %s\n", option, _(description));
04101 }
04102
04103 #ifdef TARGET_OPTIONS
04104 for (i = ARRAY_SIZE (target_options); i--;)
04105 {
04106 const char *option = target_options[i].prefix;
04107 const char *description = target_options[i].description;
04108
04109 if (option == NULL || *option == 0)
04110 continue;
04111 else if (description == NULL)
04112 {
04113 undoc = 1;
04114
04115 if (extra_warnings)
04116 printf (_(" -m%-23.23s [undocumented]\n"), option);
04117 }
04118 else if (*description != 0)
04119 doc += printf (" -m%-23.23s %s\n", option, _(description));
04120 }
04121 #endif
04122 if (undoc)
04123 {
04124 if (doc)
04125 printf (_("\nThere are undocumented target specific options as well.\n"));
04126 else
04127 printf (_(" They exist, but they are not documented.\n"));
04128 }
04129 }
04130 }
04131
04132
04133
04134 static void
04135 decode_d_option (arg)
04136 const char *arg;
04137 {
04138 int i, c, matched;
04139
04140 while (*arg)
04141 switch (c = *arg++)
04142 {
04143 case 'a':
04144 for (i = 0; i < (int) DFI_MAX; ++i)
04145 dump_file[i].enabled = 1;
04146 break;
04147 case 'A':
04148 flag_debug_asm = 1;
04149 break;
04150 #ifdef SGI_MONGOOSE
04151 case 'C':
04152 flag_bad_asm_constraint_kills_stmt = 1;
04153 break;
04154 #endif
04155 case 'p':
04156 flag_print_asm_name = 1;
04157 break;
04158 #ifdef SGI_MONGOOSE
04159 case 'P':
04160 parse_tree_dump = 1;
04161 #ifdef KEY
04162 dump_file[DFI_sgi_parse_tree].enabled = 1;
04163 #endif
04164 break;
04165 #else
04166 case 'P':
04167 flag_dump_rtl_in_asm = 1;
04168 flag_print_asm_name = 1;
04169 break;
04170 #endif
04171 case 'v':
04172 graph_dump_format = vcg;
04173 break;
04174 case 'x':
04175 rtl_dump_and_exit = 1;
04176 break;
04177 case 'y':
04178 set_yydebug = 1;
04179 break;
04180 case 'D':
04181 case 'I':
04182 break;
04183
04184 default:
04185 matched = 0;
04186 for (i = 0; i < (int) DFI_MAX; ++i)
04187 if (c == dump_file[i].debug_switch)
04188 {
04189 dump_file[i].enabled = 1;
04190 matched = 1;
04191 }
04192
04193 if (! matched)
04194 warning ("unrecognized gcc debugging option: %c", c);
04195 break;
04196 }
04197 }
04198
04199
04200
04201
04202
04203 static int
04204 decode_f_option (arg)
04205 const char *arg;
04206 {
04207 int j;
04208 const char *option_value = NULL;
04209
04210
04211 for (j = ARRAY_SIZE (f_options); j--;)
04212 {
04213 if (!strcmp (arg, f_options[j].string))
04214 {
04215 *f_options[j].variable = f_options[j].on_value;
04216 return 1;
04217 }
04218
04219 if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-'
04220 && ! strcmp (arg + 3, f_options[j].string))
04221 {
04222 *f_options[j].variable = ! f_options[j].on_value;
04223 return 1;
04224 }
04225 }
04226
04227 if (!strcmp (arg, "fast-math"))
04228 set_fast_math_flags (1);
04229 else if (!strcmp (arg, "no-fast-math"))
04230 set_fast_math_flags (0);
04231 else if ((option_value = skip_leading_substring (arg, "inline-limit-"))
04232 || (option_value = skip_leading_substring (arg, "inline-limit=")))
04233 {
04234 int val =
04235 read_integral_parameter (option_value, arg - 2,
04236 MAX_INLINE_INSNS);
04237 set_param_value ("max-inline-insns", val);
04238 set_param_value ("max-inline-insns-single", val/2);
04239 set_param_value ("max-inline-insns-auto", val/2);
04240 set_param_value ("max-inline-insns-rtl", val);
04241 if (val/4 < MIN_INLINE_INSNS)
04242 {
04243 if (val/4 > 10)
04244 set_param_value ("min-inline-insns", val/4);
04245 else
04246 set_param_value ("min-inline-insns", 10);
04247 }
04248 }
04249 else if ((option_value = skip_leading_substring (arg, "tls-model=")))
04250 {
04251 if (strcmp (option_value, "global-dynamic") == 0)
04252 flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
04253 else if (strcmp (option_value, "local-dynamic") == 0)
04254 flag_tls_default = TLS_MODEL_LOCAL_DYNAMIC;
04255 else if (strcmp (option_value, "initial-exec") == 0)
04256 flag_tls_default = TLS_MODEL_INITIAL_EXEC;
04257 else if (strcmp (option_value, "local-exec") == 0)
04258 flag_tls_default = TLS_MODEL_LOCAL_EXEC;
04259 else
04260 warning ("`%s': unknown tls-model option", arg - 2);
04261 }
04262 #ifdef INSN_SCHEDULING
04263 else if ((option_value = skip_leading_substring (arg, "sched-verbose=")))
04264 fix_sched_param ("verbose", option_value);
04265 #endif
04266 else if ((option_value = skip_leading_substring (arg, "fixed-")))
04267 fix_register (option_value, 1, 1);
04268 else if ((option_value = skip_leading_substring (arg, "call-used-")))
04269 fix_register (option_value, 0, 1);
04270 else if ((option_value = skip_leading_substring (arg, "call-saved-")))
04271 fix_register (option_value, 0, 0);
04272 else if ((option_value = skip_leading_substring (arg, "align-loops=")))
04273 align_loops = read_integral_parameter (option_value, arg - 2, align_loops);
04274 else if ((option_value = skip_leading_substring (arg, "align-functions=")))
04275 align_functions
04276 = read_integral_parameter (option_value, arg - 2, align_functions);
04277 else if ((option_value = skip_leading_substring (arg, "align-jumps=")))
04278 align_jumps = read_integral_parameter (option_value, arg - 2, align_jumps);
04279 else if ((option_value = skip_leading_substring (arg, "align-labels=")))
04280 align_labels
04281 = read_integral_parameter (option_value, arg - 2, align_labels);
04282 else if ((option_value
04283 = skip_leading_substring (arg, "stack-limit-register=")))
04284 {
04285 int reg = decode_reg_name (option_value);
04286 if (reg < 0)
04287 error ("unrecognized register name `%s'", option_value);
04288 else
04289 stack_limit_rtx = gen_rtx_REG (Pmode, reg);
04290 }
04291 else if ((option_value
04292 = skip_leading_substring (arg, "stack-limit-symbol=")))
04293 {
04294 const char *nm;
04295 nm = ggc_strdup (option_value);
04296 stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, nm);
04297 }
04298 else if ((option_value
04299 = skip_leading_substring (arg, "message-length=")))
04300 output_set_maximum_length
04301 (&global_dc->buffer, read_integral_parameter
04302 (option_value, arg - 2, diagnostic_line_cutoff (global_dc)));
04303 else if ((option_value
04304 = skip_leading_substring (arg, "diagnostics-show-location=")))
04305 {
04306 if (!strcmp (option_value, "once"))
04307 diagnostic_prefixing_rule (global_dc) = DIAGNOSTICS_SHOW_PREFIX_ONCE;
04308 else if (!strcmp (option_value, "every-line"))
04309 diagnostic_prefixing_rule (global_dc)
04310 = DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE;
04311 else
04312 error ("unrecognized option `%s'", arg - 2);
04313 }
04314 else if (!strcmp (arg, "no-stack-limit"))
04315 stack_limit_rtx = NULL_RTX;
04316 else if ((option_value = skip_leading_substring (arg, "random-seed=")))
04317 flag_random_seed = option_value;
04318 else if (!strcmp (arg, "no-random-seed"))
04319 flag_random_seed = NULL;
04320 else if (!strcmp (arg, "preprocessed"))
04321
04322
04323 ;
04324 else
04325 return 0;
04326
04327 return 1;
04328 }
04329
04330
04331
04332
04333
04334 static int
04335 decode_W_option (arg)
04336 const char *arg;
04337 {
04338 const char *option_value = NULL;
04339 int j;
04340
04341
04342
04343 for (j = ARRAY_SIZE (W_options); j--;)
04344 {
04345 if (!strcmp (arg, W_options[j].string))
04346 {
04347 *W_options[j].variable = W_options[j].on_value;
04348 return 1;
04349 }
04350
04351 if (arg[0] == 'n' && arg[1] == 'o' && arg[2] == '-'
04352 && ! strcmp (arg + 3, W_options[j].string))
04353 {
04354 *W_options[j].variable = ! W_options[j].on_value;
04355 return 1;
04356 }
04357 }
04358
04359 if ((option_value = skip_leading_substring (arg, "id-clash-")))
04360 warning ("-Wid-clash-LEN is no longer supported");
04361 else if ((option_value = skip_leading_substring (arg, "larger-than-")))
04362 {
04363 larger_than_size = read_integral_parameter (option_value, arg - 2, -1);
04364
04365 warn_larger_than = larger_than_size != -1;
04366 }
04367 else if (!strcmp (arg, "unused"))
04368 {
04369 set_Wunused (1);
04370 }
04371 else if (!strcmp (arg, "no-unused"))
04372 {
04373 set_Wunused (0);
04374 }
04375 else
04376 return 0;
04377
04378 return 1;
04379 }
04380
04381
04382
04383
04384
04385 static int
04386 decode_g_option (arg)
04387 const char *arg;
04388 {
04389 static unsigned level = 0;
04390
04391
04392
04393
04394
04395 static enum debug_info_type selected_debug_type = NO_DEBUG;
04396
04397
04398
04399 static int type_explicitly_set_p = 0;
04400
04401 static const char *const debug_type_names[] =
04402 {
04403 "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff", "vms"
04404 };
04405
04406
04407 static const unsigned max_debug_level = 3;
04408
04409
04410 for (da = debug_args; da->arg; da++)
04411 {
04412 const int da_len = strlen (da->arg);
04413
04414 if (da_len == 0 || ! strncmp (arg, da->arg, da_len))
04415 {
04416 enum debug_info_type type = da->debug_type;
04417 const char *p = arg + da_len;
04418
04419 if (*p && ! ISDIGIT (*p))
04420 continue;
04421
04422
04423
04424
04425
04426
04427
04428
04429
04430 if (*p)
04431 level = read_integral_parameter (p, 0, max_debug_level + 1);
04432 else
04433 level = (level == 0) ? 2 : level;
04434
04435 if (da_len > 1 && *p && !strncmp (arg, "dwarf", da_len))
04436 {
04437 error ("use -gdwarf -g%d for DWARF v1, level %d",
04438 level, level);
04439 if (level == 2)
04440 error ("use -gdwarf-2 for DWARF v2");
04441 }
04442
04443 if (level > max_debug_level)
04444 {
04445 warning ("\
04446 ignoring option `%s' due to invalid debug level specification",
04447 arg - 2);
04448 level = debug_info_level;
04449 }
04450
04451 if (type == NO_DEBUG)
04452 {
04453 type = PREFERRED_DEBUGGING_TYPE;
04454
04455 if (da_len > 1 && strncmp (arg, "gdb", da_len) == 0)
04456 {
04457 #ifdef DWARF2_DEBUGGING_INFO
04458 type = DWARF2_DEBUG;
04459 #else
04460 #ifdef DBX_DEBUGGING_INFO
04461 type = DBX_DEBUG;
04462 #endif
04463 #endif
04464 }
04465 }
04466
04467 #ifndef KEY
04468
04469
04470 if (type == NO_DEBUG)
04471 warning ("`%s': unknown or unsupported -g option", arg - 2);
04472 #endif // KEY
04473
04474
04475 if (type_explicitly_set_p
04476
04477 && da->debug_type != NO_DEBUG
04478 && type != selected_debug_type)
04479 warning ("`%s' ignored, conflicts with `-g%s'",
04480 arg - 2, debug_type_names[(int) selected_debug_type]);
04481 else
04482 {
04483
04484
04485 if (type_explicitly_set_p && da->debug_type == NO_DEBUG)
04486
04487 ;
04488 else
04489 {
04490 selected_debug_type = type;
04491 type_explicitly_set_p = da->debug_type != NO_DEBUG;
04492 }
04493
04494 #ifdef KEY
04495 write_symbols = NO_DEBUG;
04496 #else
04497 write_symbols = (level == 0
04498 ? NO_DEBUG
04499 : selected_debug_type);
04500 #endif // KEY
04501 use_gnu_debug_info_extensions = da->use_extensions_p;
04502 debug_info_level = (enum debug_info_level) level;
04503 }
04504
04505 break;
04506 }
04507 }
04508
04509 if (! da->arg)
04510 return 0;
04511
04512 return 1;
04513 }
04514
04515
04516
04517
04518 static unsigned int
04519 independent_decode_option (argc, argv)
04520 int argc;
04521 char **argv;
04522 {
04523 char *arg = argv[0];
04524
04525 if (arg[0] != '-' || arg[1] == 0)
04526 {
04527 if (arg[0] == '+')
04528 return 0;
04529
04530 filename = arg;
04531
04532 return 1;
04533 }
04534
04535 arg++;
04536
04537 if (!strcmp (arg, "-help"))
04538 {
04539 display_help ();
04540 exit_after_options = 1;
04541 return 1;
04542 }
04543
04544 if (!strcmp (arg, "-target-help"))
04545 {
04546 display_target_options ();
04547 exit_after_options = 1;
04548 return 1;
04549 }
04550
04551 if (!strcmp (arg, "-version"))
04552 {
04553 print_version (stderr, "");
04554 exit_after_options = 1;
04555 return 1;
04556 }
04557
04558
04559 if (strcmp (arg, "-param") == 0)
04560 {
04561 char *equal;
04562
04563 if (argc == 1)
04564 {
04565 error ("-param option missing argument");
04566 return 1;
04567 }
04568
04569
04570 arg = argv[1];
04571
04572 equal = strchr (arg, '=');
04573 if (!equal)
04574 error ("invalid --param option: %s", arg);
04575 else
04576 {
04577 int val;
04578
04579
04580 *equal = '\0';
04581
04582 val = read_integral_parameter (equal + 1, NULL, INVALID_PARAM_VAL);
04583 if (val != INVALID_PARAM_VAL)
04584 set_param_value (arg, val);
04585 else
04586 error ("invalid parameter value `%s'", equal + 1);
04587 }
04588
04589 return 2;
04590 }
04591
04592 #ifdef KEY
04593 if (!strcmp (arg, "mp"))
04594 {
04595 flag_openmp = 1;
04596 return 1;
04597 }
04598 #endif
04599
04600 if (*arg == 'Y')
04601 arg++;
04602
04603 switch (*arg)
04604 {
04605 default:
04606 return 0;
04607
04608 case 'O':
04609
04610 break;
04611
04612 case 'm':
04613 #ifdef TARG_SL
04614
04615 if(!strcmp(arg, "mlong-long"))
04616 {
04617 Long_Long_Support = TRUE;
04618 }
04619 else if(!strcmp(arg, "msoft-float"))
04620
04621 {
04622 Float_Point_Support = TRUE;
04623 }
04624 else
04625 {
04626 set_target_switch (arg + 1);
04627 }
04628 #else
04629 set_target_switch (arg + 1);
04630 #endif
04631 break;
04632
04633 case 'f':
04634 return decode_f_option (arg + 1);
04635
04636 case 'g':
04637 return decode_g_option (arg + 1);
04638
04639 case 'd':
04640 if (!strcmp (arg, "dumpbase"))
04641 {
04642 if (argc == 1)
04643 return 0;
04644
04645 if (argv[1][0])
04646 dump_base_name = argv[1];
04647
04648 return 2;
04649 }
04650 else
04651 decode_d_option (arg + 1);
04652 break;
04653
04654 case 'p':
04655 if (!strcmp (arg, "pedantic"))
04656 pedantic = 1;
04657 else if (!strcmp (arg, "pedantic-errors"))
04658 flag_pedantic_errors = pedantic = 1;
04659 #ifdef SGI_MONGOOSE
04660 else if (!strcmp (arg, "pstatic_as_global"))
04661 pstatic_as_global = 1;
04662 #endif
04663 else if (arg[1] == 0)
04664 profile_flag = 1;
04665 else
04666 return 0;
04667 break;
04668
04669 case 'q':
04670 if (!strcmp (arg, "quiet"))
04671 quiet_flag = 1;
04672 else
04673 return 0;
04674 break;
04675
04676 case 'v':
04677 if (!strcmp (arg, "version"))
04678 version_flag = 1;
04679 else
04680 return 0;
04681 break;
04682
04683 case 'w':
04684 if (arg[1] == 0)
04685 inhibit_warnings = 1;
04686 else
04687 return 0;
04688 break;
04689
04690 case 'W':
04691 if (arg[1] == 0)
04692 {
04693 extra_warnings = 1;
04694
04695
04696
04697 if (warn_uninitialized != 1)
04698 warn_uninitialized = 2;
04699 }
04700 else
04701 return decode_W_option (arg + 1);
04702 break;
04703
04704 case 'a':
04705 if (!strncmp (arg, "aux-info", 8))
04706 {
04707 if (arg[8] == '\0')
04708 {
04709 if (argc == 1)
04710 return 0;
04711
04712 aux_info_file_name = argv[1];
04713 flag_gen_aux_info = 1;
04714 return 2;
04715 }
04716 else if (arg[8] == '=')
04717 {
04718 aux_info_file_name = arg + 9;
04719 flag_gen_aux_info = 1;
04720 }
04721 else
04722 return 0;
04723 }
04724 else if (!strcmp (arg, "auxbase"))
04725 {
04726 if (argc == 1)
04727 return 0;
04728
04729 if (argv[1][0])
04730 aux_base_name = argv[1];
04731
04732 return 2;
04733 }
04734 else if (!strcmp (arg, "auxbase-strip"))
04735 {
04736 if (argc == 1)
04737 return 0;
04738
04739 if (argv[1][0])
04740 {
04741 strip_off_ending (argv[1], strlen (argv[1]));
04742 if (argv[1][0])
04743 aux_base_name = argv[1];
04744 }
04745
04746 return 2;
04747 }
04748 else
04749 return 0;
04750 break;
04751
04752 case 'o':
04753 if (arg[1] == 0)
04754 {
04755 if (argc == 1)
04756 return 0;
04757
04758 asm_file_name = argv[1];
04759 return 2;
04760 }
04761 return 0;
04762
04763 case 'G':
04764 {
04765 int g_switch_val;
04766 int return_val;
04767
04768 if (arg[1] == 0)
04769 {
04770 if (argc == 1)
04771 return 0;
04772
04773 g_switch_val = read_integral_parameter (argv[1], 0, -1);
04774 return_val = 2;
04775 }
04776 else
04777 {
04778 g_switch_val = read_integral_parameter (arg + 1, 0, -1);
04779 return_val = 1;
04780 }
04781
04782 if (g_switch_val == -1)
04783 return_val = 0;
04784 else
04785 {
04786 g_switch_set = TRUE;
04787 g_switch_value = g_switch_val;
04788 }
04789
04790 return return_val;
04791 }
04792 }
04793
04794 return 1;
04795 }
04796
04797
04798 #ifdef SGI_MONGOOSE
04799 void
04800 check_gnu_errors (int *error_count, int *sorry_count)
04801 {
04802 *error_count = errorcount;
04803 *sorry_count = sorrycount;
04804 }
04805 #endif
04806
04807
04808
04809
04810 static void
04811 set_target_switch (name)
04812 const char *name;
04813 {
04814 size_t j;
04815 int valid_target_option = 0;
04816
04817 for (j = 0; j < ARRAY_SIZE (target_switches); j++)
04818 if (!strcmp (target_switches[j].name, name))
04819 {
04820 if (target_switches[j].value < 0)
04821 target_flags &= ~-target_switches[j].value;
04822 else
04823 target_flags |= target_switches[j].value;
04824 if (name[0] != 0)
04825 {
04826 if (target_switches[j].value < 0)
04827 target_flags_explicit |= -target_switches[j].value;
04828 else
04829 target_flags_explicit |= target_switches[j].value;
04830 }
04831 valid_target_option = 1;
04832 }
04833
04834 #ifdef TARGET_OPTIONS
04835 if (!valid_target_option)
04836 for (j = 0; j < ARRAY_SIZE (target_options); j++)
04837 {
04838 int len = strlen (target_options[j].prefix);
04839 if (!strncmp (target_options[j].prefix, name, len))
04840 {
04841 *target_options[j].variable = name + len;
04842 valid_target_option = 1;
04843 }
04844 }
04845 #endif
04846
04847 if (!valid_target_option)
04848 error ("invalid option `%s'", name);
04849 }
04850
04851
04852
04853
04854
04855 static void
04856 print_version (file, indent)
04857 FILE *file;
04858 const char *indent;
04859 {
04860 #ifndef __VERSION__
04861 #define __VERSION__ "[?]"
04862 #endif
04863 fnotice (file,
04864 #ifdef __GNUC__
04865 "%s%s%s version %s (%s)\n%s\tcompiled by GNU C version %s.\n"
04866 #else
04867 "%s%s%s version %s (%s) compiled by CC.\n"
04868 #endif
04869 , indent, *indent != 0 ? " " : "",
04870 lang_hooks.name, version_string, TARGET_NAME,
04871 indent, __VERSION__);
04872 fnotice (file, "%s%sGGC heuristics: --param ggc-min-expand=%d --param ggc-min-heapsize=%d\n",
04873 indent, *indent != 0 ? " " : "",
04874 PARAM_VALUE (GGC_MIN_EXPAND), PARAM_VALUE (GGC_MIN_HEAPSIZE));
04875 }
04876
04877
04878
04879
04880
04881 static int
04882 print_single_switch (file, pos, max, indent, sep, term, type, name)
04883 FILE *file;
04884 int pos, max;
04885 const char *indent, *sep, *term, *type, *name;
04886 {
04887
04888
04889 int len = strlen (sep) + strlen (type) + strlen (name);
04890
04891 if (pos != 0
04892 && pos + len > max)
04893 {
04894 fprintf (file, "%s", term);
04895 pos = 0;
04896 }
04897 if (pos == 0)
04898 {
04899 fprintf (file, "%s", indent);
04900 pos = strlen (indent);
04901 }
04902 fprintf (file, "%s%s%s", sep, type, name);
04903 pos += len;
04904 return pos;
04905 }
04906
04907
04908
04909
04910
04911
04912 static void
04913 print_switch_values (file, pos, max, indent, sep, term)
04914 FILE *file;
04915 int pos, max;
04916 const char *indent, *sep, *term;
04917 {
04918 size_t j;
04919 char **p;
04920
04921
04922
04923
04924
04925 default_flag_random_seed ();
04926
04927
04928
04929 pos = print_single_switch (file, pos, max, indent, *indent ? " " : "", term,
04930 _("options passed: "), "");
04931
04932 for (p = &save_argv[1]; *p != NULL; p++)
04933 if (**p == '-')
04934 {
04935
04936 if (strcmp (*p, "-o") == 0)
04937 {
04938 if (p[1] != NULL)
04939 p++;
04940 continue;
04941 }
04942 if (strcmp (*p, "-quiet") == 0)
04943 continue;
04944 if (strcmp (*p, "-version") == 0)
04945 continue;
04946 if ((*p)[1] == 'd')
04947 continue;
04948
04949 pos = print_single_switch (file, pos, max, indent, sep, term, *p, "");
04950 }
04951 if (pos > 0)
04952 fprintf (file, "%s", term);
04953
04954
04955
04956
04957
04958 pos = print_single_switch (file, 0, max, indent, *indent ? " " : "", term,
04959 _("options enabled: "), "");
04960
04961 for (j = 0; j < ARRAY_SIZE (f_options); j++)
04962 if (*f_options[j].variable == f_options[j].on_value)
04963 pos = print_single_switch (file, pos, max, indent, sep, term,
04964 "-f", f_options[j].string);
04965
04966
04967
04968 for (j = 0; j < ARRAY_SIZE (target_switches); j++)
04969 if (target_switches[j].name[0] != '\0'
04970 && target_switches[j].value > 0
04971 && ((target_switches[j].value & target_flags)
04972 == target_switches[j].value))
04973 {
04974 pos = print_single_switch (file, pos, max, indent, sep, term,
04975 "-m", target_switches[j].name);
04976 }
04977
04978 #ifdef TARGET_OPTIONS
04979 for (j = 0; j < ARRAY_SIZE (target_options); j++)
04980 if (*target_options[j].variable != NULL)
04981 {
04982 char prefix[256];
04983 sprintf (prefix, "-m%s", target_options[j].prefix);
04984 pos = print_single_switch (file, pos, max, indent, sep, term,
04985 prefix, *target_options[j].variable);
04986 }
04987 #endif
04988
04989 fprintf (file, "%s", term);
04990 }
04991
04992
04993
04994
04995
04996 static void
04997 init_asm_output (name)
04998 const char *name;
04999 {
05000 #ifdef KEY
05001 asm_out_file = fopen ("/dev/null", "w");
05002 return;
05003 #endif // KEY
05004
05005 #ifdef SGI_MONGOOSE
05006 asm_out_file = NULL;
05007 #else
05008 if (name == NULL && asm_file_name == 0)
05009 asm_out_file = stdout;
05010 else
05011 {
05012 if (asm_file_name == 0)
05013 {
05014 int len = strlen (dump_base_name);
05015 char *dumpname = (char *) xmalloc (len + 6);
05016 memcpy (dumpname, dump_base_name, len + 1);
05017 strip_off_ending (dumpname, len);
05018 strcat (dumpname, ".s");
05019 asm_file_name = dumpname;
05020 }
05021 if (!strcmp (asm_file_name, "-"))
05022 asm_out_file = stdout;
05023 else
05024 asm_out_file = fopen (asm_file_name, "w");
05025 if (asm_out_file == 0)
05026 fatal_io_error ("can't open %s for writing", asm_file_name);
05027 }
05028
05029 #ifdef IO_BUFFER_SIZE
05030 setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
05031 _IOFBF, IO_BUFFER_SIZE);
05032 #endif
05033
05034 if (!flag_syntax_only)
05035 {
05036 #ifdef ASM_FILE_START
05037 ASM_FILE_START (asm_out_file);
05038 #endif
05039
05040 #ifdef ASM_COMMENT_START
05041 if (flag_verbose_asm)
05042 {
05043
05044 print_version (asm_out_file, ASM_COMMENT_START);
05045 print_switch_values (asm_out_file, 0, MAX_LINE,
05046 ASM_COMMENT_START, " ", "\n");
05047
05048
05049 fprintf (asm_out_file, "\n");
05050 }
05051 #endif
05052 }
05053 #endif
05054 }
05055
05056
05057
05058
05059 static void
05060 general_init (argv0)
05061 char *argv0;
05062 {
05063 char *p;
05064
05065 p = argv0 + strlen (argv0);
05066 while (p != argv0 && !IS_DIR_SEPARATOR (p[-1]))
05067 --p;
05068 progname = p;
05069
05070 xmalloc_set_program_name (progname);
05071
05072 hex_init ();
05073
05074 gcc_init_libintl ();
05075
05076
05077 #ifdef SIGSEGV
05078 signal (SIGSEGV, crash_signal);
05079 #endif
05080 #ifdef SIGILL
05081 signal (SIGILL, crash_signal);
05082 #endif
05083 #ifdef SIGBUS
05084 signal (SIGBUS, crash_signal);
05085 #endif
05086 #ifdef SIGABRT
05087 signal (SIGABRT, crash_signal);
05088 #endif
05089 #if defined SIGIOT && (!defined SIGABRT || SIGABRT != SIGIOT)
05090 signal (SIGIOT, crash_signal);
05091 #endif
05092 #ifdef SIGFPE
05093 signal (SIGFPE, crash_signal);
05094 #endif
05095
05096
05097
05098 diagnostic_initialize (global_dc);
05099
05100
05101
05102 init_ggc ();
05103 init_stringpool ();
05104 init_ttree ();
05105 }
05106
05107 #ifdef KEY
05108 extern int Opt_Level;
05109 #endif // KEY
05110
05111
05112
05113
05114
05115
05116
05117 static void
05118 parse_options_and_default_flags (argc, argv)
05119 int argc;
05120 char **argv;
05121 {
05122 int i;
05123
05124
05125 save_argc = argc;
05126 save_argv = argv;
05127
05128
05129 init_reg_sets ();
05130
05131
05132 add_params (lang_independent_params, LAST_PARAM);
05133
05134
05135 init_ggc_heuristics();
05136
05137
05138 (*lang_hooks.init_options) ();
05139
05140
05141
05142 for (i = 1; i < argc; i++)
05143 {
05144 if (!strcmp (argv[i], "-O"))
05145 {
05146 optimize = 1;
05147 optimize_size = 0;
05148 }
05149 else if (argv[i][0] == '-' && argv[i][1] == 'O')
05150 {
05151
05152 char *p = &argv[i][2];
05153
05154 #ifdef SGI_MONGOOSE
05155 if (!strncmp(p, "PT:", 3))
05156 {
05157 }
05158 else
05159 #endif
05160 if ((p[0] == 's') && (p[1] == 0))
05161 {
05162 optimize_size = 1;
05163
05164
05165 optimize = 2;
05166 }
05167 else
05168 {
05169 const int optimize_val = read_integral_parameter (p, p - 2, -1);
05170 if (optimize_val != -1)
05171 {
05172 optimize = optimize_val;
05173 optimize_size = 0;
05174 }
05175 }
05176 }
05177 }
05178
05179 #ifdef KEY
05180 Opt_Level = optimize;
05181 #endif
05182
05183 if (!optimize)
05184 {
05185 flag_merge_constants = 0;
05186 }
05187
05188 if (optimize >= 1)
05189 {
05190 flag_defer_pop = 1;
05191 flag_thread_jumps = 1;
05192 #ifdef DELAY_SLOTS
05193 flag_delayed_branch = 1;
05194 #endif
05195 #ifdef CAN_DEBUG_WITHOUT_FP
05196 flag_omit_frame_pointer = 1;
05197 #endif
05198 flag_guess_branch_prob = 1;
05199 flag_cprop_registers = 1;
05200 flag_loop_optimize = 1;
05201 flag_crossjumping = 1;
05202 flag_if_conversion = 1;
05203 flag_if_conversion2 = 1;
05204 }
05205
05206 if (optimize >= 2)
05207 {
05208 #ifndef KEY // Disable gcc's sibling call optimization because it may
05209
05210
05211
05212 flag_optimize_sibling_calls = 1;
05213 #endif
05214 flag_cse_follow_jumps = 1;
05215 flag_cse_skip_blocks = 1;
05216 flag_gcse = 1;
05217 flag_expensive_optimizations = 1;
05218 flag_strength_reduce = 1;
05219 flag_rerun_cse_after_loop = 1;
05220 flag_rerun_loop_opt = 1;
05221 flag_caller_saves = 1;
05222 flag_force_mem = 1;
05223 flag_peephole2 = 1;
05224 #ifdef INSN_SCHEDULING
05225 flag_schedule_insns = 1;
05226 flag_schedule_insns_after_reload = 1;
05227 #endif
05228 flag_regmove = 1;
05229 flag_strict_aliasing = 1;
05230 flag_delete_null_pointer_checks = 1;
05231 flag_reorder_blocks = 1;
05232 flag_reorder_functions = 1;
05233 }
05234
05235 if (optimize >= 3)
05236 {
05237 flag_inline_functions = 1;
05238 flag_rename_registers = 1;
05239 }
05240
05241 if (optimize < 2 || optimize_size)
05242 {
05243 align_loops = 1;
05244 align_jumps = 1;
05245 align_labels = 1;
05246 align_functions = 1;
05247
05248
05249
05250
05251
05252
05253
05254
05255 flag_reorder_blocks = 0;
05256 }
05257
05258
05259 flag_signed_char = DEFAULT_SIGNED_CHAR;
05260 #ifdef DEFAULT_SHORT_ENUMS
05261
05262 flag_short_enums = DEFAULT_SHORT_ENUMS;
05263 #endif
05264
05265
05266
05267 target_flags = 0;
05268 set_target_switch ("");
05269
05270
05271
05272 #ifdef IA64_UNWIND_INFO
05273 flag_unwind_tables = IA64_UNWIND_INFO;
05274 #endif
05275
05276 #ifdef OPTIMIZATION_OPTIONS
05277
05278 OPTIMIZATION_OPTIONS (optimize, optimize_size);
05279 #endif
05280
05281
05282 for (i = 1; i < argc;)
05283 {
05284 int lang_processed;
05285 int indep_processed;
05286
05287
05288 lang_processed = (*lang_hooks.decode_option) (argc - i, argv + i);
05289
05290 if (lang_processed >= 0) {
05291
05292
05293
05294 indep_processed = independent_decode_option (argc - i, argv + i);
05295
05296
05297 if (!key_exceptions)
05298 opt_regions = 0;
05299 }
05300 else
05301 {
05302 lang_processed = -lang_processed;
05303 indep_processed = 0;
05304 }
05305
05306 if (lang_processed || indep_processed)
05307 i += MAX (lang_processed, indep_processed);
05308 else
05309 {
05310 const char *option = NULL;
05311 const char *lang = NULL;
05312 unsigned int j;
05313
05314
05315
05316
05317
05318
05319
05320
05321 for (j = 0; j < ARRAY_SIZE (documented_lang_options); j++)
05322 {
05323 option = documented_lang_options[j].option;
05324
05325 if (option == NULL)
05326 lang = documented_lang_options[j].description;
05327 else if (! strncmp (argv[i], option, strlen (option)))
05328 break;
05329 }
05330
05331 if (j != ARRAY_SIZE (documented_lang_options))
05332 {
05333 if (extra_warnings)
05334 {
05335 warning ("ignoring command line option '%s'", argv[i]);
05336 if (lang)
05337 warning
05338 ("(it is valid for %s but not the selected language)",
05339 lang);
05340 }
05341 }
05342 else if (argv[i][0] == '-' && argv[i][1] == 'g')
05343 warning ("`%s': unknown or unsupported -g option", &argv[i][2]);
05344 else
05345 error ("unrecognized option `%s'", argv[i]);
05346
05347 i++;
05348 }
05349 }
05350
05351 #if 0
05352
05353 if (key_exceptions)
05354 {
05355 set_param_value ("max-inline-insns", 440);
05356 set_param_value ("max-inline-insns-single", 220);
05357 set_param_value ("min-inline-insns", 80);
05358 }
05359 #endif
05360
05361 if (flag_pie)
05362 flag_pic = flag_pie;
05363 if (flag_pic && !flag_pie)
05364 flag_shlib = 1;
05365
05366 if (flag_no_inline == 2)
05367 flag_no_inline = 0;
05368 else
05369 flag_really_no_inline = flag_no_inline;
05370
05371
05372
05373
05374
05375
05376 if (optimize == 0)
05377 {
05378
05379
05380 flag_no_inline = 1;
05381 warn_inline = 0;
05382
05383
05384
05385
05386 if (warn_uninitialized == 1)
05387 warning ("-Wuninitialized is not supported without -O");
05388 }
05389
05390 if (flag_really_no_inline == 2)
05391 flag_really_no_inline = flag_no_inline;
05392 }
05393
05394
05395 static void
05396 process_options ()
05397 {
05398 #ifdef OVERRIDE_OPTIONS
05399
05400 OVERRIDE_OPTIONS;
05401 #endif
05402
05403
05404
05405 if (align_loops <= 0) align_loops = 1;
05406 if (align_loops_max_skip > align_loops || !align_loops)
05407 align_loops_max_skip = align_loops - 1;
05408 align_loops_log = floor_log2 (align_loops * 2 - 1);
05409 if (align_jumps <= 0) align_jumps = 1;
05410 if (align_jumps_max_skip > align_jumps || !align_jumps)
05411 align_jumps_max_skip = align_jumps - 1;
05412 align_jumps_log = floor_log2 (align_jumps * 2 - 1);
05413 if (align_labels <= 0) align_labels = 1;
05414 align_labels_log = floor_log2 (align_labels * 2 - 1);
05415 if (align_labels_max_skip > align_labels || !align_labels)
05416 align_labels_max_skip = align_labels - 1;
05417 if (align_functions <= 0) align_functions = 1;
05418 align_functions_log = floor_log2 (align_functions * 2 - 1);
05419
05420
05421
05422 if (flag_unroll_all_loops)
05423 flag_unroll_loops = 1;
05424
05425
05426
05427
05428 if (flag_unroll_loops)
05429 {
05430 flag_strength_reduce = 1;
05431 flag_rerun_cse_after_loop = 1;
05432 }
05433
05434 if (flag_non_call_exceptions)
05435 flag_asynchronous_unwind_tables = 1;
05436 if (flag_asynchronous_unwind_tables)
05437 flag_unwind_tables = 1;
05438
05439
05440 #ifndef INSN_SCHEDULING
05441 if (flag_schedule_insns || flag_schedule_insns_after_reload)
05442 warning ("instruction scheduling not supported on this target machine");
05443 #endif
05444 #ifndef DELAY_SLOTS
05445 if (flag_delayed_branch)
05446 warning ("this target machine does not have delayed branches");
05447 #endif
05448
05449 user_label_prefix = USER_LABEL_PREFIX;
05450 if (flag_leading_underscore != -1)
05451 {
05452
05453
05454 if (user_label_prefix[0] == 0 ||
05455 (user_label_prefix[0] == '_' && user_label_prefix[1] == 0))
05456 {
05457 user_label_prefix = flag_leading_underscore ? "_" : "";
05458 }
05459 else
05460 warning ("-f%sleading-underscore not supported on this target machine",
05461 flag_leading_underscore ? "" : "no-");
05462 }
05463
05464
05465
05466 if (version_flag)
05467 {
05468 print_version (stderr, "");
05469 if (! quiet_flag)
05470 print_switch_values (stderr, 0, MAX_LINE, "", " ", "\n");
05471 }
05472
05473 if (! quiet_flag || flag_detailed_statistics)
05474 time_report = 1;
05475
05476 if (flag_syntax_only)
05477 {
05478 write_symbols = NO_DEBUG;
05479 profile_flag = 0;
05480 }
05481
05482
05483
05484 #if defined(DBX_DEBUGGING_INFO)
05485 if (write_symbols == DBX_DEBUG)
05486 debug_hooks = &dbx_debug_hooks;
05487 #endif
05488 #if defined(XCOFF_DEBUGGING_INFO)
05489 if (write_symbols == XCOFF_DEBUG)
05490 debug_hooks = &xcoff_debug_hooks;
05491 #endif
05492 #ifdef SDB_DEBUGGING_INFO
05493 if (write_symbols == SDB_DEBUG)
05494 debug_hooks = &sdb_debug_hooks;
05495 #endif
05496 #ifdef DWARF_DEBUGGING_INFO
05497 if (write_symbols == DWARF_DEBUG)
05498 debug_hooks = &dwarf_debug_hooks;
05499 #endif
05500 #ifdef DWARF2_DEBUGGING_INFO
05501 if (write_symbols == DWARF2_DEBUG)
05502 debug_hooks = &dwarf2_debug_hooks;
05503 #endif
05504 #ifdef VMS_DEBUGGING_INFO
05505 if (write_symbols == VMS_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG)
05506 debug_hooks = &vmsdbg_debug_hooks;
05507 #endif
05508
05509
05510
05511
05512 if (flag_gen_aux_info)
05513 {
05514 aux_info_file = fopen (aux_info_file_name, "w");
05515 if (aux_info_file == 0)
05516 fatal_io_error ("can't open %s", aux_info_file_name);
05517 }
05518
05519 if (! targetm.have_named_sections)
05520 {
05521 if (flag_function_sections)
05522 {
05523 warning ("-ffunction-sections not supported for this target");
05524 flag_function_sections = 0;
05525 }
05526 if (flag_data_sections)
05527 {
05528 warning ("-fdata-sections not supported for this target");
05529 flag_data_sections = 0;
05530 }
05531 }
05532
05533 if (flag_function_sections && profile_flag)
05534 {
05535 warning ("-ffunction-sections disabled; it makes profiling impossible");
05536 flag_function_sections = 0;
05537 }
05538
05539 #ifndef HAVE_prefetch
05540 if (flag_prefetch_loop_arrays)
05541 {
05542 warning ("-fprefetch-loop-arrays not supported for this target");
05543 flag_prefetch_loop_arrays = 0;
05544 }
05545 #else
05546 if (flag_prefetch_loop_arrays && !HAVE_prefetch)
05547 {
05548 warning ("-fprefetch-loop-arrays not supported for this target (try -march switches)");
05549 flag_prefetch_loop_arrays = 0;
05550 }
05551 #endif
05552
05553
05554
05555 if (flag_prefetch_loop_arrays && optimize_size)
05556 {
05557 warning ("-fprefetch-loop-arrays is not supported with -Os");
05558 flag_prefetch_loop_arrays = 0;
05559 }
05560
05561 #ifndef OBJECT_FORMAT_ELF
05562 if (flag_function_sections && write_symbols != NO_DEBUG)
05563 warning ("-ffunction-sections may affect debugging on some targets");
05564 #endif
05565
05566
05567 if (flag_signaling_nans)
05568 flag_trapping_math = 1;
05569 }
05570
05571
05572 static void
05573 backend_init ()
05574 {
05575
05576 #ifdef SGI_MONGOOSE
05577 if (parse_tree_dump) {
05578 open_dump_file (DFI_sgi_parse_tree, NULL);
05579 }
05580 #endif
05581
05582
05583
05584 init_regs ();
05585 init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
05586 || debug_info_level == DINFO_LEVEL_VERBOSE
05587 #ifdef VMS_DEBUGGING_INFO
05588
05589 || debug_info_level > DINFO_LEVEL_NONE
05590 #endif
05591 || flag_test_coverage
05592 || warn_notreached);
05593 init_fake_stack_mems ();
05594 init_alias_once ();
05595 init_loop ();
05596 init_reload ();
05597 init_function_once ();
05598 init_varasm_once ();
05599
05600
05601
05602 init_dummy_function_start ();
05603 init_expmed ();
05604 if (flag_caller_saves)
05605 init_caller_save ();
05606 expand_dummy_function_end ();
05607 }
05608
05609
05610 static int
05611 lang_dependent_init (name)
05612 const char *name;
05613 {
05614 if (dump_base_name == 0)
05615 dump_base_name = name ? name : "gccdump";
05616
05617
05618
05619
05620
05621 name = (*lang_hooks.init) (name);
05622 if (name == NULL)
05623 return 0;
05624
05625
05626 name = ggc_strdup (name);
05627 main_input_filename = input_filename = name;
05628 init_asm_output (name);
05629
05630
05631
05632 init_eh ();
05633 init_optabs ();
05634
05635
05636
05637 init_dummy_function_start ();
05638 init_expr_once ();
05639 expand_dummy_function_end ();
05640
05641
05642 push_srcloc (input_filename, 0);
05643
05644 #ifndef SGI_MONGOOSE
05645
05646
05647 timevar_push (TV_SYMOUT);
05648
05649 #ifdef DWARF2_UNWIND_INFO
05650 if (dwarf2out_do_frame ())
05651 dwarf2out_frame_init ();
05652 #endif
05653
05654
05655
05656 (*debug_hooks->init) (name);
05657
05658 timevar_pop (TV_SYMOUT);
05659 #endif
05660
05661 return 1;
05662 }
05663
05664
05665
05666 static void
05667 finalize ()
05668 {
05669
05670 if (flag_gen_aux_info)
05671 {
05672 fclose (aux_info_file);
05673 if (errorcount)
05674 unlink (aux_info_file_name);
05675 }
05676
05677
05678
05679
05680
05681 #ifndef SGI_MONGOOSE
05682 if (asm_out_file)
05683 {
05684 if (ferror (asm_out_file) != 0)
05685 fatal_io_error ("error writing to %s", asm_file_name);
05686 if (fclose (asm_out_file) != 0)
05687 fatal_io_error ("error closing %s", asm_file_name);
05688 }
05689 #endif
05690
05691
05692 if (graph_dump_format != no_graph)
05693 {
05694 int i;
05695
05696 for (i = 0; i < (int) DFI_MAX; ++i)
05697 if (dump_file[i].initialized && dump_file[i].graph_dump_p)
05698 {
05699 char seq[16];
05700 char *suffix;
05701
05702 sprintf (seq, DUMPFILE_FORMAT, i);
05703 suffix = concat (seq, dump_file[i].extension, NULL);
05704 finish_graph_dump_file (dump_base_name, suffix);
05705 free (suffix);
05706 }
05707 }
05708
05709 if (mem_report)
05710 {
05711 ggc_print_statistics ();
05712 stringpool_statistics ();
05713 dump_tree_statistics ();
05714 }
05715
05716
05717 free_reg_info ();
05718
05719
05720 (*lang_hooks.finish) ();
05721 }
05722
05723
05724
05725 #ifdef SGI_MONGOOSE
05726 static const char *
05727 do_init_compile ()
05728 {
05729
05730
05731 bool no_backend = (*lang_hooks.post_options) ();
05732
05733
05734 process_options ();
05735
05736
05737
05738 init_timevar ();
05739 timevar_start (TV_TOTAL);
05740
05741
05742
05743 #ifdef KEY
05744 backend_init ();
05745 #else
05746 lang_independent_init ();
05747 #endif // KEY
05748
05749
05750 if (lang_dependent_init (filename))
05751 return main_input_filename;
05752 }
05753 #endif
05754
05755 static void
05756 do_compile ()
05757 {
05758
05759
05760 bool no_backend = (*lang_hooks.post_options) ();
05761
05762
05763 process_options ();
05764
05765
05766 if (errorcount)
05767 return;
05768
05769 if (aux_base_name)
05770 ;
05771 else if (filename)
05772 {
05773 char *name = xstrdup (lbasename (filename));
05774
05775 aux_base_name = name;
05776 strip_off_ending (name, strlen (name));
05777 }
05778 else
05779 aux_base_name = "gccaux";
05780
05781
05782
05783 init_timevar ();
05784 timevar_start (TV_TOTAL);
05785
05786
05787 if (!no_backend)
05788 backend_init ();
05789
05790
05791 if (lang_dependent_init (filename))
05792 #ifndef SGI_MONGOOSE
05793
05794 compile_file ();
05795 #else
05796 ;
05797 #endif
05798
05799 finalize ();
05800
05801
05802 timevar_stop (TV_TOTAL);
05803 timevar_print (stderr);
05804 }
05805
05806
05807
05808
05809
05810
05811
05812
05813 #ifdef SGI_MONGOOSE
05814 const char *
05815 gnu_init (argc, argv)
05816 int argc;
05817 char **argv;
05818 #else
05819 int
05820 toplev_main (argc, argv)
05821 int argc;
05822 char **argv;
05823 #endif
05824 {
05825
05826 general_init (argv[0]);
05827
05828
05829
05830 parse_options_and_default_flags (argc, argv);
05831
05832
05833 if (!exit_after_options)
05834 #ifndef SGI_MONGOOSE
05835 do_compile ();
05836 #else
05837 return do_init_compile();
05838 #endif
05839
05840 if (errorcount || sorrycount)
05841 return (const char *)(FATAL_EXIT_CODE);
05842
05843 return (const char *)(SUCCESS_EXIT_CODE);
05844 }