[LLVMdev] get the identifies of the unnamed temporaries from the instruction of LLVM IR

Sean Silva silvas at purdue.edu
Tue Apr 9 12:49:48 PDT 2013


Value::dump() just calls Value::print(raw_ostream &OS), which you can call
with a raw_string_ostream or raw_svector_ostream, but it's a pretty
expensive operation (O(instructions + BB's)) meant for debugging. Printing
a single instruction like that essentially requires a linear scan of the
entire function to calculate the numbers. The AsmWriter doesn't use
Value::print to generate the names (it's actually the other way around:
Value::print essentially instantiates a complete AsmWriter just to get the
name of a single Value).

Like it says at that FAQ, the numbers are not stored explicitly in the
in-memory IR. Look in lib/IR/AsmWriter.cpp. especially Value::print() and
the SlotTracker class (which is what actually calculates the numbers).

Also, be aware that the numbers can change if you insert instructions/BB's
into the function.

-- Sean Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130409/4455be0f/attachment.html>


More information about the llvm-dev mailing list