Bram Adams
2006-Sep-26 15:36 UTC
[LLVMdev] Name of Function's original module during link-time optimization
Hi, Chris Lattner wrote:> I'd suggest writing a little pass that strips out debug intrinsics. >OK, I did this and it works (the strange seg fault also disappears after all declared debug variables are gone)! In a first phase, all intrinsic instructions are discarded after extracting their data into annotations attached to the relevant Function. Then, a second phase wipes out the intrinsic instruction Functions themselves as well as all debug variables in the declaration section. This 2-phase approach is necessary as I implemented the pass as an InstVisitor. A limitation here is that only Functions' debug data can be kept, as other Values (i.e. Instructions) are not Annotable. Is this an explicit design decision? Kind regards, Bram Adams GH-SEL, INTEC, Ghent University PS: Could this pass be interesting to others? If so, I could send the code to the list or to Bugzilla.
Chris Lattner
2006-Sep-27 19:36 UTC
[LLVMdev] Name of Function's original module during link-time optimization
On Tue, 26 Sep 2006, Bram Adams wrote:> > A limitation here is that only Functions' debug data can be kept, as > other Values (i.e. Instructions) are not Annotable. Is this an explicit > design decision?Yes, we intentionally do not want things to be annotatable. In fact, Function being annotatable is a wart due to the way the code generator currently works. In general, we prefer to keep data in on-the-side maps instead of attached to the IR. The mailing list has archives of extensive discussion about this sort of thing. -Chris -- http://nondot.org/sabre/ http://llvm.org/
I find a bug in document llvm/docs/WritingAnLLVMPass.html#debughints Since the PassManager class is in the namespace llvm, we should use command (gdb) break llvm::PassManager::run to set breakpoint. Otherwise we get error message: (gdb) break PassManager::run Can't find member of namespace, class, struct, or union named "PassManager::run" Hint: try 'PassManager::run<TAB> or 'PassManager::run<ESC-?> (Note leading single quote.) The patch is: --- WritingAnLLVMPass.html 2006-03-14 13:39:39.000000000 +0800 +++ WritingAnLLVMPass-new.html 2006-09-28 21:06:36.000000000 +0800 @@ -1475,7 +1475,7 @@ want:</p> <pre> -(gdb) <b>break PassManager::run</b> +(gdb) <b>break llvm::PassManager::run</b> Breakpoint 1 at 0x2413bc: file Pass.cpp, line 70. (gdb) <b>run test.bc -load $(LLVMTOP)/llvm/Debug/lib/[libname].so -[passoption]</b> Starting program: opt test.bc -load $(LLVMTOP)/llvm/Debug/lib/[libname].so -[passoption]
Possibly Parallel Threads
- [LLVMdev] Name of Function's original module during link-time optimization
- [LLVMdev] Bug in WritingAnLLVMPass.html
- [LLVMdev] gcc like attributes and annotations
- [LLVMdev] Re: gcc like attributes and annotations
- [LLVMdev] How to force MemoryDependenceAnalysis to run on original module