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
This commit is contained in:
Chris Lattner
2004-08-11 02:22:39 +00:00
parent 552a8428fa
commit cf03da0ce9
2 changed files with 35 additions and 8 deletions
+10 -3
View File
@@ -132,19 +132,26 @@ CodeGenInstruction::CodeGenInstruction(Record *R) : TheDef(R) {
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!";
}