[LLVMdev] Check the location of the definition of a Value object
Zheng Wang
jason.wangz at gmail.com
Thu Apr 8 09:19:40 PDT 2010
Hello,
How to check whether a value object is within a particular basic block or not.
I have the following LLVM bytecode:
------------------------
entry:
...
%2 = call i32 (...)* @atoi(i8*%1) nounwind
...
--
bb1:
..
%5 = icmp sgt i32 %2, %i.0
...
-----------------
Here I got the corresponding pointer of the Value object of *%2*. How
can I check whether it is defined in *entry* or not?
I tried:
---------------------
//Value* pb corresponding to %2
for (BasicBlock::iterator I=entry->begin(), e=entry.end(); I != e; I++)
{
if (I == pb)
return true;
}
return false;
----------------------
However, I got errors when compiled the code. Could anyone give some
simple examples about this issue?
Thanks.
Cheers,
Zheng
More information about the llvm-dev
mailing list