Anton Korobeynikov
2007-Mar-12 11:34 UTC
[LLVMdev] Address of an instruction (or a label?)
Hello, Nicolas.> Is there a way in llvm to get the address of a generated instruction? Or > somehow to fix the location of a label in the llvm code (something that > may look like a basic block perhaps) and get after the compilation the > address of this label?Maybe it's worth to use llvm.dbg.stoppoint? -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University.
I agree. Instead of using line numbers, with llvm.dbg.stoppoint, you could use the byte code index. Or alternatively, you could use the column number field instead (not currently managed by MachineModuleInfo.) In the backend, you can generate a machine instruction to byte code mapping table from queries to MachineModuleInfo. Cheers, -- Jim On 12-Mar-07, at 8:34 AM, Anton Korobeynikov wrote:> Hello, Nicolas. > >> Is there a way in llvm to get the address of a generated >> instruction? Or >> somehow to fix the location of a label in the llvm code (something >> that >> may look like a basic block perhaps) and get after the compilation >> the >> address of this label? > Maybe it's worth to use llvm.dbg.stoppoint? > > -- > With best regards, Anton Korobeynikov. > > Faculty of Mathematics & Mechanics, Saint Petersburg State University. > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Hi Anton, Anton Korobeynikov wrote:> Maybe it's worth to use llvm.dbg.stoppoint? > >Do you have an example on how to use this intrinsic with the JIT? How can I get at compile time the address of the stoppoint? Thx, Nicolas
After chatting with Anton, we realized that this was actually not a solution because it is not implemented in the JIT. Let me turn the question with a different angle : is there a way in llvm to force the emission of basic blocks labels, even ones that are useless, eg: load 1 load 2 add branch label "foo" foo: load 4 And there is no other jump to the "foo" label. Actually in llvm the label is just removed and the basic block does not get a native address after compilation. Cheers, Nicolas Nicolas Geoffray wrote:> Hi Anton, > > Anton Korobeynikov wrote: > >> Maybe it's worth to use llvm.dbg.stoppoint? >> >> >> > > Do you have an example on how to use this intrinsic with the JIT? How > can I get at compile > time the address of the stoppoint? > > Thx, > Nicolas > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Maybe Matching Threads
- [LLVMdev] Address of an instruction (or a label?)
- [LLVMdev] Getting address of label in jitted code[MESSAGE NOT SCANNED]
- [LLVMdev] Integrating LLVM in an existing project
- [LLVMdev] [PROPOSAL] Attach debugging information with LLVM instruction
- [LLVMdev] Integrating LLVM in an existing project