[llvm-dev] Thumb frame pointer register

Son Tuan VU via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 20 22:04:29 PDT 2019


Hello all,

I noticed that for ARM Thumb target, llc uses r7 as frame pointer (gcc does
not do this AFAIK), and this register should therefore not be used as a
general-purpose register.

However, when compiling mbedTLS, which contains some code that is highly
optimized for ARM platform and uses r7 to efficiently perform an operation.
This raises an exception since r7 is now the frame pointer.

I tried passing -fomit-frame-pointer but this is just a hacky workaround
and does not work in this case, since the function here does indeed need
frame pointer.
```
The -fomit-frame-pointer option instructs the compiler to not store stack
frame pointers if the function does not need it. You can use this option to
reduce the code image size.
```

My question is, how can I instruct the register allocator to use another
register as frame pointer, or at least turn off the use of frame pointer? I
tried changing the ABI with -mabi and -meabi but nothing works so far.

Thanks a lot for your help,

Cheers,

Son Tuan Vu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190821/489f72d3/attachment.html>


More information about the llvm-dev mailing list