diff --git a/llvm/utils/TableGen/InstrInfoEmitter.cpp b/llvm/utils/TableGen/InstrInfoEmitter.cpp index 6340a153a258..ae7c4d199815 100644 --- a/llvm/utils/TableGen/InstrInfoEmitter.cpp +++ b/llvm/utils/TableGen/InstrInfoEmitter.cpp @@ -120,14 +120,22 @@ void InstrInfoEmitter::emitRecord(const CodeGenInstruction &Inst, unsigned Num, Record *InstrInfo, std::map &ListNumbers, std::ostream &OS) { + int NumOperands; + if (Inst.hasVariableNumberOfOperands) + NumOperands = -1; + else if (!Inst.OperandList.empty()) + // Each logical operand can be multiple MI operands. + NumOperands = Inst.OperandList.back().MIOperandNo + + Inst.OperandList.back().MINumOperands; + else + NumOperands = 0; + OS << " { \""; if (Inst.Name.empty()) OS << Inst.TheDef->getName(); else OS << Inst.Name; - OS << "\",\t" << -1 - //Inst.OperandList.size() - << ", -1, 0, false, 0, 0, 0, 0"; + OS << "\",\t" << NumOperands << ", -1, 0, false, 0, 0, 0, 0"; // Emit all of the target indepedent flags... if (Inst.isReturn) OS << "|M_RET_FLAG";