I can generate debug info using opt like this: opt < a.bc > /dev/null -mypass -debug But I don't know how to do it using llc. I check http://llvm.org/docs/CommandGuide/llc.html there are not any information about debug flags. Purpose EX: I want to print all the DEBUG(dbgs()......) in llvm/lib/CodeGen/RegAllocGreedy.cpp . What should I do? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140312/51de0de7/attachment.html>
Have you tried passing -debug? On Mar 12, 2014, at 3:57 AM, 徐偉哲 <daniel60602 at gmail.com> wrote:> I can generate debug info using opt like this: > opt < a.bc > /dev/null -mypass -debug > > But I don't know how to do it using llc. > I check http://llvm.org/docs/CommandGuide/llc.html > there are not any information about debug flags. > > Purpose > EX: > I want to print all the DEBUG(dbgs()......) in llvm/lib/CodeGen/RegAllocGreedy.cpp . > What should I do? > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140312/31bf502e/attachment.html>
Because llvm/lib/CodeGen/RegAllocGreedy.cpp has this line: #define DEBUG_TYPE "regalloc" You can also pass -debug-only=regalloc to only evaluate the DEBUG() statements in that file. So you may want to similarly define: #define DEBUG_TYPE “mypass" If your pass is called -mypass. On 2014 Mar 12, at 11:12, Jim Grosbach <grosbach at apple.com> wrote:> Have you tried passing -debug? > > On Mar 12, 2014, at 3:57 AM, 徐偉哲 <daniel60602 at gmail.com> wrote: > >> I can generate debug info using opt like this: >> opt < a.bc > /dev/null -mypass -debug >> >> But I don't know how to do it using llc. >> I check http://llvm.org/docs/CommandGuide/llc.html >> there are not any information about debug flags. >> >> Purpose >> EX: >> I want to print all the DEBUG(dbgs()......) in llvm/lib/CodeGen/RegAllocGreedy.cpp . >> What should I do? >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Then I suspect that code isn’t being executed. Try running through a debugger (like lldb or gdb), and step through the statements. On Mar 17, 2014, at 12:04 AM, 徐偉哲 <daniel60602 at gmail.com> wrote:> I got many debug info from your reply. > But I'm still confused about that I pass > llc -march=arm -regalloc=greedy -debug-only=regalloc x.bc -o x.s >&dbg > and I want to check the debug info in RegAllocGreedy.cpp : > 469 DEBUG(dbgs() << PrintReg(PhysReg, TRI) << " is available at cost " << Cost > I can't find any information about ......is available at cost. > How can I get all information in RegAllocGreedy.cpp? > > > 2014-03-16 7:03 GMT+08:00 Duncan P. N. Exon Smith <dexonsmith at apple.com>: > Because llvm/lib/CodeGen/RegAllocGreedy.cpp has this line: > > #define DEBUG_TYPE "regalloc" > > You can also pass -debug-only=regalloc to only evaluate the DEBUG() > statements in that file. So you may want to similarly define: > > #define DEBUG_TYPE “mypass" > > If your pass is called -mypass. > > On 2014 Mar 12, at 11:12, Jim Grosbach <grosbach at apple.com> wrote: > > > Have you tried passing -debug? > > > > On Mar 12, 2014, at 3:57 AM, 徐偉哲 <daniel60602 at gmail.com> wrote: > > > >> I can generate debug info using opt like this: > >> opt < a.bc > /dev/null -mypass -debug > >> > >> But I don't know how to do it using llc. > >> I check http://llvm.org/docs/CommandGuide/llc.html > >> there are not any information about debug flags. > >> > >> Purpose > >> EX: > >> I want to print all the DEBUG(dbgs()......) in llvm/lib/CodeGen/RegAllocGreedy.cpp . > >> What should I do? > >> > >> _______________________________________________ > >> LLVM Developers mailing list > >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >