remove some code that was working around old sparc v9 backend bugs.
authorChris Lattner <sabre@nondot.org>
Thu, 18 Mar 2010 20:50:52 +0000 (20:50 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 18 Mar 2010 20:50:52 +0000 (20:50 +0000)
Add checking that the input/output operand list in spelled right.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98865 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/CodeGenDAGPatterns.cpp
utils/TableGen/CodeGenInstruction.cpp
utils/TableGen/CodeGenInstruction.h

index 6e894a46bce4882abf0dd198a2daf2605fddcfb9..35d6d771371be738907934d7f2adf369e8467a34 100644 (file)
@@ -1145,7 +1145,8 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {
     CodeGenInstruction &InstInfo =
       CDP.getTargetInfo().getInstruction(getOperator()->getName());
     // Apply the result type to the node
-    if (NumResults == 0 || InstInfo.NumDefs == 0) {
+    if (NumResults == 0 ||
+        InstInfo.NumDefs == 0) {
       MadeChange = UpdateNodeType(MVT::isVoid, TP);
     } else {
       Record *ResultNode = Inst.getResult(0);
index f5b52ecefb35abf2a0f969f9101fdff9117f9da8..37ed84658a821a0dcf2a66a2a8b5cc0b6ad46212 100644 (file)
@@ -127,27 +127,27 @@ CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr)
   if (neverHasSideEffects + hasSideEffects > 1)
     throw R->getName() + ": multiple conflicting side-effect flags set!";
 
-  DagInit *DI;
-  try {
-    DI = R->getValueAsDag("OutOperandList");
-  } catch (...) {
-    // Error getting operand list, just ignore it (sparcv9).
-    AsmString.clear();
-    OperandList.clear();
-    return;
-  }
+  DagInit *DI = R->getValueAsDag("OutOperandList");
+
+  if (DefInit *Init = dynamic_cast<DefInit*>(DI->getOperator())) {
+    if (Init->getDef()->getName() != "ops" &&
+        Init->getDef()->getName() != "outs")
+      throw R->getName() + ": invalid def name for output list: use 'outs'";
+  } else
+    throw R->getName() + ": invalid output list: use 'outs'";
+    
   NumDefs = DI->getNumArgs();
-
-  DagInit *IDI;
-  try {
-    IDI = R->getValueAsDag("InOperandList");
-  } catch (...) {
-    // Error getting operand list, just ignore it (sparcv9).
-    AsmString.clear();
-    OperandList.clear();
-    return;
-  }
-  DI = (DagInit*)(new BinOpInit(BinOpInit::CONCAT, DI, IDI, new DagRecTy))->Fold(R, 0);
+    
+  DagInit *IDI = R->getValueAsDag("InOperandList");
+  if (DefInit *Init = dynamic_cast<DefInit*>(IDI->getOperator())) {
+    if (Init->getDef()->getName() != "ops" &&
+        Init->getDef()->getName() != "ins")
+      throw R->getName() + ": invalid def name for input list: use 'ins'";
+  } else
+    throw R->getName() + ": invalid input list: use 'ins'";
+    
+  DI = (DagInit*)(new BinOpInit(BinOpInit::CONCAT,
+                                DI, IDI, new DagRecTy))->Fold(R, 0);
 
   unsigned MIOperandNo = 0;
   std::set<std::string> OperandNames;
index aae2cac86a3d87a3d58524226970f98f4689aa55..8e7051bcda2f4be215d09a3092084ea4115e867b 100644 (file)
@@ -105,7 +105,8 @@ namespace llvm {
           MINumOperands(MINO), MIOperandInfo(MIOI) {}
     };
 
-    /// NumDefs - Number of def operands declared.
+    /// NumDefs - Number of def operands declared, this is the number of
+    /// elements in the instruction's (outs) list.
     ///
     unsigned NumDefs;