[llvm-dev] TableGen trace facility

David Greene via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 5 07:27:16 PDT 2020


Gabriel Hjort Ã…kerlund via llvm-dev <llvm-dev at lists.llvm.org> writes:

> I think such a feature would be very helpful if the trace can be used to print 
> arbitrary parts of patterns. I often find that when a pattern is rejected I 
> need to strip down the *.td file, fire up gdb, set up breakpoints or step to 
> where the pattern is rejected, and inspect the current tree pattern. Having 
> the ability to insert trace points directly into the pattern would save me 
> this effort.

The way I usually debug these is open up the generated selection .inc
for the target (beware, it's HUGE!) and do a compiler run with
-debug-only=isel,x86-isel (for example).  The debug dump shows the steps
the isel interpreter takes along with the "addresses" of branch points
and targets where the interpreter makes decisions.  These "addresses"
are comments in the .inc file and one can step through it by following
the printouts in the debug dump.  That way one can see where things go
wrong.  I would say 95% of the time I can find the problem this way.

One thing that would help tremendously is reducing the size of the .inc,
either by splitting it into multiple files or by some other method.

               -David


More information about the llvm-dev mailing list