[PATCH] D32564: AArch64: compress jump tables to minimum size needed to reach destinations

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 09:36:59 PDT 2017


On 26 April 2017 at 16:33, Eli Friedman via Phabricator
<reviews at reviews.llvm.org> wrote:
> If you're looking to save size, we could put the jump table into the text segment just after the branch, and compute the jump destination in three instructions: one to load the address of the table, one to load the offset from the table, and one to add the offset to the address of the table.  Is there some reason we shouldn't do that?

To get that first load down to 1 instruction we'd need to guarantee
the jump table was within 128MB of the code, and I think we
technically support larger functions. So we'd have to add something
like ARM's full Constant Island pass instead of the newly generic
branch relaxation we currently do. I don't think that is worth the
maintenance burden, it's a constant source of bugs on ARM.

For the second offset addition, again you're compromising distance.
The jump table itself then has to be within 256 or 65536 bytes of
every basic block used. I suspect that even *with* complex placement
that would be tough to arrange.

Cheers.

Tim.


More information about the llvm-commits mailing list