[LLVMdev] Lowering intrinsic that return an int1

Jobin, Gaël gael.jobin at switzerlandmail.ch
Wed Apr 29 00:13:32 PDT 2015


 

Le 28.04.2015 16:55, Mehdi Amini a écrit : 

>> Yes the first operands are the destinations (MI can produce multiple values). 
>> 
>> The instruction selector will always use a vreg to select your instruction, you don't have anything to do. 
>> The custom inserter is executed before register allocation, and it is the role of the RA to turn the vreg into a physical one, 
>> 
>> The physical registers that you can see at this point are mainly here to implement the ABI AFAIK.
> 
> I should also add that I don't know what you're trying to achieve, but keep in mind that some scheduling and optimizations will run after this point. 
> Depending on the end result you are seeking, you might need to your expansion later.

Thank's a lot, it nearly works ! 

My intrinsics now: 

_def int_antivm2 : Intrinsic<[llvm_i8_ty], [llvm_ptr_ty], [],
"llvm.antivm2">;_ 

My "backend" intrinsics: 

_let usesCustomInserter = 1, isPseudo = 1, Defs = [EFLAGS, EAX, ECX,
EDX, EBX] in {_
_def ANTIVM : PseudoI<(outs GR8:$dst), (ins i32mem:$src), [(set
GR8:$dst, (int_antivm2 addr:$src))]>;_
_}_ 

As I understand ANTIVM: 

- It returns an int8 into a one byte register (_GR8_) 

- It receives a pointer stored on memory (_i32mem_) 

- _[(set GR8:$dst, (int_antivm2 addr:$src))]_ match two DAGNode that
corresponds to _int_antivm2_ translation into SelectionDAG node 

Am I right? I constructed both by try-and-error based on example I found
here and there. 

Seems to work well when returning a _llvm_i8_t_y but I got a
"PromotionInteger error" with _llvm_i1_ty_. I tried to also change "GR8"
to "VK1" (seems to be a register of one bit) in the second one, but
without success. Any idea? 

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


More information about the llvm-dev mailing list