This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Label alignments in shorten_branches
- From: Bernd Schmidt <bernds_cb1 at t-online dot de>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, Joern Rennecke <amylaar at spamcop dot net>
- Date: Mon, 30 Mar 2009 15:53:21 +0100
- Subject: Label alignments in shorten_branches
Revision 18357, in 1998, introduced a mechanism to keep track of label
alignments during shorten branches. It tries to determine the known
alignment at every point in the function, and compute the amount of
padding needed at every label.
The problem is, to do this, we need to know the exact length of every
instruction. The Blackfin has a few patterns where the length attribute
gives a maximum rather than an exact value, but even if the machine
description is 100% accurate, there is in general no way of knowing the
exact length of an asm statement.
I have a testcase where the compiler produces an assembly file that has
an out-of-range jump, because it thought the label at the start of a
jump table (which has an alignment of 4) needs no padding, when in fact
it needs 2 bytes of padding.
Can anyone think of a way to make this code work, or should I just post
a patch to mostly revert 18357?
Bernd
--
This footer brought to you by insane German lawmakers.
Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen
Sitz der Gesellschaft Muenchen, Registergericht Muenchen HRB 40368
Geschaeftsfuehrer Thomas Wessel, William A. Martin, Margaret Seif