<div dir="ltr"><div dir="ltr"><div dir="ltr">Hi<div><br></div><div>I use LLVM/Clang to compile some program.</div><div><br></div><div>I found that if we use -O0 flag, the program will use ebp to access local variables.</div><div><br></div><div>For example :  mov ecx,DWORD PTR [ebp-0x8]</div><div><br></div><div>If we use -O2 flag, the program will use esp to access local variables.</div><div><br></div><div>For example : mov eax,DWORD PTR [esp+0x8]</div><div><br></div><div>Is there any different between them?</div><div><br></div><div>Can user decide esp or ebp to access the local variable?   <br></div><div><br></div><div>Or can I modify LLVM backend code to do it?</div><div><br></div><div>Is there any calling convention related to it?</div><div>I  found it is the same in gcc.</div><div><br></div><div>Thank you!</div></div></div></div>