From d6cc6ec9d11523de305be40a6e0e36ea9996de57 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sun, 20 Jul 2008 16:57:17 +0200 Subject: [PATCH] extend.texi (flatten attribute): Remove note about unit-at-a-time * doc/extend.texi (flatten attribute): Remove note about unit-at-a-time * doc/invoke.texi (--combine): Likewise. (-finline-functions-called-once): Update levels when enabled. (-funit-at-a-time): Document new behaviour. (-ftoplevel-reorder): Document that it is enabled -O0 and imply -fno-section-anchors when disabled explicitly. (inline params): They are not ignored now. (precompiled headers): Remove unit-at-a-time as being incompatible. * opts.c (decode_options): Handle unit-at-a-time as alias; imply -fno-section-anchors when toplevel reorder is disabled explicitly. * common.opt (ftoplevel-reorder): Set default value to 2. (funit-at-a-time): Set default value to 1. * config/rs6000/rs6000.c (optimization_options): Set section anchors to 2. From-SVN: r138009 --- gcc/ChangeLog | 18 ++++++++++++ gcc/common.opt | 4 +-- gcc/config/rs6000/rs6000.c | 2 +- gcc/doc/extend.texi | 3 +- gcc/doc/invoke.texi | 59 +++++++++----------------------------- gcc/opts.c | 23 +++++++++++---- 6 files changed, 54 insertions(+), 55 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ccdfe61a04b..0a9a57a3c5d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +2008-07-19 Jan Hubicka + + * doc/extend.texi (flatten attribute): Remove note about unit-at-a-time + * doc/invoke.texi (--combine): Likewise. + (-finline-functions-called-once): Update levels when enabled. + (-funit-at-a-time): Document new behaviour. + (-ftoplevel-reorder): Document that it is enabled -O0 and imply + -fno-section-anchors when disabled explicitly. + (inline params): They are not ignored now. + (precompiled headers): Remove unit-at-a-time as being incompatible. + * opts.c (decode_options): Handle unit-at-a-time as alias; + imply -fno-section-anchors when toplevel reorder is disabled + explicitly. + * common.opt (ftoplevel-reorder): Set default value to 2. + (funit-at-a-time): Set default value to 1. + * config/rs6000/rs6000.c (optimization_options): Set section anchors + to 2. + 2008-07-19 Jan Hubicka * builtins.c (expand_builtin_int_roundingfn, diff --git a/gcc/common.opt b/gcc/common.opt index 28a5af25dd9..7c441155dfa 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1046,7 +1046,7 @@ Common Joined RejectNegative -ftls-model=[global-dynamic|local-dynamic|initial-exec|local-exec] Set the default thread-local storage code generation model ftoplevel-reorder -Common Report Var(flag_toplevel_reorder) Init(1) Optimization +Common Report Var(flag_toplevel_reorder) Init(2) Optimization Reorder top level functions, variables, and asms ftracer @@ -1169,7 +1169,7 @@ Common Report Var(flag_tree_vrp) Init(0) Optimization Perform Value Range Propagation on trees funit-at-a-time -Common Report Var(flag_unit_at_a_time) Optimization +Common Report Var(flag_unit_at_a_time) Init(1) Optimization Compile whole compilation unit at a time funroll-loops diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 88c7226d7a2..5e2f7ac38a1 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -2111,7 +2111,7 @@ optimization_options (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED) Skip section anchors for Objective C and Objective C++ until front-ends fixed. */ if (!TARGET_MACHO && lang_hooks.name[4] != 'O') - flag_section_anchors = 1; + flag_section_anchors = 2; } /* Implement TARGET_HANDLE_OPTION. */ diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 4a4c9a3a4a1..751e6743a5e 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -1945,8 +1945,7 @@ body. Generally, inlining into a function is limited. For a function marked with this attribute, every call inside this function will be inlined, if possible. Whether the function itself is considered for inlining depends on its size and -the current inlining parameters. The @code{flatten} attribute only works -reliably in unit-at-a-time mode. +the current inlining parameters. @item error ("@var{message}") @cindex @code{error} function attribute diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 6122f791b68..5114f700dc9 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -5129,14 +5129,10 @@ Turning on optimization flags makes the compiler attempt to improve the performance and/or code size at the expense of compilation time and possibly the ability to debug the program. -The compiler performs optimization based on the knowledge it has of -the program. Optimization levels @option{-O} and above, in -particular, enable @emph{unit-at-a-time} mode, which allows the -compiler to consider information gained from later functions in -the file when compiling a function. Compiling multiple files at -once to a single output file in @emph{unit-at-a-time} mode allows -the compiler to use information gained from all of the files when -compiling each of them. +The compiler performs optimization based on the knowledge it has of the +program. Compiling multiple files at once to a single output file mode allows +the compiler to use information gained from all of the files when compiling +each of them. Not all optimizations are controlled directly by a flag. Only optimizations that have a flag are listed. @@ -5342,7 +5338,7 @@ caller even if they are not marked @code{inline}. If a call to a given function is integrated, then the function is not output as assembler code in its own right. -Enabled if @option{-funit-at-a-time} is enabled. +Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}. @item -fearly-inlining @opindex fearly-inlining @@ -6316,39 +6312,11 @@ Enabled at levels @option{-O2}, @option{-O3}. @item -funit-at-a-time @opindex funit-at-a-time -Parse the whole compilation unit before starting to produce code. -This allows some extra optimizations to take place but consumes -more memory (in general). There are some compatibility issues -with @emph{unit-at-a-time} mode: -@itemize @bullet -@item -enabling @emph{unit-at-a-time} mode may change the order -in which functions, variables, and top-level @code{asm} statements -are emitted, and will likely break code relying on some particular -ordering. The majority of such top-level @code{asm} statements, -though, can be replaced by @code{section} attributes. The -@option{fno-toplevel-reorder} option may be used to keep the ordering -used in the input file, at the cost of some optimizations. - -@item -@emph{unit-at-a-time} mode removes unreferenced static variables -and functions. This may result in undefined references -when an @code{asm} statement refers directly to variables or functions -that are otherwise unused. In that case either the variable/function -shall be listed as an operand of the @code{asm} statement operand or, -in the case of top-level @code{asm} statements the attribute @code{used} -shall be used on the declaration. - -@item -Static functions now can use non-standard passing conventions that -may break @code{asm} statements calling functions directly. Again, -attribute @code{used} will prevent this behavior. -@end itemize - -As a temporary workaround, @option{-fno-unit-at-a-time} can be used, -but this scheme may not be supported by future releases of GCC@. +This option is left for compatibility reasons. @option{-funit-at-a-time} +has no effect, while @option{-fno-unit-at-a-time} implies +@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}. -Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. +Enabled by default. @item -fno-toplevel-reorder @opindex fno-toplevel-reorder @@ -6359,6 +6327,10 @@ will not be removed. This option is intended to support existing code which relies on a particular ordering. For new code, it is better to use attributes. +Enabled at level @option{-O0}. When disabled explicitly, it also imply +@option{-fno-section-anchors} that is otherwise enabled at @option{-O0} on some +targets. + @item -fweb @opindex fweb Constructs webs as commonly used for register allocation purposes and assign @@ -6944,12 +6916,10 @@ limit after inlining inlining is constrained by @option{--param large-function-growth}. This parameter is useful primarily to avoid extreme compilation time caused by non-linear algorithms used by the backend. -This parameter is ignored when @option{-funit-at-a-time} is not used. The default value is 2700. @item large-function-growth Specifies maximal growth of large function caused by inlining in percents. -This parameter is ignored when @option{-funit-at-a-time} is not used. The default value is 100 which limits large function growth to 2.0 times the original size. @@ -6966,7 +6936,6 @@ before applying @option{--param inline-unit-growth}. The default is 10000 @item inline-unit-growth Specifies maximal overall growth of the compilation unit caused by inlining. -This parameter is ignored when @option{-funit-at-a-time} is not used. The default value is 30 which limits unit growth to 1.3 times the original size. @@ -15616,7 +15585,7 @@ for any cases where this rule is relaxed. @item Each of the following options must be the same when building and using the precompiled header: -@gccoptlist{-fexceptions -funit-at-a-time} +@gccoptlist{-fexceptions} @item Some other command-line options starting with @option{-f}, diff --git a/gcc/opts.c b/gcc/opts.c index 7e8e96c4dad..0533c9fa5da 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -849,15 +849,28 @@ decode_options (unsigned int argc, const char **argv) } } - if (!optimize) + + if (!flag_unit_at_a_time) { - flag_merge_constants = 0; + flag_section_anchors = 0; + flag_toplevel_reorder = 0; + flag_unit_at_a_time = 1; + } + if (!flag_toplevel_reorder) + { + if (flag_section_anchors == 1) + error ("Section anchors must be disabled when toplevel reorder is disabled."); + flag_section_anchors = 0; } - if (!no_unit_at_a_time_default) + if (!optimize) { - flag_unit_at_a_time = 1; - if (!optimize) + flag_merge_constants = 0; + + /* We disable toplevel reordering at -O0 to disable transformations that + might be surprising to end users and to get -fno-toplevel-reorder + tested, but we keep section anchors. */ + if (flag_toplevel_reorder == 2) flag_toplevel_reorder = 0; } -- 2.30.2