[LLVMdev] atomic operations for ARM

Robert Schuster theBohemian at gmx.net
Wed Mar 25 19:42:11 PDT 2009


Hi,
I am missing atomic operations support for the ARM backend (see PR
#3887) and started trying to implement them.

Since this is the first time that I work on such stuff (and llvm) I am
going to take the supposedly easy route and provide an implementation
that will work on Linux systems.

This involves calling a special function which the kernel handles
itself. Details here:
http://gcc.gnu.org/ml/gcc-patches/2008-07/msg00025.html

In order to extend the implementation within LLVM I read the respective
documentation. After taking a longer look at how its done for x86 and
ARMInstrInfo.td I came up with the following:

let isCall = 1,
  Defs = [R0, R1, R2, R3, R12, LR,
          D0, D1, D2, D3, D4, D5, D6, D7, CPSR] in {
  def ARM_KERNEL_CMPXCHG : ABXI<0b1011, (outs), (ins i32:$oldval,
i32:$newval, addr:$dst),
               "bl 0xffff0fc0",
               [(ATOMIC_CMP_SWAP addr:$dst, i32:$oldval, i32:$newval)]>;
}

This is probably far from being correct but thats because I could not
find some things:

Can I actually use 'i32' and 'addr' is shown above?

The line with 'ABXI' has most likely something to do with binary code
generation, right? Now I wonder how to tell it, that the function at
"0xffff0fc0" is to be called.

Any help is appreciated. :)

Regards
Robert

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090326/fc789661/attachment.sig>


More information about the llvm-dev mailing list