AArch64Address.lea missed BASE_REGISTER_ONLY case

Andrew Dinn adinn at redhat.com
Thu Mar 1 11:32:48 UTC 2018

On 01/03/18 11:03, Gilles Duboscq wrote:

> These `lea` method seem a bit strange: they accept an address but 
> choke on most `AddressingModes`.

They only choke on modes which make no sense. lea is there to do address
arithmetic -- whether the addend is a register value to be added to a
base register, a small constant to be added to the base register or a
potentially larger offset to be added to the PC. Passing in a
BASE_REGISTER address makes no sense because there is no arithmetic to
do in that case. It is essentially like asking to add 0 to an address to
get another address. While it is clear you can implement this as a
synonym for move I see no benefit in providing it as an alternative.

Comparing with AMD64 is a bit of a red herring because AMD64 is not
really a RISC architecture. It supports memory operations with complex
addresses that must be computed via address arithmetic on AArch64.

> Also, if you look at the AMD64 or SPARC addresses, instead of having
> an `AddressingMode` field, the addressing mode is derived from the
> state of the base, index, scale etc. fields.

Well, as I said AArch64 is not really comparable to AMD64 because it is
a much simpler RISC architecture. The way Graal models addresses allows
for all of base + reg + index + scale because AMD64 allows them all to
be present at once and independently. However, with AArch64 you cannot
employ both a register offset and immediate offset -- it is one or the
other -- scaling is related to the granularity of the datum being loaded
or stored etc. So, you really need to be careful drawing conclusions
about one from the other.


Andrew Dinn
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander

More information about the graal-dev mailing list