Start parsing more information from the Operand information
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15644 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/CodeGenTarget.cpp b/utils/TableGen/CodeGenTarget.cpp
index 9004104..e7ca857 100644
--- a/utils/TableGen/CodeGenTarget.cpp
+++ b/utils/TableGen/CodeGenTarget.cpp
@@ -132,19 +132,26 @@
try {
DagInit *DI = R->getValueAsDag("OperandList");
+ unsigned MIOperandNo = 0;
for (unsigned i = 0, e = DI->getNumArgs(); i != e; ++i)
if (DefInit *Arg = dynamic_cast<DefInit*>(DI->getArg(i))) {
Record *Rec = Arg->getDef();
MVT::ValueType Ty;
+ std::string PrintMethod = "printOperand";
+ unsigned NumOps = 1;
if (Rec->isSubClassOf("RegisterClass"))
Ty = getValueType(Rec->getValueAsDef("RegType"));
- else if (Rec->isSubClassOf("Operand"))
+ else if (Rec->isSubClassOf("Operand")) {
Ty = getValueType(Rec->getValueAsDef("Type"));
- else
+ PrintMethod = Rec->getValueAsString("PrintMethod");
+ NumOps = Rec->getValueAsInt("NumMIOperands");
+ } else
throw "Unknown operand class '" + Rec->getName() +
"' in instruction '" + R->getName() + "' instruction!";
- OperandList.push_back(OperandInfo(Rec, Ty, DI->getArgName(i)));
+ OperandList.push_back(OperandInfo(Rec, Ty, DI->getArgName(i),
+ PrintMethod, MIOperandNo));
+ MIOperandNo += NumOps;
} else {
throw "Illegal operand for the '" + R->getName() + "' instruction!";
}