[LLVMdev] get ref to parent instruction
Óscar Fuentes
ofv at wanadoo.es
Tue Jan 8 16:28:06 PST 2013
Eduardo <erocha.ssa at gmail.com> writes:
> In instructions like the one I showed can I expect that Value::use_begin
> and Value::use_end will return only the getelementptr or there is a chance
> I will get other users of that constant?
Those methods return iterators for traversing *all* User's of the Value.
Please note that a "variable" that appears on several places on the LLVM
assembly listing is actually represented by a single C++ object.
On your specific case, as Eli suggests, you may need to recursively
traverse the Use graph, because your "variable" is being used by a
ConstantExpr that in turn is being used by the instruction you intend to
work on.
More information about the llvm-dev
mailing list