location_t input_location;
-struct line_maps line_table;
+struct line_maps *line_table;
/* Stack of currently pending input files. */
const char *aux_base_name;
-/* Bit flags that specify the machine subtype we are compiling for.
- Bits are tested using macros TARGET_... defined in the tm.h file
- and set by `-m...' switches. Must be defined in rtlanal.c. */
-
-extern int target_flags;
-
/* A mask of target_flags that includes bit X if X was set or cleared
on the command line. */
fprintf (stderr, " %s", lang_hooks.decl_printable_name (decl, 2));
fflush (stderr);
pp_needs_newline (global_dc->printer) = true;
- diagnostic_set_last_function (global_dc);
+ diagnostic_set_last_function (global_dc, (diagnostic_info *) NULL);
}
}
string is patterned after the ones produced by native SVR4 compilers. */
#ifdef IDENT_ASM_OP
if (!flag_no_ident)
- fprintf (asm_out_file, "%s\"GCC: (GNU) %s\"\n",
- IDENT_ASM_OP, version_string);
+ {
+ const char *pkg_version = "(GNU) ";
+
+ if (strcmp ("(GCC) ", pkgversion_string))
+ pkg_version = pkgversion_string;
+ fprintf (asm_out_file, "%s\"GCC: %s%s\"\n",
+ IDENT_ASM_OP, pkg_version, version_string);
+ }
#endif
/* This must be at the end. Some target ports emit end of file directives
{
static const char fmt1[] =
#ifdef __GNUC__
- N_("%s%s%s version %s (%s)\n%s\tcompiled by GNU C version %s, ")
+ N_("%s%s%s %sversion %s (%s)\n%s\tcompiled by GNU C version %s, ")
#else
- N_("%s%s%s version %s (%s) compiled by CC, ")
+ N_("%s%s%s %sversion %s (%s) compiled by CC, ")
#endif
;
static const char fmt2[] =
fprintf (file,
file == stderr ? _(fmt1) : fmt1,
indent, *indent != 0 ? " " : "",
- lang_hooks.name, version_string, TARGET_NAME,
+ lang_hooks.name, pkgversion_string, version_string, TARGET_NAME,
indent, __VERSION__);
/* We need to stringify the GMP macro values. Ugh, gmp_version has
return true;
}
+/* A helper function; used as the reallocator function for cpp's line
+ table. */
+static void *
+realloc_for_line_map (void *ptr, size_t len)
+{
+ return ggc_realloc (ptr, len);
+}
+
/* Initialization of the front end environment, before command line
options are parsed. Signal handlers, internationalization etc.
ARGV0 is main's argv[0]. */
table. */
init_ggc ();
init_stringpool ();
- linemap_init (&line_table);
+ line_table = GGC_NEW (struct line_maps);
+ linemap_init (line_table);
+ line_table->reallocator = realloc_for_line_map;
init_ttree ();
/* Initialize register usage now so switches may override. */
return true;
}
+/* Default the align_* variables to 1 if they're still unset, and
+ set up the align_*_log variables. */
+static void
+init_alignments (void)
+{
+ if (align_loops <= 0)
+ align_loops = 1;
+ if (align_loops_max_skip > align_loops)
+ align_loops_max_skip = align_loops - 1;
+ align_loops_log = floor_log2 (align_loops * 2 - 1);
+ if (align_jumps <= 0)
+ align_jumps = 1;
+ if (align_jumps_max_skip > align_jumps)
+ align_jumps_max_skip = align_jumps - 1;
+ align_jumps_log = floor_log2 (align_jumps * 2 - 1);
+ if (align_labels <= 0)
+ align_labels = 1;
+ align_labels_log = floor_log2 (align_labels * 2 - 1);
+ if (align_labels_max_skip > align_labels)
+ align_labels_max_skip = align_labels - 1;
+ if (align_functions <= 0)
+ align_functions = 1;
+ align_functions_log = floor_log2 (align_functions * 2 - 1);
+}
+
/* Process the options that have been parsed. */
static void
process_options (void)
else
aux_base_name = "gccaux";
- /* Set up the align_*_log variables, defaulting them to 1 if they
- were still unset. */
- if (align_loops <= 0) align_loops = 1;
- if (align_loops_max_skip > align_loops || !align_loops)
- align_loops_max_skip = align_loops - 1;
- align_loops_log = floor_log2 (align_loops * 2 - 1);
- if (align_jumps <= 0) align_jumps = 1;
- if (align_jumps_max_skip > align_jumps || !align_jumps)
- align_jumps_max_skip = align_jumps - 1;
- align_jumps_log = floor_log2 (align_jumps * 2 - 1);
- if (align_labels <= 0) align_labels = 1;
- align_labels_log = floor_log2 (align_labels * 2 - 1);
- if (align_labels_max_skip > align_labels || !align_labels)
- align_labels_max_skip = align_labels - 1;
- if (align_functions <= 0) align_functions = 1;
- align_functions_log = floor_log2 (align_functions * 2 - 1);
-
/* Unrolling all loops implies that standard loop unrolling must also
be done. */
if (flag_unroll_all_loops)
if (flag_asynchronous_unwind_tables)
flag_unwind_tables = 1;
- /* Disable unit-at-a-time mode for frontends not supporting callgraph
- interface. */
- if (flag_unit_at_a_time && ! lang_hooks.callgraph.expand_function)
- flag_unit_at_a_time = 0;
-
if (!flag_unit_at_a_time)
flag_section_anchors = 0;
if (flag_var_tracking == AUTODETECT_VALUE)
flag_var_tracking = optimize >= 1;
+ if (flag_tree_cselim == AUTODETECT_VALUE)
+#ifdef HAVE_conditional_move
+ flag_tree_cselim = 1;
+#else
+ flag_tree_cselim = 0;
+#endif
+
/* If the user specifically requested variable tracking with tagging
uninitialized variables, we need to turn on variable tracking.
(We already determined above that variable tracking is feasible.) */
}
}
-/* Initialize the compiler back end. */
+/* This function can be called multiple times to reinitialize the compiler
+ back end when register classes or instruction sets have changed,
+ before each function. */
+static void
+backend_init_target (void)
+{
+ /* Initialize alignment variables. */
+ init_alignments ();
+
+ /* This reinitializes hard_frame_pointer, and calls init_reg_modes_target()
+ to initialize reg_raw_mode[]. */
+ init_emit_regs ();
+
+ /* This invokes target hooks to set fixed_reg[] etc, which is
+ mode-dependent. */
+ init_regs ();
+
+ /* This depends on stack_pointer_rtx. */
+ init_fake_stack_mems ();
+
+ /* Sets static_base_value[HARD_FRAME_POINTER_REGNUM], which is
+ mode-dependent. */
+ init_alias_target ();
+
+ /* Depends on HARD_FRAME_POINTER_REGNUM. */
+ init_reload ();
+
+ /* The following initialization functions need to generate rtl, so
+ provide a dummy function context for them. */
+ init_dummy_function_start ();
+
+ /* rtx_cost is mode-dependent, so cached values need to be recomputed
+ on a mode change. */
+ init_expmed ();
+
+ /* We may need to recompute regno_save_code[] and regno_restore_code[]
+ after a mode change as well. */
+ if (flag_caller_saves)
+ init_caller_save ();
+ expand_dummy_function_end ();
+}
+
+/* Initialize the compiler back end. This function is called only once,
+ when starting the compiler. */
static void
backend_init (void)
{
|| flag_test_coverage);
init_rtlanal ();
- init_regs ();
- init_fake_stack_mems ();
- init_alias_once ();
init_inline_once ();
- init_reload ();
init_varasm_once ();
+ save_register_info ();
+
+ /* Initialize the target-specific back end pieces. */
+ backend_init_target ();
+}
+
+/* Initialize things that are both lang-dependent and target-dependent.
+ This function can be called more than once if target parameters change. */
+static void
+lang_dependent_init_target (void)
+{
+ /* This creates various _DECL nodes, so needs to be called after the
+ front end is initialized. It also depends on the HAVE_xxx macros
+ generated from the target machine description. */
+ init_optabs ();
/* The following initialization functions need to generate rtl, so
provide a dummy function context for them. */
init_dummy_function_start ();
- init_expmed ();
- if (flag_caller_saves)
- init_caller_save ();
+
+ /* Do the target-specific parts of expr initialization. */
+ init_expr_target ();
+
+ /* Although the actions of init_set_costs are language-independent,
+ it uses optabs, so we cannot call it from backend_init. */
+ init_set_costs ();
+
expand_dummy_function_end ();
}
init_asm_output (name);
- /* These create various _DECL nodes, so need to be called after the
+ /* This creates various _DECL nodes, so needs to be called after the
front end is initialized. */
init_eh ();
- init_optabs ();
- /* The following initialization functions need to generate rtl, so
- provide a dummy function context for them. */
- init_dummy_function_start ();
- init_expr_once ();
-
- /* Although the actions of init_set_costs are language-independent,
- it uses optabs, so we cannot call it from backend_init. */
- init_set_costs ();
-
- expand_dummy_function_end ();
+ /* Do the target-specific parts of the initialization. */
+ lang_dependent_init_target ();
/* If dbx symbol table desired, initialize writing it and output the
predefined types. */
return 1;
}
+
+/* Reinitialize everything when target parameters, such as register usage,
+ have changed. */
+void
+target_reinit (void)
+{
+ /* Reinitialize RTL backend. */
+ backend_init_target ();
+
+ /* Reinitialize lang-dependent parts. */
+ lang_dependent_init_target ();
+}
+
void
dump_memory_report (bool final)
{