[PATCH] D55758: [TableGen] : Extend !if semantics through new language feature !ifs

Simon Tatham via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 7 01:27:56 PST 2019


simon_tatham added inline comments.


================
Comment at: include/llvm/Target/TargetInstrPredicate.td:220
 class MCOpcodeSwitchStatement<list<MCOpcodeSwitchCase> cases,
-                              MCStatement default> : MCStatement {
+                              MCStatement defaultcase> : MCStatement {
   list<MCOpcodeSwitchCase> Cases = cases;
----------------
hfinkel wrote:
> This is necessary because "default" is now a keyword? Should we name it something else less likely to be used already... what about if we named this 'otherwise' instead of 'default'? Maybe just 'else' would be better? Limiting downstream churn and confusion seems worthwhile. If we have this many things to change upstream, I imagine there are even more downstream .td. files that would break.
> 
> 
I was wondering if a nicer approach to the 'default' problem would be to default to the undefined value if no clause matches, since Tablegen does have that concept already.

That might be all you need in some cases (e.g. if you're confident that one of your explicit conditions should always match anyway). And if you wanted a default of your own you could just make the last argument pair read `1: my_def_value`, in exactly the same way that users of Lisp `cond` often write the last clause as `(t my-def-value)`. Then there's no need to define a new keyword.

If a particular user thinks it's clearer to write `default`, then perhaps //that user// could define `default` in a way that makes it evaluate to true! :-)


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

https://reviews.llvm.org/D55758





More information about the llvm-commits mailing list