Remove some dead code from the days llvm had type planes.
[oota-llvm.git] / lib / VMCore / Function.cpp
index f16042b7f53f5f028133925fd58caf70d4a81c0e..bda2eff4c99c3b48140e1ac7938f8e6fa225f742 100644 (file)
@@ -18,7 +18,6 @@
 #include "llvm/Support/LeakDetector.h"
 #include "llvm/Support/StringPool.h"
 #include "SymbolTableListTraitsImpl.h"
-#include "llvm/ADT/BitVector.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringExtras.h"
 using namespace llvm;
@@ -102,6 +101,13 @@ bool Argument::hasNoAliasAttr() const {
   return getParent()->paramHasAttr(getArgNo()+1, Attribute::NoAlias);
 }
 
+/// hasNoCaptureAttr - Return true if this argument has the nocapture attribute
+/// on it in its containing function.
+bool Argument::hasNoCaptureAttr() const {
+  if (!isa<PointerType>(getType())) return false;
+  return getParent()->paramHasAttr(getArgNo()+1, Attribute::NoCapture);
+}
+
 /// hasSRetAttr - Return true if this argument has the sret attribute on
 /// it in its containing function.
 bool Argument::hasStructRetAttr() const {
@@ -154,12 +160,10 @@ Function::Function(const FunctionType *Ty, LinkageTypes Linkage,
                    const std::string &name, Module *ParentModule)
   : GlobalValue(PointerType::getUnqual(Ty), 
                 Value::FunctionVal, 0, 0, Linkage, name) {
+  assert(FunctionType::isValidReturnType(getReturnType()) &&
+         !isa<OpaqueType>(getReturnType()) && "invalid return type");
   SymTab = new ValueSymbolTable();
 
-  assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy
-          || isa<StructType>(getReturnType()))
-         && "LLVM functions cannot return aggregate values!");
-
   // If the function has arguments, mark them as lazily built.
   if (Ty->getNumParams())
     SubclassData = 1;   // Set the "has lazy arguments" bit.
@@ -355,20 +359,11 @@ const FunctionType *Intrinsic::getType(ID id, const Type **Tys,
   return FunctionType::get(ResultTy, ArgTys, IsVarArg); 
 }
 
-AttrListPtr Intrinsic::getAttributes(ID id) {
-  Attributes Attr = Attribute::None;
-
+/// This defines the "Intrinsic::getAttributes(ID id)" method.
 #define GET_INTRINSIC_ATTRIBUTES
 #include "llvm/Intrinsics.gen"
 #undef GET_INTRINSIC_ATTRIBUTES
 
-  // Intrinsics cannot throw exceptions.
-  Attr |= Attribute::NoUnwind;
-
-  AttributeWithIndex PAWI = AttributeWithIndex::get(0, Attr);
-  return AttrListPtr::get(&PAWI, 1);
-}
-
 Function *Intrinsic::getDeclaration(Module *M, ID id, const Type **Tys, 
                                     unsigned numTys) {
   // There can never be multiple globals with the same name of different types,