[LLVMdev] llvm.atomic.barrier implementation

Andrew Lenharth andrewl at lenharth.org
Fri Feb 15 14:29:01 PST 2008


On 2/15/08, Andrew Lenharth <andrewl at lenharth.org> wrote:
> I'll take a hack at the front end support for
>   __sync_synchronize after this goes in.

This is the gcc side of the patch.

Index: gcc/llvm-convert.cpp
===================================================================
--- gcc/llvm-convert.cpp        (revision 46956)
+++ gcc/llvm-convert.cpp        (working copy)
@@ -4260,6 +4260,15 @@
     EmitBlock(new BasicBlock(""));
     return true;

+  case BUILT_IN_SYNCHRONIZE: {
+    Value* C[4];
+    C[0] = C[1] = C[2] = C[3] = ConstantInt::get(Type::Int1Ty, 1);
+
+    Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
Intrinsic::atomic_membarrier),
+                       C, C + 4);
+    return true;
+  }
+
 #if 1  // FIXME: Should handle these GCC extensions eventually.
     case BUILT_IN_APPLY_ARGS:
     case BUILT_IN_APPLY:



More information about the llvm-dev mailing list