summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-11-03 23:45:17 +0000
committerChris Lattner <sabre@nondot.org>2006-11-03 23:45:17 +0000
commitd438b53e7642e63526e884368ef65bc913608acd (patch)
treed90848c1a33c70e82c766fbd7fbe476157662bf2 /utils
parent8ed4c47d70117ff1ec2c0e06260bef2c88641887 (diff)
eliminate need for the NumMIOperands field in Operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31432 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/CodeGenTarget.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/utils/TableGen/CodeGenTarget.cpp b/utils/TableGen/CodeGenTarget.cpp
index 753651d950f..9e45f2ea87a 100644
--- a/utils/TableGen/CodeGenTarget.cpp
+++ b/utils/TableGen/CodeGenTarget.cpp
@@ -365,8 +365,20 @@ CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr)
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;