I am working on a project which requires me to generate asm code from llvm ir.
When I using llc
to generate code directly from .ll
file, the assembly doesn't have frame pointer fp
. However, when I use the riscv-unknow-elf-gcc to compile .cpp
file, it does have a frame pointer.
Searching online, I found that there is -fomit-frame-pointer
argument when compiling.
I just thought that the frame pointer is unnecessary for riscv asm, as we actually know the begin and the end of the function frame. And using a frame pointer to express a stack variable has no difference with using the stack pointer sp
.