[llvm-dev] TableGen trace facility

Nicolai Hähnle via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 4 14:04:39 PDT 2020

Hi Gabriel,

On Tue, Aug 4, 2020 at 8:46 AM Gabriel Hjort Åkerlund via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> 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.

It's important to distinguish between the TableGen frontend, which is
the thing that parses .td files, expands defm's, evaluates
substitutions, etc., and the backends, which take the resulting record
database as input and generate some output.

What you're describing sounds more like problems with a backend (the
SelectionDAG ones, I assume?), and I don't see how what Paul sketched
very briefly would help you there. You're probably aware that running
TableGen with the default backend will dump the entire record database
as text, so that you can inspect the result of substitutions and check
whether the resulting pattern records really are what you expect? Once
you've done that, if you run into further problems with the backend
rejecting a pattern, you'd really need some sort of backend-specific


> Cheers,
> Gabriel
> -----Original Message-----
> From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Paul C.
> Anagnostopoulos via llvm-dev
> Sent: den 3 augusti 2020 18:00
> To: llvm-dev at lists.llvm.org
> Subject: [llvm-dev] TableGen trace facility
> A question for those of you who have developed complex TableGen files: Do you
> think a trace facility would be useful during debugging? The idea is to add a
> new statement to TableGen along these lines:
>   trace tag : value1, value2, ... ;
> When encountered, the TableGen parser would display the tag along with the
> values of the specified value1, value2, etc. The tag is an identifier that
> makes it easier to distinguish multiple traces.
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

Lerne, wie die Welt wirklich ist,
aber vergiss niemals, wie sie sein sollte.

More information about the llvm-dev mailing list