[LLVMdev] Get identifier for unnamed temporary

Scott Ricketts sricketts at maxentric.com
Thu Jul 2 15:00:44 PDT 2009

On Thu, Jul 2, 2009 at 2:48 PM, Chris Lattner<clattner at apple.com> wrote:
> VMCore will auto-unique value names for you.  Most passes just create
> all instructions with a name like "tmp" and let VMCore unique them.
> Is this enough for you?

On Thu, Jul 2, 2009 at 2:50 PM, Eli Friedman<eli.friedman at gmail.com> wrote:
> The relevant code is llvm/lib/VMCore/AsmWriter.cpp.  That said, you
> shouldn't really need them anywhere; what are you trying to do?

I am adding some instrumentation that requires me to track information
associated with llvm values. I need a good way to identify these
values by passing a unique id (can be unique within function scope) to
the instrumenting function. Let me be more clear with an example.

If I have

%3 = add i32 %1, %2

then I would like to insert a function call that will somehow log that
%3 requires %1 and %2 to be computed at this step. So my original plan
was to have my pass create a mapping of identifiers to numerical
constants, and then to pass the appropriate constants to the
instrumenting function at runtime.

Is there a better approach?


More information about the llvm-dev mailing list