This is the mail archive of the
mailing list for the GCC project.
Does -flto give gcc access to data addresses?
- From: Jeff Prothero <jprother at altera dot com>
- To: <gcc at gcc dot gnu dot org>
- Date: Thu, 11 Sep 2014 13:17:20 -0700
- Subject: Does -flto give gcc access to data addresses?
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=softfail (sender IP is 184.108.40.206) smtp dot mailfrom=jprother at altera dot com;
Hi, I'm having trouble based on available docs like
in understanding just what the gcc LTO framework is
intended to be architecturally capable of.
As a concrete motivating example, I have a 32K embedded
program about 5% of which consists of sequences like
This is on a 32-bit RISC architecture (Nios2) with 16-bit
immediate values in instructions where in general a
is required to assemble an arbitrary 32-bit address in
registers for use.
However, if the high half of the address happens to be
zero, (which is universally true in this program because
code+data fit in 64KB -- forced by hardware constraints)
we can collapse
saving two instructions. (On this architecture
R0 is hardwired to zero.)
This seems like a natural peephole optimization at
linktime -- *if* data addresses are resolved in some
(preliminary?) fashion during linktime code generation.
Is this a plausible optimization to implement in gcc
+ binutils with the current -flto support architecture?
If so, what doc/mechanism/approach/sourcefile should
I be studying in order to implement this?
If not, is there some other productive way to tickle
gcc + binutils here?
Thanks in advance,