[LLVMdev] llvm.atomic.barrier implementation

Chris Lattner sabre at nondot.org
Fri Feb 15 15:05:07 PST 2008


On Feb 15, 2008, at 2:29 PM, Andrew Lenharth wrote:

> 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.

Thanks for tackling this Andrew.

Please prepare a patch for LangRef.html that explains what this thing  
does :).  What are all those bools?  Once that is available I'll  
review the rest of the llvm patch.

In the call below, you don't have to pass in 4 i1's.  Just passing in  
the intrinsic ID should be fine.  The type list is for intrinsics that  
take 'any' as an argument.

Finally, don't forget the 80 column rule.

-Chris

>
>
> 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:
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list