Problem.
I'm having trouble with finding appropratie API for finding
<ty> in instructions like %add = add <ty> <op1> <op2> or %cmp = icmp <cond> <ty> <op1> <op2>.
Why It is needed.
For a given instruction %cmp = icmp <cond> <ty> <op1> <op2>,
if I have <ty>, type constraints {Env(<op1>) = <ty>}, {Env(<op2>)= <ty>} can be added, instead of merely adding {Env(<op1>) = Env(<op2>)}(Although I guess the latter one can be enough for this assignment).
What have I tried
Using Llvm.type_of on %cmp gives the type of %cmp (thus always i1), not the type of operands.
Also Llvm.operand seemed not capable of returning <ty>, as it only returns <op1>, <op2>, ....
I've taken some time to throughly check through LLVM Ocaml binding and LlvmUtils, but really couldn't find one.
If there is any possible method, can you help me out? Thanks!
Hi,
Problem. I'm having trouble with finding appropratie API for finding
<ty>
in instructions like%add = add <ty> <op1> <op2>
or%cmp = icmp <cond> <ty> <op1> <op2>
.Why It is needed. For a given instruction
%cmp = icmp <cond> <ty> <op1> <op2>
, if I have<ty>
, type constraints{Env(<op1>) = <ty>}, {Env(<op2>)= <ty>}
can be added, instead of merely adding{Env(<op1>) = Env(<op2>)}
(Although I guess the latter one can be enough for this assignment).What have I tried Using
Llvm.type_of
on%cmp
gives the type of%cmp
(thus alwaysi1
), not the type of operands. AlsoLlvm.operand
seemed not capable of returning<ty>
, as it only returns<op1>, <op2>, ...
. I've taken some time to throughly check through LLVM Ocaml binding and LlvmUtils, but really couldn't find one.If there is any possible method, can you help me out? Thanks!