[LLVMdev] Is there a way to address an instruction?

Guoliang Jin jingl1345 at gmail.com
Tue Jul 27 11:06:59 PDT 2010

>> In the objdump for binary, there is always an address associated with an
>> instruction.
>> In the bitcode file, is there a way to address an instruction? It does
>> not have to be a single ID like objdump.
> no, there is no way in general.  You can always start a new basic block
> just before your instruction and take the address of that basic block.
> However later optimizations may move your instruction out of the basic
> block.  What do you want this for?
Suppose I magically know that some instruction need special attention 
after reviewing one .ll file. Then I have a tool will handle them. The 
problem is how should I name that instruction so that my tool can 
identify it?

One way I can think of is using a triplet: function_name, the number of 
iterations to go to the block, and finally the number of iterations to 
reach the instruction.

I also noticed some instructions have name associated. But I cannot find 
too much about instruction name. If this is the way to go, then I have 
concern that whether two instructions will have the same name, and also 
I noticed some instructions do not have names.


More information about the llvm-dev mailing list