[LLVMdev] bx instruction getting generated in arm assembly for O1

Jonathan Roelofs jonathan at codesourcery.com
Mon Nov 24 17:15:35 PST 2014



On 11/24/14 8:00 AM, MAYUR PANDEY wrote:
> Hi,
>
> For the following test:
>
> int (*indirect_func)();
>
> int indirect_call()
> {
>       return indirect_func();
> }
>
> when generating the assembly with clang-3.5, for -march=armv5te,  there is a
> difference in the assemblies generated with O0 and O1:
>
> In the assembly generated with O0, we are getting the "blx" instruction whereas
> with O1 we get "bx" (in 3.4.2 we used to get "blx" for both O0 and O1).
Can you post the asm that you're seeing for this function?

There's a related case to this on armv4t which Iain has a patch for, that I 
think we forgot about... The problem there is that armv4t doesn't have blx at 
all, so should be generating a sequence like: 'mov r0, ...; bx _Ltmp; _Ltmp: bl r0'.
>
> Is this because of this patch:  [llvm] r214959 - ARM: do not generate BLX
> instructions on Cortex-M CPUs
I doubt it. armv5te isn't a cortex-m processor.


Cheers,

Jon
>
> Or I am missing something.
>
> Thanks,
>
> Mayur
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>

-- 
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded



More information about the llvm-dev mailing list