[llvm] [TableGen] Include source location in JSON dump (PR #79028)

Simon Tatham via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 24 03:13:08 PST 2024


https://github.com/statham-arm requested changes to this pull request.

What happens when the record in question is expanded via `defm` from a multiclass, or a stack of multiclasses each invoking each other? I'm guessing you either get the location of the outermost `defm`, or of the record definition inside the innermost `multiclass`, but without actually compiling this patch and testing it, I don't know which.

It would be ideal to generate more detailed output in that situation containing a list of source locations for the whole stack of multiclass expansions. That's why I hadn't already done this myself. I'm not going to demand that you do it all in this commit, but I think we should at least leave space in the JSON format to make sure it can be added later without having to break backwards compatibility.

So I think the changes needed are:
* define a JSON format that has space for future extension
* add some tests involving multiclasses, demonstrating that the current behavior is what you expect it to be
* document the new piece of JSON structure in `llvm/docs/TableGen/BackEnds.rst`, where the rest of the JSON format is documented, and include a specification of what the current handling for multiclasses is.

https://github.com/llvm/llvm-project/pull/79028


More information about the llvm-commits mailing list