#include <sys/types.h>
#include <ctype.h>
#include <sys/stat.h>
-
-#ifndef _WIN32
+#if !defined (_WIN32) || defined (__CYGWIN32__)
#ifdef USG
#undef FLOAT
#include <sys/param.h>
int rtl_dump = 0;
int rtl_dump_and_exit = 0;
int jump_opt_dump = 0;
+int addressof_dump = 0;
int cse_dump = 0;
int loop_dump = 0;
int cse2_dump = 0;
static int flag_rerun_cse_after_loop;
+/* Nonzero means to run loop optimizations twice. */
+
+int flag_rerun_loop_opt;
+
/* Nonzero for -finline-functions: ok to inline functions that look like
good inline candidates. */
/* Nonzero means generate extra code for exception handling and enable
exception handling. */
-int flag_exceptions = 1;
+int flag_exceptions = 2;
/* Nonzero means don't place uninitialized global data in common storage
by default. */
{"reg-struct-return", &flag_pcc_struct_return, 0},
{"delayed-branch", &flag_delayed_branch, 1},
{"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1},
+ {"rerun-loop-opt", &flag_rerun_loop_opt, 1},
{"pretend-float", &flag_pretend_float, 1},
{"schedule-insns", &flag_schedule_insns, 1},
{"schedule-insns2", &flag_schedule_insns_after_reload, 1},
"-Wno-format",
"-Wimport",
"-Wno-import",
+ "-Wimplicit-function-declaration",
+ "-Wno-implicit-function-declaration",
+ "-Werror-implicit-function-declaration",
+ "-Wimplicit-int",
+ "-Wno-implicit-int",
"-Wimplicit",
"-Wno-implicit",
"-Wmain",
FILE *aux_info_file;
FILE *rtl_dump_file;
FILE *jump_opt_dump_file;
+FILE *addressof_dump_file;
FILE *cse_dump_file;
FILE *loop_dump_file;
FILE *cse2_dump_file;
int
get_run_time ()
{
-#ifndef _WIN32
+#if !defined (_WIN32) || defined (__CYGWIN32__)
#ifdef USG
struct tms tms;
#else
if (quiet_flag)
return 0;
-#ifdef _WIN32
+#if defined (_WIN32) && !defined (__CYGWIN32__)
if (clock() < 0)
return 0;
else
fflush (rtl_dump_file);
if (jump_opt_dump_file)
fflush (jump_opt_dump_file);
+ if (addressof_dump_file)
+ fflush (addressof_dump_file);
if (cse_dump_file)
fflush (cse_dump_file);
if (loop_dump_file)
return value;
}
-/* Same as `realloc' but report error if no memory available. */
+/* Same as `realloc' but report error if no memory available.
+ Also handle null PTR even if the vendor realloc gets it wrong. */
char *
xrealloc (ptr, size)
char *ptr;
int size;
{
- char *result = (char *) realloc (ptr, size);
+ char *result = (ptr
+ ? (char *) realloc (ptr, size)
+ : (char *) malloc (size));
if (!result)
fatal ("virtual memory exhausted");
return result;
FILE *asm_file;
char *string;
{
+#ifdef OUTPUT_QUOTED_STRING
+ OUTPUT_QUOTED_STRING (asm_file, string);
+#else
char c;
putc ('\"', asm_file);
putc (c, asm_file);
}
putc ('\"', asm_file);
+#endif
}
/* Output a file name in the form wanted by System V. */
if (jump_opt_dump)
jump_opt_dump_file = open_dump_file (dump_base_name, ".jump");
+ /* If addressof dump desired, open the output file. */
+ if (addressof_dump)
+ addressof_dump_file = open_dump_file (dump_base_name, ".addressof");
+
/* If cse dump desired, open the output file. */
if (cse_dump)
cse_dump_file = open_dump_file (dump_base_name, ".cse");
input_file_stack->next = 0;
input_file_stack->name = input_filename;
+ /* Gross. Gross. lang_init is (I think) the first callback into
+ the language front end, and is thus the first opportunity to
+ have the selected language override the default value for any
+ -f option.
+
+ So the default value for flag_exceptions is 2 (uninitialized).
+ If we encounter -fno-exceptions or -fexceptions, then flag_exceptions
+ will be set to zero or one respectively.
+
+ flag_exceptions can also be set by lang_init to something other
+ than the default "uninitialized" value of 2.
+
+ After lang_init, if the value is still 2, then we default to
+ -fno-exceptions (value will be reset to zero).
+
+ When our EH mechanism is low enough overhead that we can enable
+ it by default for languages other than C++, then all this braindamage
+ will go away. */
+
/* Perform language-specific initialization.
This may set main_input_filename. */
lang_init ();
+ if (flag_exceptions == 2)
+ flag_exceptions = 0;
+
/* If the input doesn't start with a #line, use the input name
as the official input file name. */
if (main_input_filename == 0)
if (jump_opt_dump)
fclose (jump_opt_dump_file);
+ if (addressof_dump)
+ fclose (addressof_dump_file);
+
if (cse_dump)
fclose (cse_dump_file);
functions containing nested functions since the nested function
data is in our non-saved obstack. */
+ /* If this is a nested inline, remove ADDRESSOF now so we can
+ finish compiling ourselves. Otherwise, wait until EOF.
+ We have to do this because the purge_addressof transformation
+ changes the DECL_RTL for many variables, which confuses integrate. */
+ if (inlineable)
+ {
+ if (decl_function_context (decl))
+ purge_addressof (insns);
+ else
+ DECL_DEFER_OUTPUT (decl) = 1;
+ }
+
if (! current_function_contains_functions
&& (DECL_DEFER_OUTPUT (decl)
|| (DECL_INLINE (decl)
fflush (cse_dump_file);
});
+ purge_addressof (insns);
+ reg_scan (insns, max_reg_num (), 1);
+
+ if (addressof_dump)
+ TIMEVAR (dump_time,
+ {
+ fprintf (addressof_dump_file, "\n;; Function %s\n\n",
+ (*decl_printable_name) (decl, 2));
+ print_rtl (addressof_dump_file, insns);
+ fflush (addressof_dump_file);
+ });
+
if (loop_dump)
TIMEVAR (dump_time,
{
{
TIMEVAR (loop_time,
{
- loop_optimize (insns, loop_dump_file);
+ if (flag_rerun_loop_opt)
+ {
+ /* We only want to perform unrolling once. */
+
+ loop_optimize (insns, loop_dump_file, 0);
+
+ /* The regscan pass may not be necessary, but let's
+ be safe until we can prove otherwise. */
+ reg_scan (insns, max_reg_num (), 1);
+ }
+ loop_optimize (insns, loop_dump_file, flag_unroll_loops);
});
}
flag_expensive_optimizations = 1;
flag_strength_reduce = 1;
flag_rerun_cse_after_loop = 1;
+ flag_rerun_loop_opt = 1;
flag_caller_saves = 1;
flag_force_mem = 1;
#ifdef INSN_SCHEDULING
flow_dump = 1;
global_reg_dump = 1;
jump_opt_dump = 1;
+ addressof_dump = 1;
jump2_opt_dump = 1;
local_reg_dump = 1;
loop_dump = 1;
case 'j':
jump_opt_dump = 1;
break;
+ case 'D':
+ addressof_dump = 1;
+ break;
case 'J':
jump2_opt_dump = 1;
break;
p = str + strlen (da->arg);
if (*p && (*p < '0' || *p > '9'))
continue;
- q = p;
len = p - str;
+ q = p;
while (*q && (*q >= '0' && *q <= '9'))
q++;
if (*p)
- level = atoi (p);
+ {
+ level = atoi (p);
+ if (len > 1 && !strncmp (str, "gdwarf", len))
+ {
+ error ("use -gdwarf -g%d for DWARF v1, level %d",
+ level, level);
+ if (level == 2)
+ error ("use -gdwarf-2 for DWARF v2");
+ }
+ }
else
level = 2; /* default debugging info level */
if (*q || level > 3)
lim - (char *) &environ);
fflush (stderr);
+#ifndef __MSDOS__
#ifdef USG
system ("ps -l 1>&2");
#else /* not USG */
system ("ps v");
#endif /* not USG */
+#endif
}
#endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN32) */