[PATCH] D50457: [MC][PredicateExpander] Extend the grammar to support simple switch and return statements.

Andrea Di Biagio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 8 10:12:07 PDT 2018


andreadb added inline comments.


================
Comment at: utils/TableGen/PredicateExpander.cpp:186
+
+void PredicateExpander::expandOpcodeSwitchCase(formatted_raw_ostream &OS,
+                                         const Record *Rec) {
----------------
mattd wrote:
> I'm curious, do we assume all cases are fall-through?  I don't see a break statement being generated, perhaps I overlooked that?
Your analysis is correct.
By construction, this new grammar only allows structures that end with return statements. Since there cannot be a fall-through, I avoided to generate a redundant `break` at the end of each case.


================
Comment at: utils/TableGen/PredicateExpander.h:82
   void expandPredicate(formatted_raw_ostream &OS, const Record *Rec);
+
+  void expandReturnStatement(formatted_raw_ostream &OS, const Record *Rec);
----------------
mattd wrote:
> nit: Don't really need this whitespace.
I will fix it. Thanks.


https://reviews.llvm.org/D50457





More information about the llvm-commits mailing list