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

Jan Svoboda via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 18 07:25:28 PST 2020


jansvoboda11 accepted this revision.
jansvoboda11 added a comment.
This revision is now accepted and ready to land.

Thanks for working on this! This will LGTM with the nits fixed.



================
Comment at: llvm/docs/TableGen/ProgRef.rst:1728
+``!substr(``\ *string*\ ``,`` *start*\ [``,`` *length*]\ ``)``
+  This operator extracts a substring of the given *string*. The starting position
+  of the substring is specified by *start*, which can range between 0 and the 
----------------
This should be indented with 4 spaces as the rest of the operators.


================
Comment at: llvm/include/llvm/TableGen/Record.h:832
 public:
-  enum TernaryOp : uint8_t { SUBST, FOREACH, FILTER, IF, DAG };
+  enum TernaryOp : uint8_t { DAG, FILTER, FOREACH, IF, SUBST, SUBSTR };
 
----------------
Move unrelated/stylistic changes to a separate patch.


================
Comment at: llvm/lib/TableGen/Record.cpp:1388
   switch (getOpcode()) {
-  case SUBST: Result = "!subst"; break;
-  case FOREACH: Result = "!foreach"; UnquotedLHS = true; break;
+  case DAG: Result = "!dag"; break;
   case FILTER: Result = "!filter"; UnquotedLHS = true; break;
----------------
Move unrelated/stylistic changes to a separate patch.


================
Comment at: llvm/lib/TableGen/TGParser.cpp:1500
+  case tgtok::XFilter: {
+    return ParseOperationForEachFilter(CurRec, ItemType);
+  }
----------------
Move unrelated/stylistic changes to a separate patch.


================
Comment at: llvm/lib/TableGen/TGParser.cpp:1753
 /// ForEach ::= !foreach(ID, list-or-dag, expr) => list<expr type>
-/// Filter  ::= !foreach(ID, list, predicate) ==> list<list type>
+/// Filter  ::= !foreach(ID, list, predicate) => list<list type>
 Init *TGParser::ParseOperationForEachFilter(Record *CurRec, RecTy *ItemType) { 
----------------
Move unrelated/stylistic changes to a separate patch.


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

https://reviews.llvm.org/D93419



More information about the llvm-commits mailing list