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 thanks, -mark
Gordon Henriksen
2007-Nov-04 05:22 UTC
[LLVMdev] obtaining the address of an instruction...?
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) > branchHi 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
Thanks. But I found a work around (some nasty switch hack). On Nov 3, 2007, at 10:22 PM, Gordon Henriksen wrote:> 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 > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev