[llvm-commits] [llvm] r99347 - /llvm/trunk/utils/TableGen/CodeGenTarget.cpp

Chris Lattner sabre at nondot.org
Tue Mar 23 16:46:27 PDT 2010


Author: lattner
Date: Tue Mar 23 18:46:27 2010
New Revision: 99347

URL: http://llvm.org/viewvc/llvm-project?rev=99347&view=rev
Log:
reject void in intrinsic type lists.

Modified:
    llvm/trunk/utils/TableGen/CodeGenTarget.cpp

Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=99347&r1=99346&r2=99347&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Tue Mar 23 18:46:27 2010
@@ -488,18 +488,17 @@
     }
     if (EVT(VT).isOverloaded()) {
       OverloadedVTs.push_back(VT);
-      isOverloaded |= true;
+      isOverloaded = true;
     }
+
+    // Reject invalid types.
+    if (VT == MVT::isVoid)
+      throw "Intrinsic '" + DefName + " has void in result type list!";
     
     IS.RetVTs.push_back(VT);
     IS.RetTypeDefs.push_back(TyEl);
   }
   
-  if (IS.RetVTs.size() == 1 && IS.RetVTs[0] == MVT::isVoid) {
-    IS.RetVTs.pop_back();
-    IS.RetTypeDefs.pop_back();
-  }
-
   // Parse the list of parameter types.
   TypeList = R->getValueAsListInit("ParamTypes");
   for (unsigned i = 0, e = TypeList->getSize(); i != e; ++i) {
@@ -520,10 +519,16 @@
              "Expected iAny or vAny type");
     } else
       VT = getValueType(TyEl->getValueAsDef("VT"));
+    
     if (EVT(VT).isOverloaded()) {
       OverloadedVTs.push_back(VT);
-      isOverloaded |= true;
+      isOverloaded = true;
     }
+    
+    // Reject invalid types.
+    if (VT == MVT::isVoid && i != e-1 /*void at end means varargs*/)
+      throw "Intrinsic '" + DefName + " has void in result type list!";
+    
     IS.ParamVTs.push_back(VT);
     IS.ParamTypeDefs.push_back(TyEl);
   }





More information about the llvm-commits mailing list