/* Top level of GCC compilers (cc1, cc1plus, etc.)
- Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
- 2011 Free Software Foundation, Inc.
+ Copyright (C) 1987-2013 Free Software Foundation, Inc.
This file is part of GCC.
#include "basic-block.h"
#include "intl.h"
#include "ggc.h"
-#include "graph.h"
#include "regs.h"
#include "timevar.h"
#include "diagnostic.h"
#include "reload.h"
#include "ira.h"
#include "dwarf2asm.h"
-#include "integrate.h"
#include "debug.h"
#include "target.h"
#include "common/common-target.h"
#include "langhooks.h"
-#include "cfglayout.h"
-#include "cfgloop.h"
+#include "cfgloop.h" /* for init_set_costs */
#include "hosthooks.h"
#include "cgraph.h"
#include "opts.h"
#include "value-prof.h"
#include "alloc-pool.h"
#include "tree-mudflap.h"
+#include "asan.h"
+#include "tsan.h"
#include "gimple.h"
#include "tree-ssa-alias.h"
#include "plugin.h"
-#if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
-#include "dwarf2out.h"
-#endif
-
#if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
#include "dbxout.h"
#endif
/* -f flags. */
-/* Nonzero means make permerror produce warnings instead of errors. */
-
-int flag_permissive = 0;
-
/* When non-NULL, indicates that whenever space is allocated on the
stack, the resulting stack pointer must not pass this
address---that is, for stacks that grow downward, the stack pointer
FILE *asm_out_file;
FILE *aux_info_file;
FILE *stack_usage_file = NULL;
-FILE *dump_file = NULL;
-const char *dump_file_name;
/* The current working directory of a translation. It's generally the
directory from which compilation was initiated, but a preprocessed
bool
wrapup_global_declaration_2 (tree decl)
{
- if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
+ if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl)
+ || (TREE_CODE (decl) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (decl)))
return false;
/* Don't write out static consts, unless we still need them.
"%q+D defined but not used", decl);
}
-/* Issue appropriate warnings for the global declarations in VEC (of
+/* Issue appropriate warnings for the global declarations in V (of
which there are LEN). */
void
-check_global_declarations (tree *vec, int len)
+check_global_declarations (tree *v, int len)
{
int i;
for (i = 0; i < len; i++)
- check_global_declaration_1 (vec[i]);
+ check_global_declaration_1 (v[i]);
}
/* Emit debugging information for all global declarations in VEC. */
if (flag_syntax_only || flag_wpa)
return;
- timevar_start (TV_PHASE_GENERATE);
-
ggc_protect_identifiers = false;
- /* This must also call cgraph_finalize_compilation_unit. */
+ /* This must also call finalize_compilation_unit. */
lang_hooks.decls.final_write_globals ();
if (seen_error ())
- {
- timevar_stop (TV_PHASE_GENERATE);
- return;
- }
+ return;
+
+ timevar_start (TV_PHASE_LATE_ASM);
/* Compilation unit is finalized. When producing non-fat LTO object, we are
basically finished. */
if (in_lto_p || !flag_lto || flag_fat_lto_objects)
{
- varpool_remove_unreferenced_decls ();
- varpool_assemble_pending_decls ();
- finish_aliases_2 ();
-
/* Likewise for mudflap static object registrations. */
if (flag_mudflap)
mudflap_finish_file ();
+ /* File-scope initialization for AddressSanitizer. */
+ if (flag_asan)
+ asan_finish_file ();
+
+ if (flag_tsan)
+ tsan_finish_file ();
+
output_shared_constant_pool ();
output_object_blocks ();
finish_tm_clone_pairs ();
/* Attach a special .ident directive to the end of the file to identify
the version of GCC which compiled this code. The format of the .ident
string is patterned after the ones produced by native SVR4 compilers. */
-#ifdef IDENT_ASM_OP
if (!flag_no_ident)
{
const char *pkg_version = "(GNU) ";
+ char *ident_str;
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);
+
+ ident_str = ACONCAT (("GCC: ", pkg_version, version_string, NULL));
+ targetm.asm_out.output_ident (ident_str);
}
-#endif
/* Invoke registered plugin callbacks. */
invoke_plugin_callbacks (PLUGIN_FINISH_UNIT, NULL);
assembly file after this point. */
targetm.asm_out.file_end ();
- timevar_stop (TV_PHASE_GENERATE);
+ timevar_stop (TV_PHASE_LATE_ASM);
}
/* Print version information to FILE.
if (!strcmp (asm_file_name, "-"))
asm_out_file = stdout;
else
- asm_out_file = fopen (asm_file_name, "w+b");
+ asm_out_file = fopen (asm_file_name, "w");
if (asm_out_file == 0)
fatal_error ("can%'t open %s for writing: %m", asm_file_name);
}
}
}
- /* Unless over-ridden for the target, assume that all DWARF levels
- may be emitted, if DWARF2_DEBUG is selected. */
- if (dwarf_strict < 0)
- dwarf_strict = 0;
-
/* A lot of code assumes write_symbols == NO_DEBUG if the debugging
level is 0. */
if (debug_info_level == DINFO_LEVEL_NONE)
/* 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.) */
- if (flag_var_tracking_uninit)
+ if (flag_var_tracking_uninit == 1)
flag_var_tracking = 1;
if (flag_var_tracking == AUTODETECT_VALUE)
flag_var_tracking = optimize >= 1;
+ if (flag_var_tracking_uninit == AUTODETECT_VALUE)
+ flag_var_tracking_uninit = flag_var_tracking;
+
if (flag_var_tracking_assignments == AUTODETECT_VALUE)
flag_var_tracking_assignments = flag_var_tracking
&& !(flag_selective_scheduling || flag_selective_scheduling2);
}
}
- if (flag_function_sections && profile_flag)
- {
- warning (0, "-ffunction-sections disabled; it makes profiling impossible");
- flag_function_sections = 0;
- }
-
#ifndef HAVE_prefetch
if (flag_prefetch_loop_arrays > 0)
{
if (!flag_stack_protect)
warn_stack_protect = 0;
- /* ??? Unwind info is not correct around the CFG unless either a frame
- pointer is present or A_O_A is set. Fixing this requires rewriting
- unwind info generation to be aware of the CFG and propagating states
- around edges. */
- if (flag_unwind_tables && !ACCUMULATE_OUTGOING_ARGS
- && flag_omit_frame_pointer)
+ /* Address Sanitizer needs porting to each target architecture. */
+ if (flag_asan
+ && (targetm.asan_shadow_offset == NULL
+ || !FRAME_GROWS_DOWNWARD))
{
- warning (0, "unwind tables currently require a frame pointer "
- "for correctness");
- flag_omit_frame_pointer = 0;
+ warning (0, "-fsanitize=address not supported for this target");
+ flag_asan = 0;
}
/* Enable -Werror=coverage-mismatch when -Werror and -Wno-error
/* rtx_cost is mode-dependent, so cached values need to be recomputed
on a mode change. */
init_expmed ();
+ init_lower_subreg ();
/* We may need to recompute regno_save_code[] and regno_restore_code[]
after a mode change as well. */
if (mem_report)
dump_memory_report (true);
+ if (profile_report)
+ dump_profile_report ();
+
/* Language-specific end of compilation actions. */
lang_hooks.finish ();
}
if (!exit_after_options)
do_compile ();
- if (warningcount || errorcount)
+ if (warningcount || errorcount || werrorcount)
print_ignored_options ();
diagnostic_finish (global_dc);
invoke_plugin_callbacks (PLUGIN_FINISH, NULL);
finalize_plugins ();
- if (seen_error ())
+ location_adhoc_data_fini (line_table);
+ if (seen_error () || werrorcount)
return (FATAL_EXIT_CODE);
return (SUCCESS_EXIT_CODE);