[PATCH] D71474: [TableGen] Introduce an if/then/else statement.

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 15 13:40:08 PST 2019


nhaehnle added a comment.

I agree with Hal that if/else should introduce a scope. Otherwise, you get into consistency problems. Consider:

  multiclass Foo<...> {
     if ... then {
        defvar bar = ...;
     }
     defvar baz = bar;
  }

Without introducing a scope, the above is presumably valid but in a rather surprising way. And a similar example with an `else` that also defines `bar` wouldn't be valid due to the redefinition.

Generally I'm in favor of this feature, and desugaring it as a loop is a good idea as it should then compose nicely with other features. Some more tests are needed, in particular its use in a multiclass and (negative test) in a def and class.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71474





More information about the llvm-commits mailing list