makeAddress and large frame sizes

D.Sturm D.Sturm42 at gmail.com
Tue Apr 29 14:49:17 UTC 2014


Hi,
This is a bit complicated, but I hope I can make the problem
comprehensible.

The Aarch64 ISA only allows a 9-bit signed unscaled offset added to a
register for memory accesses. Consequently for stacks that are larger than
2^8 byte we have a problem when using AbstractAssembler.makeAddress to
access something on the stack with an offset larger than 256 bytes. (SPARC
seems to have the same problem and seems to just ignore the problem -
13-bit signed offsets work fine for all JTT tests I guess)

I can solve that problem when loading values from the stack since I can use
the result register as a scratch register (and don't
use CompilationResultBuilder.asAddress but compute the stack offset myself).

But when storing values *into* the stack I really need to allocate a
temporary register if the offset is too large. Always allocating a scratch
register even if I only need it in case of a large stack and worse even for
reg->reg moves since I don't know whether the register allocator will
actually use a register for the destination and not a stackslot when
generating LIR instructions seems like a really unfortunate solution.

I was thinking I could specify a scratch register for all moves and then
in beforeRegisterAllocation() remove the load if I can guarantee that the
stack won't be too large (hard since I don't know how many registers the
register allocator will have to spill? some heuristic seems necessary).

Sounds reasonable or any problems with that approach? Or maybe some
completely different solution?


--Daniel


More information about the graal-dev mailing list