This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [LTO][PATCH] Add lang-hooks for LTO operation modes.
Doug Kwan (éæå) wrote:
This the second attempt. I eliminated the lang-hooks. Now the
driver takes 4 LTO options.
-flto
-flto-single
-fwpa
-fltran
Excellent, I like this version better, thanks.
2008-09-18 Doug Kwan <dougkwan@google.com>
* gcc.c (gcc_lto_option_t): New type.
(current_lto_option): New variable.
(lto_single_spec_function): Remove and is replaced by ..
(lto_option_spec_function): New function.
(LINK_COMMAND_SPEC): Use link_lto_option spec instead of just
passing the -flto flag.
(cc1_options): Separate non-LTO related parts into ..
(cc1_non_lto_options): Non-LTO related options shared by all FEs.
(lto1_options): New spec for lto FE.
(link_lto_options): New spec for handling LTO flags in linker.
(invoke_lto_single): Re-format to fit in 80 column. Replace
lto-single with lto-option.
(static_specs): Add cc1_non_lto_options, lto1_options and
link_lto_options.
(static_spec_function): Replace lto-single with lto-option.
(process_command): Handle -flto, -flto-single, -fwpa and -fltran
by setting current_lto_option and not passing it to subprocess
unconditionally..
* ipa-inline.c (cgraph_decide_inlining): Do not remove hook if
LTO is running in WPA mode.
* opts.c (common_handle_option): Handle -flto, -fltran and -fwpa.
* common.opt: (flto): Reject negative.
(fltran): New option.
(fwpa): Reject negative. Update description.
* doc/invoke.text (fwpa): Update.
(fltran): New flag.
lto/ChangeLog:
2008-09-18 Doug Kwan <dougkwan@google.com>
lto.c (lto_main): Remove unsued wrapper code.
lang-specs.h (@lto): Use lto1_options instead of cc1_options.
-Disable by default.
+Disable by default. This options is only supported by the LTO frontend.
s/Disable/Disabled/
+
+@item -fltran
+@opindex fltran
+This option runs the link-time optimizer in the local-transformation (LTRAN)
s/ltran/ltrans/
s/LTRAN/LTRANS/
Happens in several other places as well.
+mode, which reads in output from a previous run of the LTO in WPA mode.
+In the LTRAN mode, LTO optimizes an object and produces the final assembly.
s/In the LTRAN/In LTRANS/
+/* LTO state. The LTO options are related and not all combination are
+ meaningful. Treat each LTO option as a state and only use the last
+ specificied option. The option may be modified before the driver passes
s/specificied/specified/
+/* NB: This is shared amongst all front-ends except lto1. */
+/* FIXME lto: -O2 is needed as a temporary workaround. Remove. */
+static const char *cc1_options =
+"%(cc1_non_lto_options)\
+ %{!?lto-option(none): -O2 -flto} ";
I *think* we should be able to remove -O2 now, since -O0 is now
operating in unit-at-a-time, but this is for another patch.
- return ((lto_single) ? "lto-single" : NULL);
+ /* We could use array element designators here but that would not
+ be compilable on a C++ compiler. */
Hmm? This should work:
static const char *const names[] = { "none", "lto", "lto-single", "wpa",
"ltran" };
OK with those changes.
Diego.