This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[LTO] Patch to implement -flto-single (-flto-test) switch in gcc driver

This patch adds the missing '-flto-test' functionality to the 'gcc'
driver for LTO.
Diego strongly objected to the name '-flto-test' as used in the LTO driver
specification and in an earlier version of this patch.  He suggested
as a more descriptive name, and I have followed his suggestion here.

The intent of '-flto-single' is that 'gcc -flto-single' should behave
in a manner
functionally identical to 'gcc' without any LTO options.  In order to
exercise the
externalization and internalization of the IR, however, the usual compilation
pipeline via 'cc1' takes a detour through 'lto1'.  In this manner,  substantial
applications can be used as test cases by adding only a single flag to their
makefiles. Note that use of '-flto-single' does not enable testing the proper
combining of multiple compilation units in 'lto1'.  Furthermore, when compiling
a single source file all the way to an executable, simply performing a compile
and link with the '-flto' option achieves essentially the same effect in a more
satisfactorily end-to-end manner.  Thus it is unclear what value '-flto-single'
will have once LTO is functionally complete.

I could not find a way to deal with the '-flto-single' option within the specs
language implemented by 'gcc'.   I thus extended the specs language
to permit a spec function to be invoked as a predicate within the %{} construct,
for example:


An empty string (or NULL) returned from the function counts as false,
while all other values count as true.

       * gcc.c: (lto_single): New variable.  Flag to indicate
       lto-single mode.
       (LINK_COMMAND_SPEC,cc1_options): Add support for
       lto-single mode.
       (invoke_lto_single): New constant.
       Specs string to run hidden lto1 pass.
       (default_compilers): Add support for lto-single
       mode in specs for C compilations.
       (static_specs): Add entry for invoke_lto_single.
       (process_command): Recognize -flto-single option.
       (handle_spec_predicate): Parse and invoke spec predicate,
       similar to spec funtion.
       (handle_braces): Implement conditional on spec predicates.
       (lto_single_spec_predicate): New function. Spec predicate
       to test for lto-single mode.

Attachment: lto-single-patch.txt
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]