eliminate need for the NumMIOperands field in Operand.

llvm-svn: 31432
This commit is contained in:
Chris Lattner 2006-11-03 23:45:17 +00:00
parent 0ebb0b03e6
commit 7982de167f
1 changed files with 13 additions and 1 deletions

View File

@ -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;