Hi, Suppose I have llvm Instruction as : %9 = load i32* %b, align 4 and I want to extract the name of temporary value used here ie 9. Can any body tell that how can I do that? thanks and regards, Ambika
Andrew Lenharth
2010-Apr-15 17:59 UTC
[LLVMdev] How to extract Left Hand side of Instruction
On Thu, Apr 15, 2010 at 12:46 PM, ambika <ambika at cse.iitb.ac.in> wrote:> Hi, > > Suppose I have llvm Instruction as : > > %9 = load i32* %b, align 4 > > and I want to extract the name of temporary value used here ie 9. > Can any body tell that how can I do that?Values can be unnamed, they are numbered for convenience. If they do have a name, you can call getName() or getNameStr() to find out the name. Andrew> thanks and regards, > Ambika > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
John Criswell
2010-Apr-15 19:00 UTC
[LLVMdev] How to extract Left Hand side of Instruction
ambika wrote:> Hi, > > Suppose I have llvm Instruction as : > > %9 = load i32* %b, align 4 > > and I want to extract the name of temporary value used here ie 9. > Can any body tell that how can I do that? >I believe it's the getNameStr() method. Note that not all instructions have names (i.e., getNameStr() might give you an empty string). I think the LLVM disassembler prints a number when the instruction has no name. There's a pass which, I think, gives names to all values, but I don't recall the pass's name. -- John T.> thanks and regards, > Ambika > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
On Apr 15, 2010, at 12:00 PM, John Criswell wrote:> ambika wrote: >> Hi, >> >> Suppose I have llvm Instruction as : >> >> %9 = load i32* %b, align 4 >> >> and I want to extract the name of temporary value used here ie 9. >> Can any body tell that how can I do that? >> > > I believe it's the getNameStr() method. > > Note that not all instructions have names (i.e., getNameStr() might give > you an empty string). I think the LLVM disassembler prints a number > when the instruction has no name. > > There's a pass which, I think, gives names to all values, but I don't > recall the pass's name.There is, though it's purely for cosmetic purposes, so it shouldn't be a dependency. In the C++ API, values are identified by Value*, rather than by name. The Value* for a load is the LoadInst* itself. Because this is SSA, there are no other definitions of that value. Dan
Apparently Analagous Threads
- [LLVMdev] How to extract Left Hand side of Instruction
- [LLVMdev] Figuring out the parameters of the Call Instruction
- [LLVMdev] [Fwd: Can someone help me with error while i make my own pass]
- [LLVMdev] [Fwd: Can someone help me with error while i make my own pass]
- [LLVMdev] A very basic doubt about LLVM Alias Analysis