[LLVMdev] Lowering intrinsic that return an int1

Jobin, Gaƫl gael.jobin at switzerlandmail.ch
Tue Apr 28 01:18:51 PDT 2015


 

Hi all, 

I'm playing with intrinsics and I was wondering how to lower an
intrinsic that should return, for example, an int1? More precisely, how
to return the value when working with MachineInst? 

First, I have defined an instrinsic in "Intrinsics.td": 

_def int_antivm : Intrinsic<[llvm_i1_ty], [], [], "llvm.antivm">;_ 

Then I want to lower it in the X86 backend, so I defined a pseudo
instruction in "X86InstrCompiler.td": 

_let usesCustomInserter = 1, Defs = [EFLAGS] in {_
_def ANTIVM : PseudoI<(outs), (ins), [(int_antivm)]>;_
_}_ 

I wrote my custom inserter: 

_MachineBasicBlock *_
_X86TargetLowering::EmitANTIVMWithCustomInserter(_
_ MachineInstr *MI,_
_ MachineBasicBlock *MBB) const {_

_ // Some stuff, _

_ MI->eraseFromParent(); // The pseudo is gone now._
_ return BB;_
_}_ 

Should I put the return value to EAX (like for a standard function) ? 

Thank you for your help. 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150428/be81034a/attachment.html>


More information about the llvm-dev mailing list