GCC Middle and Back End API Reference
toplev.c File Reference

Functions

static void general_init (const char *)
static void do_compile (void)
static void process_options (void)
static void backend_init (void)
static int lang_dependent_init (const char *)
static void init_asm_output (const char *)
static void finalize (bool)
static void crash_signal (int)
const char * get_src_pwd ()
void announce_function ()
static void init_local_tick ()
static void init_random_seed ()
HOST_WIDE_INT get_random_seed ()
const char * set_random_seed ()
static void crash_signal ()
void wrapup_global_declaration_1 ()
bool wrapup_global_declaration_2 ()
bool wrapup_global_declarations ()
void check_global_declaration_1 ()
void check_global_declarations ()
void emit_debug_global_declarations ()
static void compile_file ()
void print_version ()
static int print_to_asm_out_file ()
static int print_to_stderr ()
static int print_single_switch (print_switch_fn_type print_fn, int pos, print_switch_type type, const char *text)
static void print_switch_values ()
static void init_asm_output ()
static void * realloc_for_line_map ()
static void * alloc_for_identifier_to_locale ()
void output_stack_usage ()
static FILE * open_auxiliary_file ()
static void general_init ()
static bool target_supports_section_anchors_p ()
static void init_alignments ()
static void backend_init_target ()
static void init_excess_precision ()
static void lang_dependent_init_target ()
static int lang_dependent_init ()
void target_reinit ()
void dump_memory_report ()
static void finalize ()
int toplev_main ()

Function Documentation

static void* alloc_for_identifier_to_locale ( )
static
A helper function: used as the allocator function for
   identifier_to_locale.   

Referenced by general_init().

void announce_function ( )
Called when the start of a function definition is parsed,
   this function prints on stderr the name of the function.   

References lang_hooks::decl_printable_name, global_dc, identifier_to_locale(), and diagnostic_context::printer.

Referenced by expand_function().

static void backend_init ( )
static
Initialize the compiler back end.  This function is called only once,
   when starting the compiler.   

References backend_init_target(), init_emit_once(), init_inline_once(), init_rtlanal(), init_varasm_once(), ira_init_once(), and save_register_info().

Referenced by do_compile().

static void backend_init_target ( )
static
This function can be called multiple times to reinitialize the compiler
   back end when register classes or instruction sets have changed,
   before each function.   

References expand_dummy_function_end(), init_alias_target(), init_alignments(), init_dummy_function_start(), init_emit_regs(), init_expmed(), init_fake_stack_mems(), init_lower_subreg(), init_regs(), and init_reload().

Referenced by backend_init(), and target_reinit().

void check_global_declaration_1 ( )
A subroutine of check_global_declarations.  Issue appropriate warnings
   for the global declaration DECL.   

References lang_hooks::decls, input_location, pedwarn(), lang_hooks_for_decls::warn_unused_global, and warning().

Referenced by check_global_declarations().

void check_global_declarations ( )
Issue appropriate warnings for the global declarations in V (of
   which there are LEN).   

References check_global_declaration_1(), and len.

Referenced by write_global_declarations().

static void crash_signal ( int  )
static
                       @verbatim Initialize src_pwd with the given string, and return true.  If it

was already initialized, return false. As a special case, it may be called with a NULL argument to test whether src_pwd has NOT been initialized yet.

References asm_out_file, current_function_decl, current_function_func_begin_label, debug_hooks, default_target_flag_state, local_tick, save_decoded_options, save_decoded_options_count, stack_limit_rtx, this_target_flag_state, user_defined_section_attribute, and user_label_prefix.

Referenced by general_init().

static void crash_signal ( )
static
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.   

References internal_error(), output_operand_lossage(), strsignal(), and this_is_asm_operands.

void emit_debug_global_declarations ( )
Emit debugging information for all global declarations in VEC.   

References gcc_debug_hooks::global_decl, len, seen_error(), timevar_pop(), and timevar_push().

Referenced by write_global_declarations().

static void finalize ( bool  )
static

Referenced by do_compile().

static void general_init ( const char *  )
static
@verbatim Top level of GCC compilers (cc1, cc1plus, etc.)

Copyright (C) 1987-2013 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.

This is the top level of cc1/c++.
   It parses command args, opens files, invokes the various passes
   in the proper order, and counts the time used by each.
   Error messages and low-level interface to malloc also handled here.   

Referenced by toplev_main().

HOST_WIDE_INT get_random_seed ( )
Obtain the random_seed.  Unless NOINIT, initialize it if
   it's not provided in the command line.   

References init_random_seed().

Referenced by get_file_function_name(), and lto_get_section_name().

const char* get_src_pwd ( void  )
Return the directory from which the translation unit was initiated,
   in case set_src_pwd() was not called before to assign it a
   different value.   

Referenced by comp_dir_string(), and dbxout_init().

static void init_alignments ( )
static
Default the align_* variables to 1 if they're still unset, and
   set up the align_*_log variables.   

References floor_log2().

Referenced by backend_init_target().

static void init_asm_output ( const char *  )
static

Referenced by lang_dependent_init().

static void init_asm_output ( )
static
Open assembly code output file.  Do this even if -fsyntax-only is
   on, because then the driver will have provided the name of a
   temporary file or bit bucket for us.  NAME is the file specified on
   the command line, possibly NULL.   

