[LLVMdev] Big endian ARM?

Richard Pennington rich at pennware.com
Sat Jun 2 08:20:03 PDT 2012


Hi,

I've been trying to set up clang/LLVM to compile for big endian ARM and I need 
a little help. The code generation works for the most part and most of my 
regression tests pass, but I noticed that code like this

extern void g(void);
int *p; 
        
int main()
{       
    if (*p & 0x01000000) g();
}       

generates

        ldr     r0, [r0]
        ldrb    r0, [r0, #3]
        tst     r0, #1

i.e. the test of the value is optimized to use a byte load, but the ldrb is 
done assuming a little endian address space.

I've been snooping around, but can't seem to find where the conversion to a 
byte operation is done. Could someone point me in the right direction?

-Rich



More information about the llvm-dev mailing list