[llvm-commits] CVS: llvm/utils/TableGen/CodeGenTarget.cpp

Chris Lattner sabre at nondot.org
Fri Nov 3 15:45:31 PST 2006



Changes in directory llvm/utils/TableGen:

CodeGenTarget.cpp updated: 1.71 -> 1.72
---
Log message:

eliminate need for the NumMIOperands field in Operand.


---
Diffs of the changes:  (+13 -1)

 CodeGenTarget.cpp |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletion(-)


Index: llvm/utils/TableGen/CodeGenTarget.cpp
diff -u llvm/utils/TableGen/CodeGenTarget.cpp:1.71 llvm/utils/TableGen/CodeGenTarget.cpp:1.72
--- llvm/utils/TableGen/CodeGenTarget.cpp:1.71	Wed Nov  1 17:03:11 2006
+++ llvm/utils/TableGen/CodeGenTarget.cpp	Fri Nov  3 17:45:17 2006
@@ -365,8 +365,20 @@
     DagInit *MIOpInfo = 0;
     if (Rec->isSubClassOf("Operand")) {
       PrintMethod = Rec->getValueAsString("PrintMethod");
-      NumOps = Rec->getValueAsInt("NumMIOperands");
       MIOpInfo = Rec->getValueAsDag("MIOperandInfo");
+      
+      // Verify that MIOpInfo has an 'ops' root value.
+      if (!dynamic_cast<DefInit*>(MIOpInfo->getOperator()) ||
+          dynamic_cast<DefInit*>(MIOpInfo->getOperator())
+               ->getDef()->getName() != "ops")
+        throw "Bad value for MIOperandInfo in operand '" + Rec->getName() +
+              "'\n";
+
+      // If we have MIOpInfo, then we have #operands equal to number of entries
+      // in MIOperandInfo.
+      if (unsigned NumArgs = MIOpInfo->getNumArgs())
+        NumOps = NumArgs;
+
     } else if (Rec->getName() == "variable_ops") {
       hasVariableNumberOfOperands = true;
       continue;






More information about the llvm-commits mailing list