[llvm-commits] CVS: llvm/utils/TableGen/CodeGenTarget.cpp CodeGenInstruction.h

Chris Lattner lattner at cs.uiuc.edu
Thu Aug 18 16:38:53 PDT 2005



Changes in directory llvm/utils/TableGen:

CodeGenTarget.cpp updated: 1.28 -> 1.29
CodeGenInstruction.h updated: 1.8 -> 1.9
---
Log message:

Figure out how many operands each instruction has, keep track of whether
or not it's variable.


---
Diffs of the changes:  (+12 -6)

 CodeGenInstruction.h |    7 +++++--
 CodeGenTarget.cpp    |   11 +++++++----
 2 files changed, 12 insertions(+), 6 deletions(-)


Index: llvm/utils/TableGen/CodeGenTarget.cpp
diff -u llvm/utils/TableGen/CodeGenTarget.cpp:1.28 llvm/utils/TableGen/CodeGenTarget.cpp:1.29
--- llvm/utils/TableGen/CodeGenTarget.cpp:1.28	Thu Apr 21 19:00:35 2005
+++ llvm/utils/TableGen/CodeGenTarget.cpp	Thu Aug 18 18:38:41 2005
@@ -237,7 +237,8 @@
   isCommutable = R->getValueAsBit("isCommutable");
   isTerminator = R->getValueAsBit("isTerminator");
   hasDelaySlot = R->getValueAsBit("hasDelaySlot");
-
+  hasVariableNumberOfOperands = false;
+  
   try {
     DagInit *DI = R->getValueAsDag("OperandList");
 
@@ -248,18 +249,20 @@
         MVT::ValueType Ty;
         std::string PrintMethod = "printOperand";
         unsigned NumOps = 1;
-        if (Rec->isSubClassOf("RegisterClass"))
+        if (Rec->isSubClassOf("RegisterClass")) {
           Ty = getValueType(Rec->getValueAsDef("RegType"));
-        else if (Rec->isSubClassOf("Operand")) {
+        } else if (Rec->isSubClassOf("Operand")) {
           Ty = getValueType(Rec->getValueAsDef("Type"));
           PrintMethod = Rec->getValueAsString("PrintMethod");
           NumOps = Rec->getValueAsInt("NumMIOperands");
+        } else if (Rec->getName() == "variable_ops") {
+          hasVariableNumberOfOperands = true;
         } else
           throw "Unknown operand class '" + Rec->getName() +
                 "' in instruction '" + R->getName() + "' instruction!";
 
         OperandList.push_back(OperandInfo(Rec, Ty, DI->getArgName(i),
-                                          PrintMethod, MIOperandNo));
+                                          PrintMethod, MIOperandNo, NumOps));
         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.8 llvm/utils/TableGen/CodeGenInstruction.h:1.9
--- llvm/utils/TableGen/CodeGenInstruction.h:1.8	Thu Apr 21 19:00:35 2005
+++ llvm/utils/TableGen/CodeGenInstruction.h	Thu Aug 18 18:38:41 2005
@@ -56,10 +56,12 @@
       /// OperandList may not match the MachineInstr operand num.  Until it
       /// does, this contains the MI operand index of this operand.
       unsigned MIOperandNo;
+      unsigned MINumOperands;   // The number of operands.
 
       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) {}
+                  const std::string &PMN, unsigned MION, unsigned MINO)
+        : Rec(R), Ty(T), Name(N), PrinterMethodName(PMN), MIOperandNo(MION),
+          MINumOperands(MINO) {}
     };
 
     /// OperandList - The list of declared operands, along with their declared
@@ -78,6 +80,7 @@
     bool isCommutable;
     bool isTerminator;
     bool hasDelaySlot;
+    bool hasVariableNumberOfOperands;
 
     CodeGenInstruction(Record *R, const std::string &AsmStr);
 






More information about the llvm-commits mailing list