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

David Spickett via llvm-dev llvm-dev at lists.llvm.org
Fri Feb 28 01:49:34 PST 2020


Hi Yonghae,

Could you provide a short example for this? Perhaps using https://godbolt.org/
(there is now a "ARM 64-BIT CLANG" compilers section)

I see some details about the frame pointer in:
llvm-project/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp

Though I haven't read it properly yet, it seems like it's not a simple case of not using it at all. It depends on circumstance.

Thanks,
David Spickett.
________________________________
From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Yonghae Kim via llvm-dev <llvm-dev at lists.llvm.org>
Sent: 27 February 2020 01:27
To: llvm-dev at lists.llvm.org <llvm-dev at lists.llvm.org>
Subject: [llvm-dev] LLVM AArch64 backend using stack pointer to reference local variables

Hi all,

I am wondering whether there is any way
(i.e., compile option or different version of backend code that can be referred to)
to make the LLVM AArch64 backend use the frame pointer instead of the stack pointer
when it references (or locates) local variables in a stack frame.

When I generate assembly code using LLVM AArch64 backend,
it seems to use a stack pointer to locate the local variables in a stack frame.

For example,
  ....
  str wzr, [sp, #12]    // e.g., local variable a
  str w8, [sp, #8]      // e.g., local variable b
  str w9, [sp, #4]      // e.g., local variable c
  str w10, [sp]
  …

(It calculates offsets from a stack pointer and accesses the local variable using the stack pointer and the offsets.)

The weird thing is all the other compiler tools are using a frame pointer rather than a stack pointer.
I tried out "gcc", "clang", "LLVM x86 backend" and they are all referencing local variables using a frame pointer and its offsets.

Is there any reasons that the only LLVM AArch64 uses a stack pointer?
And, is there any way to make it use a frame pinter?

I'd really appreciate for any comment or answer! :)

Regards,
Yonghae
_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200228/ebb1c66a/attachment.html>


More information about the llvm-dev mailing list