[PATCH] Support REG_SEQUENCE in tablegen.

hfinkel at anl.gov hfinkel at anl.gov
Sat Nov 1 22:40:48 PDT 2014


I think that this looks fine (aside from some minor things); the custom type-checking code looks about like what I'd expect.

================
Comment at: utils/TableGen/CodeGenDAGPatterns.cpp:1706
@@ +1705,3 @@
+      int NChild = getNumChildren();
+      assert(NChild >= 0);
+
----------------
Remove this assert (getNumChildren returns an unsigned value anyhow, so NChild should be unsigned too).

================
Comment at: utils/TableGen/CodeGenDAGPatterns.cpp:1726
@@ +1725,3 @@
+        if (!isOperandClass(SubIdxChild, "SubRegIndex")) {
+          TP.error("REG_SEQUENCE requires a SubRegIndex for this operand!");
+          return false;
----------------
Please get the operand number in there.

================
Comment at: utils/TableGen/CodeGenDAGPatterns.cpp:1790
@@ -1751,5 +1789,3 @@
 
-    if (ChildNo != getNumChildren()) {
-      TP.error("Instruction '" + getOperator()->getName() +
-               "' was provided too many operands!");
-      return false;
+    if (getOperator()->getName() != "REG_SEQUENCE") {
+      if (ChildNo != getNumChildren()) {
----------------
Don't need {} here (and you could merge this new condition into the existing if.

================
Comment at: utils/TableGen/DAGISelMatcherGen.cpp:758
@@ -757,7 +757,3 @@
 
-  // Loop over all of the operands of the instruction pattern, emitting code
-  // to fill them all in.  The node 'N' usually has number children equal to
-  // the number of input operands of the instruction.  However, in cases
-  // where there are predicate operands for an instruction, we need to fill
-  // in the 'execute always' values.  Match up the node operands to the
-  // instruction operands to do this.
+  // Number of operands we know the output instruction must have. It is is
+  // variadic, we could have more operands.
----------------
It is is -> If it is

================
Comment at: utils/TableGen/DAGISelMatcherGen.cpp:820
@@ +819,3 @@
+  // variable_ops.
+  if (II.Operands.isVariadic) {
+    for (unsigned I = ChildNo, E = N->getNumChildren(); I < E; ++I)
----------------
Don't need {} here.

http://reviews.llvm.org/D6075






More information about the llvm-commits mailing list