[llvm-commits] [llvm] r82890 - in /llvm/trunk: docs/LangRef.html lib/VMCore/Type.cpp

Nick Lewycky nicholas at mxc.ca
Sun Sep 27 00:55:33 PDT 2009


Author: nicholas
Date: Sun Sep 27 02:55:32 2009
New Revision: 82890

URL: http://llvm.org/viewvc/llvm-project?rev=82890&view=rev
Log:
Remove dead code from this function and optimize. Update its corresponding
LangRef entry too.

Modified:
    llvm/trunk/docs/LangRef.html
    llvm/trunk/lib/VMCore/Type.cpp

Modified: llvm/trunk/docs/LangRef.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=82890&r1=82889&r2=82890&view=diff

==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Sun Sep 27 02:55:32 2009
@@ -1592,7 +1592,7 @@
 
 <h5>Syntax:</h5>
 <pre>
-  <returntype list> (<parameter list>)
+  <returntype> (<parameter list>)
 </pre>
 
 <p>...where '<tt><parameter list></tt>' is a comma-separated list of type
@@ -1600,8 +1600,8 @@
    which indicates that the function takes a variable number of arguments.
    Variable argument functions can access their arguments with
    the <a href="#int_varargs">variable argument handling intrinsic</a>
-   functions.  '<tt><returntype list></tt>' is a comma-separated list of
-   <a href="#t_firstclass">first class</a> type specifiers.</p>
+   functions.  '<tt><returntype></tt>' is a any type except
+   <a href="#t_label">label</a> and <a href="#t_metadata">metadata</a>.</p>
 
 <h5>Examples:</h5>
 <table class="layout">
@@ -1626,8 +1626,8 @@
     </td>
   </tr><tr class="layout">
     <td class="left"><tt>{i32, i32} (i32)</tt></td>
-    <td class="left">A function taking an <tt>i32</tt>, returning two 
-        <tt>i32</tt> values as an aggregate of type <tt>{ i32, i32 }</tt>
+    <td class="left">A function taking an <tt>i32</tt>, returning a
+        <a href="#t_struct">structure</a> containing two <tt>i32</tt> values
     </td>
   </tr>
 </table>

Modified: llvm/trunk/lib/VMCore/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=82890&r1=82889&r2=82890&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Type.cpp (original)
+++ llvm/trunk/lib/VMCore/Type.cpp Sun Sep 27 02:55:32 2009
@@ -365,25 +365,11 @@
 /// isValidReturnType - Return true if the specified type is valid as a return
 /// type.
 bool FunctionType::isValidReturnType(const Type *RetTy) {
-  if (RetTy->isFirstClassType()) {
-    if (const PointerType *PTy = dyn_cast<PointerType>(RetTy))
-      return PTy->getElementType()->getTypeID() != MetadataTyID;
-    return true;
-  }
-  if (RetTy->getTypeID() == VoidTyID || RetTy->getTypeID() == MetadataTyID ||
-      isa<OpaqueType>(RetTy))
-    return true;
-  
-  // If this is a multiple return case, verify that each return is a first class
-  // value and that there is at least one value.
-  const StructType *SRetTy = dyn_cast<StructType>(RetTy);
-  if (SRetTy == 0 || SRetTy->getNumElements() == 0)
-    return false;
-  
-  for (unsigned i = 0, e = SRetTy->getNumElements(); i != e; ++i)
-    if (!SRetTy->getElementType(i)->isFirstClassType())
-      return false;
-  return true;
+  if (const PointerType *PTy = dyn_cast<PointerType>(RetTy))
+    return PTy->getElementType()->getTypeID() != MetadataTyID;
+
+  return RetTy->getTypeID() != LabelTyID &&
+         RetTy->getTypeID() != MetadataTyID;
 }
 
 /// isValidArgumentType - Return true if the specified type is valid as an





More information about the llvm-commits mailing list