[llvm-dev] LLVM AArch64 backend using stack pointer to reference local variables

Momchil Velikov via llvm-dev llvm-dev at lists.llvm.org
Fri Feb 28 02:39:38 PST 2020


On Fri, Feb 28, 2020 at 6:17 AM Yonghae Kim via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Is there any reasons that the only LLVM AArch64 uses a stack pointer?
>

Using the stack pointer frees up the register, which would have been used
as a frame pointer,
for general allocation.

When accessing the stack frame, offsets from SP are positive, whereas
offsets from a frame
pointer are negative.
When you use SP, you can use LDR with a scaled positive offset, with range
from 0
up to 16380 (or 32760 for 64-bit accesses).
If you use FP, you would use, LDUR with a negative offset, with a range
just [-256, 255].

What downsides of using SP do you see?

~chill
-- 
Compiler scrub, Arm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200228/902220b7/attachment.html>


More information about the llvm-dev mailing list