[PATCH] D93419: [TableGen] Add the !substr() bang operator

Jan Svoboda via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 21 04:49:21 PST 2020


jansvoboda11 added a comment.

Yeah, there's no easy way to implement it right now.

I think looking into how loops and if statements are handle might be useful. Their ASTs are stored in the `Loops` member and are interpreted later on during multiclass instantiation.

Generalizing that infrastructure might be a good start. If we could store different kinds of ASTs there and handle them in specific ways during the instantiation, we might be able to inject the assertion handling there.

In D93419#2463283 <https://reviews.llvm.org/D93419#2463283>, @Paul-C-Anagnostopoulos wrote:

> I'm afraid I may have gotten your hopes up. It turns out that it's quite difficult to add an assert statement given the structure of the TableGen parser. A couple of the issues:
>
> 1. It's not clear at all when the assert expression should be evaluated, particularly when it appears in a def or class.
>
> 2. There is no straightforward mechanism for carrying an assertion along with a multiclass definition, for use when the multiclass is instantiated.
>
> I haven't given up, but it will take some time.




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93419/new/

https://reviews.llvm.org/D93419



More information about the llvm-commits mailing list