[LLVMdev] Building VMKit - ARM AtomicCmpSwap

Xerxes RĂ„nby xerxes at zafena.se
Tue Mar 15 03:50:03 PDT 2011


On 2011-03-10 22:32, Andrew Wiley wrote:
> I tried to build VMKit on an ARM device today (a Sheevaplug - armv5te)
> (native, not cross compiled), and got this error:
>
> llvm[3]: Building LLVM assembly with
> /home/debio/build/vmkit-build/vmkit/lib/Mvm/Runtime/LLVMAssembly.ll
> /home/debio/build/vmkit-build/vmkit/lib/Mvm/Runtime/LLVMAssembly64.ll
> ExpandIntegerResult #0: 0x16fbf88: i64,ch = AtomicCmpSwap 0x16e8d84,
> 0x16fbf00, 0x16fc3c8, 0x16fc1a8<Volatile LDST8[%ptr]> [ORD=4] [ID=0]
>
> Do not know how to expand the result of this operator!
> UNREACHABLE executed at LegalizeIntegerTypes.cpp:982!
> Stack dump:
> 0.      Program arguments:
> /home/debio/build/vmkit-build/vmkit/../llvm//Debug+Asserts/bin/llc -o
> LLVMAssembly.s
> 1.      Running pass 'Function Pass Manager' on module '<stdin>'.
> 2.      Running pass 'ARM Instruction Selection' on function
> '@llvm_atomic_cmp_swap_i64'
>

Hi this JIT bug are a long standing unimplemented issue on ARM.
http://llvm.org/bugs/show_bug.cgi?id=3877

>
> I was following the instructions from
> http://vmkit.llvm.org/get_started.html although I didn't build my own
> classpath, as I have a packaged version installed and I was waiting to
> see whether configure would pick it up automatically. From what I can
> tell, that doesn't seem relevant to this error.
> Is this something that just isn't supported on my platform, is the
> trunk build currently broken somehow, or am I just doing it wrong?
>
> Thanks,
> Andrew Wiley
To fix this you have to implement the missing atomic intrinsics on ARM.

Gary Benson did implement the missing intrinsics on PPC in 2008 and you might use this old conversation thread to guide you on how to implement it on ARM.
http://markmail.org/message/73owc5nrvsbmrhes#query:+page:1+mid:73owc5nrvsbmrhes+state:results

Before ARMv7 there exist a SWP instruction.
On ARMv7 and later you can use LDREX and STREX instructions.
http://www.doulos.com/knowhow/arm/Hints_and_Tips/Implementing_Semaphores/

Cheers
Xerxes




More information about the llvm-dev mailing list