[LLVMdev] obtaining the address of an instruction...?

Gordon Henriksen gordonhenriksen at mac.com
Sat Nov 3 22:22:25 PDT 2007


On Nov 4, 2007, at 01:00, Mark Oskin wrote:

> I'm currently working on a compiler pass, where it would be vastly
> simplified if I could obtain the address of an instruction.  Any
> suggestions on how to do this?  Effectively, I'm trying to translate
> code that looks like this:
>
> instruction
> branch
>
> into:
>
> instruction
> call somewhere(&branch)
> branch

Hi Mark,

The LLVM IR does not directly support this. If you elaborate upon what  
you're trying to accomplish, perhaps the list can suggest an approach  
that'll work for you.

The MachineFunction representation does allow labels to be inserted to  
refer to arbitrary instructions.

— Gordon





More information about the llvm-dev mailing list