diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2006-06-15 07:22:16 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2006-06-15 07:22:16 +0000 |
| commit | 55772ccfd6f6621628b692877f27369cef7dc495 (patch) | |
| tree | 0e98e159b71251642a50868d09c9427892a2a540 /llvm/utils/TableGen | |
| parent | 5d038cf8023e3cbbca7059dc9818af90812bb6b5 (diff) | |
| download | bcm5719-llvm-55772ccfd6f6621628b692877f27369cef7dc495.tar.gz bcm5719-llvm-55772ccfd6f6621628b692877f27369cef7dc495.zip | |
Instructions with variable operands (variable_ops) can have a number required
operands. e.g.
def CALL32r : I<0xFF, MRM2r, (ops GR32:$dst, variable_ops),
"call {*}$dst", [(X86call GR32:$dst)]>;
TableGen should emit operand informations for the "required" operands.
Added a target instruction info flag M_VARIABLE_OPS to indicate the target
instruction may have more operands in addition to the minimum required
operands.
llvm-svn: 28791
Diffstat (limited to 'llvm/utils/TableGen')
| -rw-r--r-- | llvm/utils/TableGen/InstrInfoEmitter.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/llvm/utils/TableGen/InstrInfoEmitter.cpp b/llvm/utils/TableGen/InstrInfoEmitter.cpp index 66d17cb86bb..f91babcf860 100644 --- a/llvm/utils/TableGen/InstrInfoEmitter.cpp +++ b/llvm/utils/TableGen/InstrInfoEmitter.cpp @@ -64,9 +64,6 @@ void InstrInfoEmitter::printDefList(const std::vector<Record*> &Uses, static std::vector<Record*> GetOperandInfo(const CodeGenInstruction &Inst) { std::vector<Record*> Result; - if (Inst.hasVariableNumberOfOperands) - return Result; // No info for variable operand instrs. - for (unsigned i = 0, e = Inst.OperandList.size(); i != e; ++i) { if (Inst.OperandList[i].Rec->isSubClassOf("RegisterClass")) { Result.push_back(Inst.OperandList[i].Rec); @@ -170,15 +167,13 @@ void InstrInfoEmitter::emitRecord(const CodeGenInstruction &Inst, unsigned Num, std::map<std::vector<Record*>, unsigned> &EmittedLists, std::map<std::vector<Record*>, unsigned> &OpInfo, std::ostream &OS) { - int NumOperands; - if (Inst.hasVariableNumberOfOperands) - NumOperands = -1; - else if (!Inst.OperandList.empty()) + int MinOperands; + if (!Inst.OperandList.empty()) // Each logical operand can be multiple MI operands. - NumOperands = Inst.OperandList.back().MIOperandNo + + MinOperands = Inst.OperandList.back().MIOperandNo + Inst.OperandList.back().MINumOperands; else - NumOperands = 0; + MinOperands = 0; OS << " { \""; if (Inst.Name.empty()) @@ -189,7 +184,7 @@ void InstrInfoEmitter::emitRecord(const CodeGenInstruction &Inst, unsigned Num, unsigned ItinClass = !IsItineraries ? 0 : ItinClassNumber(Inst.TheDef->getValueAsDef("Itinerary")->getName()); - OS << "\",\t" << NumOperands << ", " << ItinClass + OS << "\",\t" << MinOperands << ", " << ItinClass << ", 0"; // Try to determine (from the pattern), if the instruction is a store. @@ -224,6 +219,8 @@ void InstrInfoEmitter::emitRecord(const CodeGenInstruction &Inst, unsigned Num, if (Inst.isTerminator) OS << "|M_TERMINATOR_FLAG"; if (Inst.usesCustomDAGSchedInserter) OS << "|M_USES_CUSTOM_DAG_SCHED_INSERTION"; + if (Inst.hasVariableNumberOfOperands) + OS << "|M_VARIABLE_OPS"; OS << ", 0"; // Emit all of the target-specific flags... |

