[LLVMdev] Implementing llvm.memory.barrier on PowerPC

Evan Cheng evan.cheng at apple.com
Tue Jul 29 00:35:34 PDT 2008


On Jul 25, 2008, at 3:57 AM, Gary Benson wrote:

> Hi all,
>
> I want to implement llvm.memory.barrier on PowerPC.  The
> implementation would be the single instruction "sync", but
> currently it's defined with:
>
> setOperationAction(ISD::MEMBARRIER, MVT::Other, Expand)
>
> in lib/Target/PowerPC/PPCISelLowering.cpp, which causes it
> to be a noop.  I replaced the "Expand" with "Legal" in the

That's not necessary. You can just remove this line. The default  
action is "legal".

>
> hope I'd get an error message that'd point me to where I
> need to start adding stuff, but I just got the cryptic:
>
>  Cannot yet select: 0x10fc0500: ch = MemBarrier 0x10fc0368,  
> 0x10fc0698, 0x10fc0610, 0x10fc0698, 0x10fc0698, 0x10fc0698".
>
>
> Can anyone point me in the right direction?


You need to add a pattern to match "membarrier" (see Target/ 
TargetSelectionDAG.td) to the right target instruction(s) in  
PPCInstrInfo.td. You can take a look at the examples in X86InstrSSE.td.

Evan

>
>
> Cheers,
> Gary
>
> -- 
> http://gbenson.net/
> _______________________________________________
> 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