References fatal_error(), inform(), input_location, len, memcpy(), print_switch_values(), print_to_asm_out_file(), print_version, strip_off_ending(), strlen(), SWITCH_TYPE_DESCRIPTIVE, and targetm.

static void init_excess_precision ( )
static
Initialize excess precision settings.   

References EXCESS_PRECISION_DEFAULT, EXCESS_PRECISION_FAST, and EXCESS_PRECISION_STANDARD.

Referenced by lang_dependent_init_target().

static void init_local_tick ( )
static
Initialize local_tick with a random number or -1 if
   flag_random_seed is set.   

Referenced by toplev_main().

static void init_random_seed ( )
static
Set up a default flag_random_seed and local_tick, unless the user
   already specified one.  Must be called after init_local_tick.   

References crc32_string().

Referenced by get_random_seed(), and print_switch_values().

static int lang_dependent_init ( const char *  )
static

Referenced by do_compile().

static int lang_dependent_init ( )
static
static void lang_dependent_init_target ( )
static
Initialize things that are both lang-dependent and target-dependent.
   This function can be called more than once if target parameters change.   

References expand_dummy_function_end(), init_dummy_function_start(), init_excess_precision(), init_expr_target(), init_optabs(), init_set_costs(), and ira_init().

Referenced by lang_dependent_init(), and target_reinit().

static FILE* open_auxiliary_file ( )
static
Open an auxiliary output file.   

References fatal_error(), and free().

Referenced by lang_dependent_init().

void output_stack_usage ( void  )
static int print_single_switch ( print_switch_fn_type  print_fn,
int  pos,
print_switch_type  type,
const char *  text 
)
static
Print an option value and return the adjusted position in the line.
   ??? print_fn doesn't handle errors, eg disk full; presumably other
   code will catch a disk full though.   

References len, strlen(), SWITCH_TYPE_LINE_END, and SWITCH_TYPE_LINE_START.

Referenced by print_switch_values().

static void print_switch_values ( )
static
Print active target switches using PRINT_FN.
   POS is the current cursor position and MAX is the size of a "line".
   Each line begins with INDENT and ends with TERM.
   Each switch is separated from the next by SEP.   

References cl_options, cl_options_count, init_random_seed(), option_enabled(), print_single_switch(), SWITCH_TYPE_DESCRIPTIVE, SWITCH_TYPE_ENABLED, SWITCH_TYPE_LINE_END, and SWITCH_TYPE_PASSED.

Referenced by init_asm_output(), and process_options().

static int print_to_asm_out_file ( )
static
static int print_to_stderr ( )
static
void print_version ( void  )
Print version information to FILE.
   Each line begins with INDENT (for the case where FILE is the
   assembler output file).   

References lang_hooks::name, pkgversion_string, print_plugins_versions(), and version_string.

static void* realloc_for_line_map ( )
static
A helper function; used as the reallocator function for cpp's line
   table.   

Referenced by general_init().

const char* set_random_seed ( )
Modify the random_seed string to VAL.  Return its previous
   value.   

Referenced by handle_common_deferred_options().

void target_reinit ( void  )
Reinitialize everything when target parameters, such as register usage,
   have changed.   

References backend_init_target(), lang_dependent_init_target(), memset(), and regno_reg_rtx.

Referenced by save_target_globals().

static bool target_supports_section_anchors_p ( )
static
Return true if the current target supports -fsection-anchors.   

References targetm.

Referenced by process_options().

int toplev_main ( )
Entry point of cc1, cc1plus, jc1, f771, etc.
   Exit code is FATAL_EXIT_CODE if can't open files or if there were
   any errors, or SUCCESS_EXIT_CODE if compilation succeeded.

   It is not safe to call this function more than once.   

References decode_cmdline_options_to_array_default_mask(), decode_options(), diagnostic_finish(), do_compile(), finalize_plugins(), general_init(), global_dc, handle_common_deferred_options(), init_local_tick(), lang_hooks::init_options, init_options_once(), lang_hooks::init_options_struct, init_options_struct(), initialize_plugins(), invoke_plugin_callbacks(), line_table, print_ignored_options(), print_plugins_help(), print_version, and seen_error().

Referenced by main().

void wrapup_global_declaration_1 ( )
A subroutine of wrapup_global_declarations.  We've come to the end of
   the compilation unit.  All deferred variables should be undeferred,
   and all incomplete decls should be finalized.   

References lang_hooks::finish_incomplete_decl.

Referenced by wrapup_global_declarations().

bool wrapup_global_declaration_2 ( )
A subroutine of wrapup_global_declarations.  Decide whether or not DECL
   needs to be output.  Return true if it is output.   

References symtab_node_base::alias, symtab_node_base::analyzed, cgraph_global_info_ready, symtab_node_base::definition, rest_of_decl_compilation(), varpool_node::symbol, and varpool_get_node().

Referenced by wrapup_global_declarations().

bool wrapup_global_declarations ( )
Do any final processing required for the declarations in VEC, of
   which there are LEN.  We write out inline functions and variables
   that have been deferred until this point, but which are required.
   Returns nonzero if anything was put out.   

References len, wrapup_global_declaration_1(), and wrapup_global_declaration_2().

Referenced by write_global_declarations().