+Tue Jan 20 16:01:03 1998 Anthony Green <green@cygnus.com>
+
+ * flags.h: New flag (optimize_size).
+ * toplev.c (main): Parse -Os option and set optimize_space
+ accordingly.
+ * gcc.c (default_compilers), cp/lang-specs.h, f/lang-specs.h: Define
+ __OPTIMIZE_SIZE__ when compiling with -Os.
+ * config/dsp16xx/dsp16xx.h, config/i386/i386.h,
+ config/i386/dgux.h, config/i960/i960.h, config/pdp11/pdp11.h,
+ config/v850/v850.h (OPTIMIZATION_OPTIONS): New SIZE argument
+ to macro.
+ * config/i386/i386.c (optimization_options): Accept new SIZE argument.
+
Mon Jan 26 23:57:39 1998 Manfred Hollstein <manfred@s-direktnet.de>
* libgcc2.c (__clear_insn_cache): On sysV68 enable the memctl
/* Definitions of target machine for GNU compiler. AT&T DSP1600.
- Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Contributed by Michael Collison (collison@world.std.com).
This file is part of GNU CC.
#define OVERRIDE_OPTIONS override_options ()
-#define OPTIMIZATION_OPTIONS(LEVEL) \
+#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \
{ \
flag_gnu_linker = FALSE; \
\
\
if (LEVEL >= 2) \
{ \
- flag_strength_reduce = TRUE; \
+ if (! SIZE) \
+ flag_strength_reduce = TRUE; \
flag_cse_follow_jumps = TRUE; \
flag_cse_skip_blocks = TRUE; \
flag_expensive_optimizations = TRUE; \
flag_rerun_cse_after_loop = TRUE; \
} \
\
- if (LEVEL >= 3) \
+ if ((LEVEL >= 3) && ! SIZE) \
{ \
flag_inline_functions = 1; \
} \
/* Target definitions for GNU compiler for Intel 80x86 running DG/ux
- Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Currently maintained by gcc@dg-rtp.dg.com.
This file is part of GNU CC.
#include "i386/sysv4.h"
#ifndef VERSION_INFO2
-#define VERSION_INFO2 "$Revision: 1.1 $"
+#define VERSION_INFO2 "$Revision: 1.6 $"
#endif
#ifndef VERSION_STRING
*/
#undef OPTIMIZATION_OPTIONS
-#define OPTIMIZATION_OPTIONS(LEVEL) \
+#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \
do { \
extern int flag_signed_bitfields; \
flag_signed_bitfields = 0; \
abort_helper (); \
- optimization_options (LEVEL); \
+ optimization_options (LEVEL,SIZE); \
} while (0)
/* Linker and library spec's.
-static, -shared, -symbolic, -h* and -z* access AT&T V.4 link options.
-svr4 instructs gcc to place /usr/lib/values-X[cat].o on link the line.
- The absense of -msvr4 indicates linking done in a COFF environment and
+ The absence of -msvr4 indicates linking done in a COFF environment and
adds the link script to the link line. In all environments, the first
and last objects are crtbegin.o and crtend.o.
When the -G link option is used (-shared and -symbolic) a final link is
warning ("argument is a structure"),0 : 0), \
(function_arg (&CUM, MODE, TYPE, NAMED)))
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if (LOG <= 2) \
- fprintf ((FILE), "\t.align %d\n", 1<<(LOG));\
- else if ((LOG)!=0) \
- { \
- char buf[256]; \
- if (!backalign_labelno) fprintf ((FILE), "\t.align %d\n", 1); \
- ASM_GENERATE_INTERNAL_LABEL (buf, "LBA", backalign_labelno++); \
- fprintf ((FILE), "%s:", &buf[1]); \
- fprintf ((FILE), "\t.backalign %s,%d,%d\n", &buf[1], 1<<(LOG), \
- ((TARGET_PENTIUMPRO || TARGET_486) && LOG==4) ? 6 : 2);\
- }
-
-/* add .align 1 to avoid .backalign bug in assembler */
+/* Add .align 1 to avoid .backalign bug in assembler */
#undef CONST_SECTION_ASM_OP
#define CONST_SECTION_ASM_OP ".section\t.rodata\n\t.align 1"
/* Subroutines for insn-output.c for Intel X86.
- Copyright (C) 1988, 92, 94, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1988, 92, 94-97, 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
}
\f
void
-optimization_options (level)
+optimization_options (level, size)
int level;
+ int size;
{
/* For -O2 and beyond, turn off -fschedule-insns by default. It tends to
make the problem with not enough registers even worse. */
/* Definitions of target machine for GNU compiler for Intel X86
(386, 486, Pentium).
- Copyright (C) 1988, 92, 94, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1988, 92, 94-97, 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
#define SUBTARGET_OPTIONS
/* Define this to change the optimizations performed by default. */
-#define OPTIMIZATION_OPTIONS(LEVEL) optimization_options(LEVEL)
+#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) optimization_options(LEVEL,SIZE)
/* Specs for the compiler proper */
/* Definitions of target machine for GNU compiler, for Intel 80960
- Copyright (C) 1992, 1993, 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1993, 1995, 1996, 1998 Free Software Foundation, Inc.
Contributed by Steven McGeady, Intel Corp.
Additional Work by Glenn Colon-Bonet, Jonathan Shapiro, Andy Wilson
Converted to GCC 2.0 by Jim Wilson and Michael Tiemann, Cygnus Support.
#define CAN_DEBUG_WITHOUT_FP
/* Do leaf procedure and tail call optimizations for -O2 and higher. */
-#define OPTIMIZATION_OPTIONS(LEVEL) \
+#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \
{ \
if ((LEVEL) >= 2) \
{ \
/* Definitions of target machine for GNU compiler, for the pdp-11
- Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1996, 1998 Free Software Foundation, Inc.
Contributed by Michael K. Gschwind (mike@vlsivie.tuwien.ac.at).
This file is part of GNU CC.
LEVEL is the optimization level specified; 2 if -O2 is
specified, 1 if -O is specified, and 0 if neither is specified. */
-#define OPTIMIZATION_OPTIONS(LEVEL) \
+#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \
{ \
if (LEVEL >= 3) \
{ \
- flag_inline_functions = 1; \
+ if (! SIZE) \
+ flag_inline_functions = 1; \
flag_omit_frame_pointer = 1; \
/* flag_unroll_loops = 1; */ \
} \
/* Definitions of target machine for GNU compiler. NEC V850 series
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
Contributed by Jeff Law (law@cygnus.com).
This file is part of GNU CC.
LEVEL is the optimization level specified; 2 if `-O2' is
specified, 1 if `-O' is specified, and 0 if neither is specified.
+ SIZE is non-zero if `-Os' is specified, 0 otherwise.
+
You should not use this macro to change options that are not
machine-specific. These should uniformly selected by the same
optimization level on all supported machines. Use this macro to
*Do not examine `write_symbols' in this macro!* The debugging
options are not supposed to alter the generated code. */
-#define OPTIMIZATION_OPTIONS(LEVEL) \
+#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \
{ \
if (LEVEL) \
target_flags |= (MASK_EP | MASK_PROLOG_FUNCTION); \
-undef -D__GNUC__=%v1 -D__GNUG__=%v1 -D__cplusplus -D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\
%{!fno-exceptions:-D__EXCEPTIONS}\
- %c %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\
+ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %{!M:%{!MM:%{!E:%{!pipe:%g.ii}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
"%{!M:%{!MM:%{!E:cc1plus %{!pipe:%g.ii} %1 %2\
-undef -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -$ -D__STRICT_ANSI__}\
%{!undef:%P} -D_LANGUAGE_FORTRAN %{trigraphs} \
- %c %{O*:%{!O0:-D__OPTIMIZE__}} -traditional\
+ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} -traditional\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
"%{!M:%{!MM:%{!E:f771 %{!pipe:%g.i} -fset-g77-defaults %(f771) \
/* Compilation switch flag definitions for GNU CC.
- Copyright (C) 1987, 88, 94, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1987, 88, 94-97, 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
extern int optimize;
+/* Nonzero means optimize for size. -Os. */
+
+extern int optimize_size;
+
/* Nonzero means do stupid register allocation. -noreg.
Currently, this is 1 if `optimize' is 0. */
/* Compiler driver program that can handle many languages.
- Copyright (C) 1987, 89, 92-96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1987, 89, 92-97, 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
-undef -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -D__STRICT_ANSI__}\
%{!undef:%{!ansi:%p} %P} %{trigraphs} \
- %c %{O*:%{!O0:-D__OPTIMIZE__}} %{traditional} %{ftraditional:-traditional}\
+ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
+ %{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
-undef -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -D__STRICT_ANSI__}\
%{!undef:%{!ansi:%p} %P} %{trigraphs}\
- %c %{O*:%{!O0:-D__OPTIMIZE__}} %{traditional} %{ftraditional:-traditional}\
+ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
+ %{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %W{o*}}\
-undef -D__OBJC__ -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -D__STRICT_ANSI__}\
%{!undef:%{!ansi:%p} %P} %{trigraphs}\
- %c %{O*:%{!O0:-D__OPTIMIZE__}} %{traditional} %{ftraditional:-traditional}\
+ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
+ %{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
-undef -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -D__STRICT_ANSI__}\
%{!undef:%{!ansi:%p} %P} %{trigraphs}\
- %c %{O*:%{!O0:-D__OPTIMIZE__}} %{traditional} %{ftraditional:-traditional}\
+ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
+ %{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %W{o*}"},
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG} %{trigraphs}\
-undef -$ %{!undef:%p %P} -D__ASSEMBLER__ \
- %c %{O*:%{!O0:-D__OPTIMIZE__}} %{traditional} %{ftraditional:-traditional}\
+ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
+ %{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %{!M:%{!MM:%{!E:%{!pipe:%g.s}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
-@c Copyright (C) 1988,89,92,93,94,95,96,1997 Free Software Foundation, Inc.
+@c Copyright (C) 1988,89,92-97,1998 Free Software Foundation, Inc.
@c This is part of the GCC manual.
@c For copying conditions, see the file gcc.texi.
-fschedule-insns2 -fstrength-reduce -fthread-jumps
-funroll-all-loops -funroll-loops
-fmove-all-movables -freduce-all-givs
--O -O0 -O1 -O2 -O3
+-O -O0 -O1 -O2 -O3 -Os
@end smallexample
@item Preprocessor Options
@item -O0
Do not optimize.
+@item -Os
+Optimize for size. @samp{-Os} enables all @samp{-O2} optimizations that
+do not typically increase code size. It also performs further
+optimizations designed to reduce code size.
+
If you use multiple @samp{-O} options, with or without level numbers,
the last such option is the one that is effective.
@end table
-@c Copyright (C) 1988,89,92,93,94,96,1997 Free Software Foundation, Inc.
+@c Copyright (C) 1988,89,92-97,1998 Free Software Foundation, Inc.
@c This is part of the GCC manual.
@c For copying conditions, see the file gcc.texi.
@samp{-O}. That is what @code{OPTIMIZATION_OPTIONS} is for.
@findex OPTIMIZATION_OPTIONS
-@item OPTIMIZATION_OPTIONS (@var{level})
+@item OPTIMIZATION_OPTIONS (@var{level}, @var{size})
Some machines may desire to change what optimizations are performed for
various optimization levels. This macro, if defined, is executed once
just after the optimization level is determined and before the remainder
@var{level} is the optimization level specified; 2 if @samp{-O2} is
specified, 1 if @samp{-O} is specified, and 0 if neither is specified.
+@var{size} is non-zero if @samp{-Os} is specified and zero otherwise.
+
You should not use this macro to change options that are not
machine-specific. These should uniformly selected by the same
optimization level on all supported machines. Use this macro to enable
/* Top level of GNU C compiler
- Copyright (C) 1987, 88, 89, 92-6, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1987, 88, 89, 92-7, 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
int optimize = 0;
+/* Nonzero means optimize for size. -Os.
+ The only valid values are zero and non-zero. When optimize_size is
+ non-zero, optimize defaults to 2, but certain individual code
+ bloating optimizations are disabled. */
+
+int optimize_size = 0;
+
/* Number of error messages and warning messages so far. */
int errorcount = 0;
}
else if (argv[i][0] == '-' && argv[i][1] == 'O')
{
- /* Handle -O2, -O3, -O69, ... */
+ /* Handle -Os, -O2, -O3, -O69, ... */
char *p = &argv[i][2];
int c;
-
- while (c = *p++)
- if (! (c >= '0' && c <= '9'))
- break;
- if (c == 0)
- optimize = atoi (&argv[i][2]);
+
+ if ((p[0] == 's') && (p[1] == 0))
+ optimize_size = 1;
+ else
+ {
+ while (c = *p++)
+ if (! (c >= '0' && c <= '9'))
+ break;
+ if (c == 0)
+ optimize = atoi (&argv[i][2]);
+ }
}
}
+ /* Optimizing for size forces optimize to be no less than 2. */
+ if (optimize_size && (optimize < 2))
+ optimize = 2;
+
obey_regdecls = (optimize == 0);
if (optimize >= 1)
flag_inline_functions = 1;
}
+ /* Disable code bloating optimizations if optimizing for size. */
+ if (optimize_size)
+ {
+ flag_inline_functions = 0;
+ }
+
/* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
modify it. */
target_flags = 0;
#ifdef OPTIMIZATION_OPTIONS
/* Allow default optimizations to be specified on a per-machine basis. */
- OPTIMIZATION_OPTIONS (optimize);
+ OPTIMIZATION_OPTIONS (optimize, optimize_size);
#endif
/* Initialize register usage now so switches may override. */
else if (str[0] == 'O')
{
register char *p = str+1;
- while (*p && *p >= '0' && *p <= '9')
+ if (*p == 's')
p++;
+ else
+ while (*p && *p >= '0' && *p <= '9')
+ p++;
if (*p == '\0')
;
else