[PATCH] D43519: [tblgen] Allow !cast to records that don't yet exist during multiclass parsing.

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 03:07:16 PST 2018


nhaehnle added a comment.

I'm a bit suspicious of this change because it introduces the potential for recursion and I think it relies on some implementation detail of how the !cast is re-resolved once the record is finally instantiated.

I suspect the proper way to fix this is to change multiclass M2 slightly:

  multiclass M2 {
    defm NAME: M1<NAME # "d0">;
  }

... and augment TGParser::ParseIDValue to explicitly handle "NAME" in the if (CurMultiClass) statement.

That said, I haven't tried this, and record name resolution is a complete inconsistent mess. FWIW, my take on it is that NAME should simply be an implicit class/multiclass template argument, but unfortunately a lot of .td files have grown dependent on subtle implementation details, so cleaning this up is tough.


https://reviews.llvm.org/D43519





More information about the llvm-commits mailing list