Is there a way through the Value class to get the identifier for an unnamed temporary? Or alternatively, could someone point me to the code where temporaries are assigned sequential numbers as identifiers so I can better understand this issue? Thanks, Scott
On Jul 2, 2009, at 2:24 PM, Scott Ricketts wrote:> Is there a way through the Value class to get the identifier for an > unnamed temporary? Or alternatively, could someone point me to the > code where temporaries are assigned sequential numbers as identifiers > so I can better understand this issue?hi Scott, 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? -Chris
On Thu, Jul 2, 2009 at 2:24 PM, Scott Ricketts<sricketts at maxentric.com> wrote:> Is there a way through the Value class to get the identifier for an > unnamed temporary? Or alternatively, could someone point me to the > code where temporaries are assigned sequential numbers as identifiers > so I can better understand this issue?The relevant code is llvm/lib/VMCore/AsmWriter.cpp. That said, you shouldn't really need them anywhere; what are you trying to do? -Eli
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? Thanks, Scott