Try committing again. Add OptionalDefOperand. Remove clobbersPred.
authorEvan Cheng <evan.cheng@apple.com>
Tue, 10 Jul 2007 18:05:01 +0000 (18:05 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 10 Jul 2007 18:05:01 +0000 (18:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38498 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/CodeGenInstruction.h
utils/TableGen/CodeGenTarget.cpp
utils/TableGen/InstrInfoEmitter.cpp

index 54d9b3fea7b7f1fb30dc22f6e7c4dbdc4dfc9b95..3f59c23a8781e9cbf95ddc56b93c7cfec2c7033d 100644 (file)
@@ -97,8 +97,8 @@ namespace llvm {
     bool hasVariableNumberOfOperands;
     bool hasCtrlDep;
     bool noResults;
-    bool clobbersPred;
     bool isNotDuplicable;
+    bool hasOptionalDef;
     
     /// ParseOperandName - Parse an operand name like "$foo" or "$foo.bar",
     /// where $foo is a whole operand and $foo.bar refers to a suboperand.
index 18e11bdb6ff6494205659cea4b5087f08ca1540c..71fc824eadfdb519f9e3e430946d7c38d46af0b2 100644 (file)
@@ -370,8 +370,8 @@ CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr)
   usesCustomDAGSchedInserter = R->getValueAsBit("usesCustomDAGSchedInserter");
   hasCtrlDep   = R->getValueAsBit("hasCtrlDep");
   noResults    = R->getValueAsBit("noResults");
-  clobbersPred = R->getValueAsBit("clobbersPred");
   isNotDuplicable = R->getValueAsBit("isNotDuplicable");
+  hasOptionalDef = false;
   hasVariableNumberOfOperands = false;
   
   DagInit *DI;
@@ -411,9 +411,10 @@ CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr)
       if (unsigned NumArgs = MIOpInfo->getNumArgs())
         NumOps = NumArgs;
 
-      if (Rec->isSubClassOf("PredicateOperand")) {
+      if (Rec->isSubClassOf("PredicateOperand"))
         isPredicable = true;
-      }
+      else if (Rec->isSubClassOf("OptionalDefOperand"))
+        hasOptionalDef = true;
     } else if (Rec->getName() == "variable_ops") {
       hasVariableNumberOfOperands = true;
       continue;
index af01e4cd75a14e033cae3a1d2506ee1ff4f6e8b1..da2308e9e421c60cfb3fd12c7d3e395efb0445c9 100644 (file)
@@ -110,6 +110,11 @@ InstrInfoEmitter::GetOperandInfo(const CodeGenInstruction &Inst) {
       if (Inst.OperandList[i].Rec->isSubClassOf("PredicateOperand"))
         Res += "|M_PREDICATE_OPERAND";
         
+      // Optional def operands.  Check to see if the original unexpanded operand
+      // was of type OptionalDefOperand.
+      if (Inst.OperandList[i].Rec->isSubClassOf("OptionalDefOperand"))
+        Res += "|M_OPTIONAL_DEF_OPERAND";
+
       // Fill in constraint info.
       Res += ", " + Inst.OperandList[i].Constraints[j];
       Result.push_back(Res);
@@ -241,8 +246,8 @@ void InstrInfoEmitter::emitRecord(const CodeGenInstruction &Inst, unsigned Num,
   if (Inst.isCommutable) OS << "|M_COMMUTABLE";
   if (Inst.isTerminator) OS << "|M_TERMINATOR_FLAG";
   if (Inst.isReMaterializable) OS << "|M_REMATERIALIZIBLE";
-  if (Inst.clobbersPred) OS << "|M_CLOBBERS_PRED";
   if (Inst.isNotDuplicable) OS << "|M_NOT_DUPLICABLE";
+  if (Inst.hasOptionalDef) OS << "|M_HAS_OPTIONAL_DEF";
   if (Inst.usesCustomDAGSchedInserter)
     OS << "|M_USES_CUSTOM_DAG_SCHED_INSERTION";
   if (Inst.hasVariableNumberOfOperands)