[llvm-commits] [llvm] r106662 - /llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
Bob Wilson
bob.wilson at apple.com
Thu Jun 24 09:02:09 PDT 2010
On Jun 24, 2010, at 8:27 AM, Rafael Espindola wrote:
>> Wow, this is a pretty bad limitation. Does GCC have the same limitation?
>
> Not sure if I am testing the right thing, but compiling
>
> int f(void);
> int g(void) {
> asm ("" : : : "r7");
> return f();
> }
>
> I get
>
> g:
> @ args = 0, pretend = 0, frame = 0
> @ frame_needed = 0, uses_anonymous_args = 0
> stmfd sp!, {r7, lr}
> ldmfd sp!, {r7, lr}
> b f
> .size g, .-g
>
> I don't know much about thumb2, why can't the linker make this work?
The B instruction does not support ARM/Thumb interworking, so if functions f and g are compiled with different instruction sets, the linker would need to insert a stub. The stub would need to load the address of the target into a register and do a BX to it. That would certainly negate any advantage from the tail call transformation, although hopefully the common case would not require interworking. Does the GNU linker do that?
More information about the llvm-commits
mailing list