[llvm-commits] CVS: llvm/utils/TableGen/CodeGenTarget.cpp CodeGenInstruction.h
Chris Lattner
lattner at cs.uiuc.edu
Tue Aug 10 19:23:50 PDT 2004
Changes in directory llvm/utils/TableGen:
CodeGenTarget.cpp updated: 1.13 -> 1.14
CodeGenInstruction.h updated: 1.2 -> 1.3
---
Log message:
Start parsing more information from the Operand information
---
Diffs of the changes: (+35 -8)
Index: llvm/utils/TableGen/CodeGenTarget.cpp
diff -u llvm/utils/TableGen/CodeGenTarget.cpp:1.13 llvm/utils/TableGen/CodeGenTarget.cpp:1.14
--- llvm/utils/TableGen/CodeGenTarget.cpp:1.13 Tue Aug 10 20:53:58 2004
+++ llvm/utils/TableGen/CodeGenTarget.cpp Tue Aug 10 21:22:39 2004
@@ -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!";
}
Index: llvm/utils/TableGen/CodeGenInstruction.h
diff -u llvm/utils/TableGen/CodeGenInstruction.h:1.2 llvm/utils/TableGen/CodeGenInstruction.h:1.3
--- llvm/utils/TableGen/CodeGenInstruction.h:1.2 Sun Aug 1 02:42:39 2004
+++ llvm/utils/TableGen/CodeGenInstruction.h Tue Aug 10 21:22:39 2004
@@ -31,15 +31,35 @@
/// instruction.
std::string AsmString;
- /// OperandInfo - For each operand declared in the OperandList of the
- /// instruction, keep track of its record (which specifies the class of the
- /// operand), its type, and the name given to the operand, if any.
+ /// OperandInfo - The information we keep track of for each operand in the
+ /// operand list for a tablegen instruction.
struct OperandInfo {
+ /// Rec - The definition this operand is declared as.
Record *Rec;
+
+ /// Ty - The MachineValueType of the operand.
+ ///
MVT::ValueType Ty;
+
+ /// Name - If this operand was assigned a symbolic name, this is it,
+ /// otherwise, it's empty.
std::string Name;
- OperandInfo(Record *R, MVT::ValueType T, const std::string &N)
- : Rec(R), Ty(T), Name(N) {}
+
+ /// PrinterMethodName - The method used to print operands of this type in
+ /// the asmprinter.
+ std::string PrinterMethodName;
+
+ /// MIOperandNo - Currently (this is meant to be phased out), some logical
+ /// operands correspond to multiple MachineInstr operands. In the X86
+ /// target for example, one address operand is represented as 4
+ /// MachineOperands. Because of this, the operand number in the
+ /// OperandList may not match the MachineInstr operand num. Until it
+ /// does, this contains the MI operand index of this operand.
+ unsigned MIOperandNo;
+
+ OperandInfo(Record *R, MVT::ValueType T, const std::string &N,
+ const std::string &PMN, unsigned MION)
+ : Rec(R), Ty(T), Name(N), PrinterMethodName(PMN), MIOperandNo(MION) {}
};
/// OperandList - The list of declared operands, along with their declared
More information about the llvm-commits
mailing list