This is the mail archive of the
mailing list for the GCC project.
Infrastructure for long branches?
- From: lucier at math dot purdue dot edu
- To: gcc at gcc dot gnu dot org
- Cc: lucier at math dot purdue dot edu
- Date: Thu, 7 Feb 2002 17:37:02 -0500 (EST)
- Subject: Infrastructure for long branches?
I just filed PR target/5626 (seems to be "test gcc" day today). The problem
is that the displacements for sparcv9 branches are shorter than the
displacements for the "same" sparcv8 branches (19 bits versus 22 bits),
where "same" means that they use the same assembler mnemonics but are
actually different instructions, since the sparcv9 versions are "predicted"
branches which are predicted taken if the prediction is not explicitly
noted in the assembley. This reduces the jump range from
+- 8 MB to +- 1 MB. Similarly, sparcv9 introduces some new branches that
have only a 16-bit displacement, with a jump range of +- 128 KB.
PR 5626 is about these new sparcv9-specific branches. I managed to
compile the test .i file with Solaris cc (version 5.0 of the compiler
suite), but then I got a crash when I tried to compile another file
with > 1MB jump displacements. My interpretation of this is that the
Solaris compiler doesn't use the new sparcv9 branch instructions, but does
use the sparcv9 versions of the sparcv8 branch instructions, and gets
hosed in the same way, just with a larger file.
This problem of generating code for jumps with displacements larger
than can be held in the displacement field of the branch instruction
is a generic problem, and is discussed, for example, in every compiler
class. And I'm sure that there are ports of gcc where this problem
is addressed (I think I found it in the sh port, but I can't remember
right now). So I have some questions:
1. Is there generic code somewhere in the gcc code base to handle this
generic problem? Can this code be adapted to the sparc?
2. I don't know how I, personally, would fix this problem. Would the
gcc maintainers entertain a patch that introduces a new -m flag to
disable sparcv9 branches? This
would be somewhat tricky since the sparcv8 branch instructions are
deprecated in sparcv9, and since the two families of instructions use
the same mnemonics, one would have to introduce new mnemonics into gas,
and one wouldn't be able to use Solaris as with this flag, etc. Blah.