aboutsummaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c265
1 files changed, 235 insertions, 30 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 2a3b5ec73ec..b74f5f843c4 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -108,6 +108,8 @@ static void init_asm_output (const char *);
static void finalize (void);
static void crash_signal (int) ATTRIBUTE_NORETURN;
+/* APPLE LOCAL interrupt signal handler (radar 2941633) ilr */
+static void interrupt_signal (int) ATTRIBUTE_NORETURN;
static void setup_core_dumping (void);
static void compile_file (void);
@@ -139,6 +141,11 @@ static const char **save_argv;
const char *main_input_filename;
+/* APPLE LOCAL fat builds */
+/* for radar 2865464 ilr */
+static int arch_specified = 0;
+/* APPLE LOCAL end fat builds */
+
/* Current position in real source file. */
location_t input_location;
@@ -255,6 +262,13 @@ int flag_branch_probabilities = 0;
int flag_reorder_blocks = 0;
+/* APPLE LOCAL begin hot/cold partitioning */
+/* Nonzero if blocks should be partitioned into hot and cold sections in
+ addition to being reordered. */
+
+int flag_reorder_blocks_and_partition = 0;
+/* APPLE LOCAL end hot/cold partitioning */
+
/* Nonzero if functions should be reordered. */
int flag_reorder_functions = 0;
@@ -309,12 +323,25 @@ int flag_signed_char;
int flag_short_enums;
+/* APPLE LOCAL begin -fast */
+/* Nonzero if we should perform SPEC oriented optimizations. */
+int flag_fast = 0;
+int flag_fastf = 0;
+int flag_fastcp = 0;
+/* APPLE LOCAL end -fast */
+
/* Nonzero for -fcaller-saves: allocate values in regs that need to
be saved across function calls, if that produces overall better code.
Optional now, so people can test it. */
int flag_caller_saves = 0;
+/* APPLE LOCAL begin -ffppc 2001-08-01 sts */
+/* Nonzero if the floating point precision control pass should
+ be performed. (x86 only really, but we pretend it's generic) */
+int flag_fppc = 0;
+/* APPLE LOCAL end -ffppc 2001-08-01 sts */
+
/* Nonzero if structures and unions should be returned in memory.
This should only be defined if compatibility with another compiler or
@@ -370,22 +397,10 @@ int flag_thread_jumps;
int flag_strength_reduce = 0;
-/* Nonzero enables loop unrolling in unroll.c. Only loops for which the
- number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
- UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
- unrolled. */
-
-int flag_old_unroll_loops;
-
-/* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
- This is generally not a win. */
-
-int flag_old_unroll_all_loops;
-
-/* Enables unrolling of simple loops in loop-unroll.c. */
+/* Enables unrolling of simple loops. */
int flag_unroll_loops;
-/* Enables unrolling of all loops in loop-unroll.c. */
+/* Enables unrolling of all loops. */
int flag_unroll_all_loops;
/* Nonzero enables loop peeling. */
@@ -494,6 +509,10 @@ int flag_web;
int flag_loop_optimize;
+/* Nonzero means perform second pass of the loop optimizer. */
+
+int flag_loop_optimize2;
+
/* Nonzero means perform crossjumping. */
int flag_crossjumping;
@@ -564,6 +583,13 @@ int flag_rerun_loop_opt;
int flag_inline_functions;
+/* APPLE LOCAL begin -fobey-inline */
+/* Nonzero for -fobey-inline: 'inline' keyword must be obeyed, regardless
+ of codesize. */
+
+int flag_obey_inline;
+/* APPLE LOCAL end -fobey-inline */
+
/* Nonzero for -fkeep-inline-functions: even if we make a function
go inline everywhere, keep its definition around for debugging
purposes. */
@@ -813,6 +839,24 @@ int flag_tree_ccp = 0;
/* Enable SSA-DCE on trees. */
int flag_tree_dce = 0;
+/* Enable the analysis of the scalar evolutions on trees. */
+int flag_scalar_evolutions = 0;
+
+/* Enable the analysis of all data dependences. */
+int flag_all_data_deps = 0;
+
+/* Enable data dependence graph. */
+int flag_ddg = 0;
+
+/* Enable the elimination of checks on trees. */
+int flag_tree_elim_checks = 0;
+
+/* Enable linear loop transforms on trees. */
+int flag_tree_loop_linear = 0;
+
+/* Enable loop vectorization on trees */
+int flag_tree_vectorize = 0;
+
/* Enable loop header copying on tree-ssa. */
int flag_tree_ch = 0;
@@ -840,10 +884,21 @@ int flag_tree_dse = 0;
/* Nonzero if we perform superblock formation. */
int flag_tracer = 0;
+/* APPLE LOCAL begin loop transposition */
+/* Nonzero if we should perform automatic loop transposition. */
+int flag_loop_transpose = 0;
+/* APPLE LOCAL end loop transposition */
+
/* Nonzero if we perform whole unit at a time compilation. */
int flag_unit_at_a_time = 0;
+/* APPLE LOCAL BEGIN pch distcc mrs */
+/* True if PCH should omit from the -E output all lines from PCH files
+ found in PCH files. */
+int flag_pch_preprocess = 0;
+/* APPLE LOCAL END pch distcc mrs */
+
/* Nonzero if we should track variables. When
flag_var_tracking == AUTODETECT_FLAG_VAR_TRACKING it will be set according
to optimize, debug_info_level and debug_hooks in process_options (). */
@@ -892,6 +947,31 @@ int flag_evaluation_order = 0;
/* Add or remove a leading underscore from user symbols. */
int flag_leading_underscore = -1;
+/* APPLE LOCAL begin coalescing turly 20020319 */
+/* Don't enable coalescing by default unless we have one of these
+ features in cctools. */
+#if defined(APPLE_WEAK_SECTION_ATTRIBUTE) || defined(APPLE_WEAK_ASSEMBLER_DIRECTIVE)
+#define COALESCE_BY_DEFAULT 1
+#else
+#define COALESCE_BY_DEFAULT 0
+#endif
+/* Nonzero means that certain data and code items can be marked as
+ coalesced, which is a lesser form of ELF weak symbols. */
+int flag_coalescing_enabled = COALESCE_BY_DEFAULT;
+
+/* Nonzero means mark template instantiations as coalesced. */
+int flag_coalesce_templates = COALESCE_BY_DEFAULT;
+
+/* Nonzero means use the OS X 10.2 "weak_definitions" section attribute.
+ If this is set, then explicit template instantiations DO NOT get
+ coalesced, but are plain old text or data instead. */
+int flag_weak_coalesced_definitions = COALESCE_BY_DEFAULT;
+
+/* Coalesced symbols are private export by default. This EXPERIMENTAL
+ flag will make them global instead. */
+int flag_export_coalesced = 0;
+/* APPLE LOCAL end coalescing turly 20020319 */
+
/* The version of the C++ ABI in use. The following values are
allowed:
@@ -942,10 +1022,9 @@ static const lang_independent_options f_options[] =
{"expensive-optimizations", &flag_expensive_optimizations, 1 },
{"thread-jumps", &flag_thread_jumps, 1 },
{"strength-reduce", &flag_strength_reduce, 1 },
+ {"loop-transpose", &flag_loop_transpose, 1, },
{"unroll-loops", &flag_unroll_loops, 1 },
{"unroll-all-loops", &flag_unroll_all_loops, 1 },
- {"old-unroll-loops", &flag_old_unroll_loops, 1 },
- {"old-unroll-all-loops", &flag_old_unroll_all_loops, 1 },
{"peel-loops", &flag_peel_loops, 1 },
{"unswitch-loops", &flag_unswitch_loops, 1 },
{"prefetch-loop-arrays", &flag_prefetch_loop_arrays, 1 },
@@ -958,6 +1037,8 @@ static const lang_independent_options f_options[] =
{"inline-functions", &flag_inline_functions, 1 },
{"keep-inline-functions", &flag_keep_inline_functions, 1 },
{"inline", &flag_no_inline, 0 },
+ /* APPLE LOCAL -fobey-inline */
+ {"obey-inline", &flag_obey_inline, 1, },
{"keep-static-consts", &flag_keep_static_consts, 1 },
{"syntax-only", &flag_syntax_only, 1 },
{"shared-data", &flag_shared_data, 1 },
@@ -1008,6 +1089,7 @@ static const lang_independent_options f_options[] =
{"profile", &profile_flag, 1 },
{"tree-based-profiling", &flag_tree_based_profiling, 1 },
{"reorder-blocks", &flag_reorder_blocks, 1 },
+ {"reorder-blocks-and-partition", &flag_reorder_blocks_and_partition, 1},
{"reorder-functions", &flag_reorder_functions, 1 },
{"rename-registers", &flag_rename_registers, 1 },
{"cprop-registers", &flag_cprop_registers, 1 },
@@ -1049,19 +1131,33 @@ static const lang_independent_options f_options[] =
{"mem-report", &mem_report, 1 },
{ "trapv", &flag_trapv, 1 },
{ "wrapv", &flag_wrapv, 1 },
+ /* APPLE LOCAL -ffppc 2001-08-01 sts */
+ { "fppc", &flag_fppc, 1 },
+ /* APPLE LOCAL begin coalescing turly */
+ { "coalesce", &flag_coalescing_enabled, 1 },
+ { "weak-coalesced", &flag_weak_coalesced_definitions, 1 },
+ { "coalesce-templates", &flag_coalesce_templates, 1 },
+ { "export-coalesced", &flag_export_coalesced, 1 },
+ /* APPLE LOCAL end coalescing turly */
{ "new-ra", &flag_new_regalloc, 1 },
{ "var-tracking", &flag_var_tracking, 1},
{ "tree-gvn", &flag_tree_gvn, 1 },
{ "tree-pre", &flag_tree_pre, 1 },
{ "tree-ccp", &flag_tree_ccp, 1 },
{ "tree-dce", &flag_tree_dce, 1 },
+ { "scalar-evolutions", &flag_scalar_evolutions, 1 },
+ { "all-data-deps", &flag_all_data_deps, 1 },
+ { "tree-elim-checks", &flag_tree_elim_checks, 1 },
+ { "tree-ddg", &flag_ddg, 1 },
{ "tree-dominator-opts", &flag_tree_dom, 1 },
{ "tree-copyrename", &flag_tree_copyrename, 1 },
{ "tree-dse", &flag_tree_dse, 1 },
{ "tree-combine-temps", &flag_tree_combine_temps, 1 },
{ "tree-ter", &flag_tree_ter, 1 },
{ "tree-ch", &flag_tree_ch, 1 },
- { "tree-loop-optimize", &flag_tree_loop, 1 }
+ { "tree-loop-optimize", &flag_tree_loop, 1 },
+ { "tree-loop-linear", &flag_tree_loop_linear, 1},
+ { "tree-vectorize", &flag_tree_vectorize, 1}
};
/* Here is a table, controlled by the tm.h file, listing each -m switch
@@ -1253,6 +1349,31 @@ floor_log2_wide (unsigned HOST_WIDE_INT x)
return log;
}
+/* APPLE LOCAL begin interrupt signal handler (radar 2941633) ilr */
+/* If the compilation is interrupted do some cleanup. Any files created
+ by the compilation are deleted. The compilation is terminated from
+ here. */
+static void
+interrupt_signal (int signo ATTRIBUTE_UNUSED)
+{
+ /* Close the dump files. */
+ if (flag_gen_aux_info)
+ {
+ fclose (aux_info_file);
+ unlink (aux_info_file_name);
+ }
+
+ if (asm_out_file)
+ {
+ fclose (asm_out_file);
+ if (asm_file_name && *asm_file_name)
+ unlink (asm_file_name);
+ }
+
+ exit (FATAL_EXIT_CODE);
+}
+/* APPLE LOCAL end interrupt signal handler */
+
/* Handler for fatal signals, such as SIGSEGV. These are transformed
into ICE messages, which is much more user friendly. In case the
error printer crashes, reset the signal to prevent infinite recursion. */
@@ -1575,6 +1696,46 @@ warn_deprecated_use (tree node)
}
}
+/* APPLE LOCAL begin unavailable ilr */
+/* Warn about a use of an identifier which was marked deprecated. */
+void
+warn_unavailable_use (tree node)
+{
+ if (node == 0)
+ return;
+
+ if (DECL_P (node))
+ warning ("`%s' is unavailable (declared at %s:%d)",
+ IDENTIFIER_POINTER (DECL_NAME (node)),
+ DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node));
+ else if (TYPE_P (node))
+ {
+ const char *what = NULL;
+ tree decl = TYPE_STUB_DECL (node);
+
+ if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
+ what = IDENTIFIER_POINTER (TYPE_NAME (node));
+ else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
+ && DECL_NAME (TYPE_NAME (node)))
+ what = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node)));
+
+ if (what)
+ {
+ if (decl)
+ warning ("`%s' is unavailable (declared at %s:%d)", what,
+ DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
+ else
+ warning ("`%s' is unavailable", what);
+ }
+ else if (decl)
+ warning ("type is unavailable (declared at %s:%d)",
+ DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
+ else
+ warning ("type is unavailable");
+ }
+}
+/* APPLE LOCAL end unavailable ilr */
+
/* Save the current INPUT_LOCATION on the top entry in the
INPUT_FILE_STACK. Push a new entry for FILE and LINE, and set the
INPUT_LOCATION accordingly. */
@@ -1849,7 +2010,12 @@ set_target_switch (const char *name)
}
#endif
- if (!valid_target_option)
+ /* APPLE LOCAL begin fat builds */
+ /* Note, the driver guarantees that -arch will precede the -m
+ options so that arch_specified will be known by the time we get
+ here. For Radar 2865464. */
+ if (!valid_target_option && !arch_specified)
+ /* APPLE LOCAL end fat builds */
error ("invalid option `%s'", name);
}
@@ -1942,6 +2108,18 @@ print_switch_values (FILE *file, int pos, int max,
continue;
if ((*p)[1] == 'd')
continue;
+ /* APPLE LOCAL begin -fast or -fastf or -fastcp */
+ if ((flag_fast || flag_fastf || flag_fastcp)
+ && (*p)[0] == '-' && (*p)[1] == 'O')
+ {
+ int optimize_val;
+ if ((*p)[2] == 's' && (*p)[3] == '\0')
+ continue;
+ optimize_val = read_integral_parameter (*p+2, 0, -1);
+ if (optimize_val != 3)
+ continue;
+ }
+ /* APPLE LOCAL end -fast or -fastf or -fastcp */
pos = print_single_switch (file, pos, max, indent, sep, term, *p, "");
}
@@ -1957,8 +2135,15 @@ print_switch_values (FILE *file, int pos, int max,
for (j = 0; j < ARRAY_SIZE (f_options); j++)
if (*f_options[j].variable == f_options[j].on_value)
- pos = print_single_switch (file, pos, max, indent, sep, term,
- "-f", f_options[j].string);
+ /* APPLE LOCAL begin 3372156 */
+ /* FSF candidate */
+ {
+ char value[256];
+ sprintf (value, "-f%s=%d", f_options[j].string,f_options[j].on_value);
+ pos = print_single_switch (file, pos, max, indent, sep, term,
+ "", value);
+ }
+ /* APPLE LOCAL end 3372156 */
/* Print target specific options. */
@@ -2220,6 +2405,15 @@ general_init (const char *argv0)
#if defined SIGIOT && (!defined SIGABRT || SIGABRT != SIGIOT)
signal (SIGIOT, crash_signal);
#endif
+ /* APPLE LOCAL begin interrupt signal handler (radar 2941633) ilr */
+ /* Handle compilation interrupts. */
+ if (signal (SIGINT, SIG_IGN) != SIG_IGN)
+ signal (SIGINT, interrupt_signal);
+ if (signal (SIGKILL, SIG_IGN) != SIG_IGN)
+ signal (SIGINT, interrupt_signal);
+ if (signal (SIGTERM, SIG_IGN) != SIG_IGN)
+ signal (SIGTERM, interrupt_signal);
+ /* APPLE LOCAL end interrupt signal handler */
#ifdef SIGFPE
signal (SIGFPE, crash_signal);
#endif
@@ -2227,6 +2421,22 @@ general_init (const char *argv0)
/* Other host-specific signal setup. */
(*host_hooks.extra_signals)();
+ /* APPLE LOCAL begin setrlimit */
+#ifdef RLIMIT_STACK
+ /* Get rid of any avoidable limit on stack size. */
+ {
+ struct rlimit rlim;
+
+ /* Set the stack limit huge. (Compiles normally work within
+ a megabyte of stack, but the normal limit on OSX is 512K for
+ some reason.) */
+ getrlimit (RLIMIT_STACK, &rlim);
+ rlim.rlim_cur = rlim.rlim_max;
+ setrlimit (RLIMIT_STACK, &rlim);
+ }
+#endif /* RLIMIT_STACK defined */
+ /* APPLE LOCAL end setrlimit */
+
/* Initialize the garbage-collector, string pools and tree type hash
table. */
init_ggc ();
@@ -2296,25 +2506,19 @@ process_options (void)
if (flag_unroll_all_loops)
flag_unroll_loops = 1;
- if (flag_unroll_loops)
- {
- flag_old_unroll_loops = 0;
- flag_old_unroll_all_loops = 0;
- }
-
- if (flag_old_unroll_all_loops)
- flag_old_unroll_loops = 1;
+ if (flag_loop_optimize2)
+ flag_loop_optimize = 0;
/* Old loop unrolling requires that strength_reduction be on also. Silently
turn on strength reduction here if it isn't already on. Also, the loop
unrolling code assumes that cse will be run after loop, so that must
be turned on also. */
- if (flag_old_unroll_loops)
+ if (flag_unroll_loops)
{
flag_strength_reduce = 1;
flag_rerun_cse_after_loop = 1;
}
- if (flag_unroll_loops || flag_peel_loops)
+ if (flag_peel_loops)
flag_rerun_cse_after_loop = 1;
if (flag_non_call_exceptions)
@@ -2534,6 +2738,7 @@ lang_dependent_init (const char *name)
provide a dummy function context for them. */
init_dummy_function_start ();
init_expr_once ();
+ init_set_costs ();
expand_dummy_function_end ();
/* If dbx symbol table desired, initialize writing it and output the