[LLVMdev] How to extract Left Hand side of Instruction
Dan Gohman
gohman at apple.com
Thu Apr 15 12:22:45 PDT 2010
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
More information about the llvm-dev
mailing list