[llvm-dev] (in x86, ) Use ebp or esp to access local variable? what's different? (original) (raw)

PenYiWang via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 22 21:39:30 PST 2019


Hi

I use LLVM/Clang to compile some program.

I found that if we use -O0 flag, the program will use ebp to access local variables.

For example : mov ecx,DWORD PTR [ebp-0x8]

If we use -O2 flag, the program will use esp to access local variables.

For example : mov eax,DWORD PTR [esp+0x8]

Is there any different between them?

Can user decide esp or ebp to access the local variable?

Or can I modify LLVM backend code to do it?

Is there any calling convention related to it? I found it is the same in gcc.

Thank you! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190123/a93c990f/attachment.html>



More information about the llvm-dev mailing list