[llvm-dev] How to debug LLVM

Alex Denisov via llvm-dev llvm-dev at lists.llvm.org
Fri Nov 2 06:23:42 PDT 2018


Just as a side note: lli uses various JIT engines currently available, but they may lack some features that you need.
I'd say the best way to check your intrinsic is to use llc to compile it down to the binary and then run binary as a normal program.

> On 2. Nov 2018, at 13:03, 沈天豪 via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Hi,Matt
> Thank you for your suggestion.
> I'm sorry that I reply to you so late.
> About  building a debug version, I don't know whether adding "-DCMAKE_BUILD_TYPE=DEBUG" when I cmake LLVM is right way.
> The result .s file after using 'llc test.ll -stop-after machine-cp' has my intrinsic and the binary file also have.But it can't run.
> 
> Thank you again,
> Tianhao Shen.
> 
> 
> 
> At 2018-10-30 07:37:31, Matthew.Davis at sony.com wrote:
> >Hi Tianhao,
> >
> >> From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of ??? via llvm-dev
> >> Subject: [llvm-dev] How to debug LLVM
> >>
> >> Hi,every one.
> >> I want to add an intrinsics which mapping a new instruction.
> >> What I added in LLVM  can compile and link.  But when I lli test.bc, it breaks down.
> >> I want to know where is wrong, but bugpoint tool and XRay don't find the wrong.
> >> (Maybe I use these tools incorrectly. ) I want to know how to debug intrinsics and  instruction.
> >> Thank you,
> >> Tianhao Shen.
> >
> >When you say "it breaks down," I assume you mean there is some internal compiler crash?
> >I'd suggest building a debug version of the compiler, if you do not already have one.
> >Assertions are very helpful in debugging, and if you are trying to resolve a crash, analyzing
> >crashes from a debugger is much simpler than using a release build.
> >
> >Before you run lli, have you examined the machine instruction representation?  One trick
> >you might find handy is the following:  emit your test code as llvm IR and ensure your
> >intrinsic is represented correctly in IR.  You can feed that IR file into 'llc' and dump the
> >machine code representation.  To take a peek at the machine form of your code, run llc:
> >'llc test.ll -stop-after machine-cp'  where test.ll is your IR file that uses your newly added
> >intrinsic. The resulting .s file should have the lowered MachineInstr representation
> >which should present your newly added instruction.
> >
> >Hope that helps,
> >
> >-Matt
> 
> 
> 
> 
> 
> 
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181102/3a040a5a/attachment.sig>


More information about the llvm-dev mailing list