[LLVMdev] finding where a Value was initially assigned

lists lists at khalota.net
Sun Dec 16 13:41:04 PST 2007


Dear all,

I'm trying to locate all instances of a specific function call,
identify one of it arguments and find where it was declared and
defined.

i can visit every instruction in each function, identify the
appropriate CallInst, get the CallSite of the instruction and extract
the appropriate (Value) argument with getArgument(X). Unfortunately I
can't figure out how to get from the Value of the argument to its
definition/assignment site.

I would ideally like to be able to display its original value and the
line number of the assignment. To complicate matters further, the
variable's a character array.

I'm going to be switching to clang soon as it's probably more
appropriate for what i'm doing but I'd love some hints on how to do
this with llvm in the meantime.

thanks for any info and apologies if this is a dumb question, i've
chased up all sorts of false leads before posting but my c++ foo is
still pretty weak :(

arthur.



More information about the llvm-dev mailing list