/* Top level of GNU C compiler
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GCC.
#undef FLOAT /* This is for hpux. They should change hpux. */
#undef FFS /* Some systems define this in param.h. */
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include <signal.h>
#ifdef HAVE_SYS_RESOURCE_H
#include "target.h"
#include "langhooks.h"
#include "cfglayout.h"
+#include "cfgloop.h"
#if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
#include "dwarf2out.h"
DFI_addressof,
DFI_gcse,
DFI_loop,
+ DFI_bypass,
DFI_cfg,
DFI_bp,
DFI_ce1,
{ "addressof", 'F', 0, 0, 0 },
{ "gcse", 'G', 1, 0, 0 },
{ "loop", 'L', 1, 0, 0 },
- { "ce1", 'C', 1, 0, 0 },
+ { "bypass", 'G', 1, 0, 0 }, /* Yes, duplicate enable switch. */
{ "cfg", 'f', 1, 0, 0 },
{ "bp", 'b', 1, 0, 0 },
+ { "ce1", 'C', 1, 0, 0 },
{ "tracer", 'T', 1, 0, 0 },
{ "cse2", 't', 1, 0, 0 },
{ "life", 'f', 1, 0, 0 }, /* Yes, duplicate enable switch. */
int mem_report = 0;
-/* Non-zero means to collect statistics which might be expensive
+/* Nonzero means to collect statistics which might be expensive
and to print them when we are done. */
int flag_detailed_statistics = 0;
int flag_syntax_only = 0;
-/* Nonzero means perform global cse. */
-
-static int flag_gcse;
-
/* Nonzero means perform loop optimizer. */
static int flag_loop_optimize;
static int flag_delete_null_pointer_checks;
+/* Nonzero means perform global CSE. */
+
+int flag_gcse = 0;
+
/* Nonzero means to do the enhanced load motion during gcse, which trys
to hoist loads by not killing them when a store to the same location
is seen. */
/* The following flags have effect only for scheduling before register
allocation:
- flag_schedule_interblock means schedule insns accross basic blocks.
+ flag_schedule_interblock means schedule insns across basic blocks.
flag_schedule_speculative means allow speculative motion of non-load insns.
flag_schedule_speculative_load means allow speculative motion of some
load insns.
{ "-Wimport",
N_("Warn about the use of the #import directive") },
{ "-Wno-import", "" },
+ { "-Winvalid-pch",
+ N_("Warn about PCH files that are found but not used") },
{ "-Wlong-long","" },
{ "-Wno-long-long",
N_("Do not warn about using 'long long' when -pedantic") },
int warn_system_headers = 0;
-/* Print various extra warnings. -W. */
+/* Print various extra warnings. -W/-Wextra. */
int extra_warnings = 0;
int warn_strict_aliasing;
-/* Likewise for -W. */
+/* Like f_options, but for -W. */
static const lang_independent_options W_options[] =
{
N_("Warn when an optimization pass is disabled") },
{"deprecated-declarations", &warn_deprecated_decl, 1,
N_("Warn about uses of __attribute__((deprecated)) declarations") },
+ {"extra", &extra_warnings, 1,
+ N_("Print extra (possibly unwanted) warnings") },
{"missing-noreturn", &warn_missing_noreturn, 1,
N_("Warn about functions which might be candidates for attribute noreturn") },
{"strict-aliasing", &warn_strict_aliasing, 1,
wrapup_global_declarations (vec, len);
- /* This must occur after the loop to output deferred functions. Else
- the profiler initializer would not be emitted if all the functions
- in this compilation unit were deferred.
-
- output_func_start_profiler can not cause any additional functions or
- data to need to be output, so it need not be in the deferred function
- loop above. */
- output_func_start_profiler ();
+ if (profile_arc_flag)
+ /* This must occur after the loop to output deferred functions.
+ Else the profiler initializer would not be emitted if all the
+ functions in this compilation unit were deferred. */
+ create_profiler ();
check_global_declarations (vec, len);
dw2_output_indirect_constants ();
- end_final (aux_base_name);
-
if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
{
timevar_push (TV_DUMP);
int top_level;
int at_end;
{
- /* Declarations of variables, and of functions defined elsewhere. */
-
-/* The most obvious approach, to put an #ifndef around where
- this macro is used, doesn't work since it's inside a macro call. */
-#ifndef ASM_FINISH_DECLARE_OBJECT
-#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
-#endif
-
/* We deferred calling assemble_alias so that we could collect
other attributes such as visibility. Emit the alias now. */
{
is seen. But at end of compilation, do output code for them. */
if (at_end || !DECL_DEFER_OUTPUT (decl))
assemble_variable (decl, top_level, at_end, 0);
+
+#ifdef ASM_FINISH_DECLARE_OBJECT
if (decl == last_assemble_variable_decl)
{
ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
top_level, at_end);
}
+#endif
timevar_pop (TV_VARCONST);
}
void
rest_of_type_compilation (type, toplev)
-#if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO) || defined (SDB_DEBUGGING_INFO)
+#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO) \
+ || defined (SDB_DEBUGGING_INFO) || defined (DWARF2_DEBUGGING_INFO)
tree type;
int toplev;
#else
DECL_INITIAL (decl) = 0;
goto exit_rest_of_compilation;
}
+ else if (TYPE_P (parent))
+ /* A function in a local class should be treated normally. */
+ break;
/* If requested, consider whether to make this function inline. */
if ((DECL_INLINE (decl) && !flag_no_inline)
convert_from_eh_region_ranges ();
/* If function is inline, and we don't yet know whether to
- compile it by itself, defer decision till end of compilation.
- finish_compilation will call rest_of_compilation again
- for those functions that need to be output. Also defer those
- functions that we are supposed to defer. */
+ compile it by itself, defer decision till end of compilation.
+ wrapup_global_declarations will (indirectly) call
+ rest_of_compilation again for those functions that need to
+ be output. Also defer those functions that we are supposed
+ to defer. */
if (inlinable
|| (DECL_INLINE (decl)
#endif
}
+ /* Instantiate any remaining CONSTANT_P_RTX nodes. */
+ if (optimize > 0 && flag_gcse && current_function_calls_constant_p)
+ purge_builtin_constant_p ();
+
/* Move constant computations out of loops. */
if (optimize > 0 && flag_loop_optimize)
ggc_collect ();
}
+ /* Perform jump bypassing and control flow optimizations. */
+ if (optimize > 0 && flag_gcse)
+ {
+ timevar_push (TV_BYPASS);
+ open_dump_file (DFI_bypass, decl);
+
+ cleanup_cfg (CLEANUP_EXPENSIVE);
+ tem = bypass_jumps (rtl_dump_file);
+
+ if (tem)
+ {
+ rebuild_jump_labels (insns);
+ cleanup_cfg (CLEANUP_EXPENSIVE);
+ delete_trivially_dead_insns (insns, max_reg_num ());
+ }
+
+ close_dump_file (DFI_bypass, print_rtl_with_bb, insns);
+ timevar_pop (TV_BYPASS);
+
+ ggc_collect ();
+
+#ifdef ENABLE_CHECKING
+ verify_flow_info ();
+#endif
+ }
+
/* Do control and data flow analysis; wrote some of the results to
the dump file. */
| (flag_thread_jumps ? CLEANUP_THREADING : 0));
/* It may make more sense to mark constant functions after dead code is
- eliminated by life_analyzis, but we need to do it early, as -fprofile-arcs
+ eliminated by life_analysis, but we need to do it early, as -fprofile-arcs
may insert code making function non-constant, but we still must consider
it as constant, otherwise -fbranch-probabilities will not read data back.
- life_analyzis rarely eliminates modification of external memory.
+ life_analysis rarely eliminates modification of external memory.
*/
if (optimize)
mark_constant_function ();
= combine_instructions (insns, max_reg_num ());
/* Combining insns may have turned an indirect jump into a
- direct jump. Rebuid the JUMP_LABEL fields of jumping
+ direct jump. Rebuild the JUMP_LABEL fields of jumping
instructions. */
if (rebuild_jump_labels_after_combine)
{
open_dump_file (DFI_bbro, decl);
/* Last attempt to optimize CFG, as scheduling, peepholing and insn
- splitting possibly introduced more crossjumping oppurtuntities.
+ splitting possibly introduced more crossjumping opportunities.
Except that we can't actually run crossjumping without running
another DCE pass, which we can't do after reg-stack. */
cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK
know for certain that we will be generating an out-of-line copy,
the first invocation of this routine (rest_of_compilation) will
skip over this code by doing a `goto exit_rest_of_compilation;'.
- Later on, finish_compilation will call rest_of_compilation again
- for those inline functions that need to have out-of-line copies
- generated. During that call, we *will* be routed past here. */
+ Later on, wrapup_global_declarations will (indirectly) call
+ rest_of_compilation again for those inline functions that need
+ to have out-of-line copies generated. During that call, we
+ *will* be routed past here. */
timevar_push (TV_SYMOUT);
(*debug_hooks->function_decl) (decl);
printf (_(" -pedantic Issue warnings needed by strict compliance to ISO C\n"));
printf (_(" -pedantic-errors Like -pedantic except that errors are produced\n"));
printf (_(" -w Suppress warnings\n"));
- printf (_(" -W Enable extra warnings\n"));
for (i = ARRAY_SIZE (W_options); i--;)
{
{
set_Wunused (0);
}
+ else if (!strcmp (arg, "extra"))
+ {
+ /* We save the value of warn_uninitialized, since if they put
+ -Wuninitialized on the command line, we need to generate a
+ warning about not using it without also specifying -O. */
+ if (warn_uninitialized != 1)
+ warn_uninitialized = 2;
+ }
else
return 0;
selected type. It is an error to specify more than one
debugging type. */
static enum debug_info_type selected_debug_type = NO_DEBUG;
- /* Non-zero if debugging format has been explicitly set.
+ /* Nonzero if debugging format has been explicitly set.
-g and -ggdb don't explicitly set the debugging format so
-gdwarf -g3 is equivalent to -gdwarf3. */
static int type_explicitly_set_p = 0;
if (!strcmp (asm_file_name, "-"))
asm_out_file = stdout;
else
- asm_out_file = fopen (asm_file_name, "w");
+ asm_out_file = fopen (asm_file_name, "w+");
if (asm_out_file == 0)
fatal_io_error ("can't open %s for writing", asm_file_name);
}