diff options
author | Dale Johannesen <dalej@apple.com> | 2009-02-04 22:47:25 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2009-02-04 22:47:25 +0000 |
commit | 4d452de1506344bf1d28bb4a8c4ddb78c51a28c8 (patch) | |
tree | 5b7644cb0658d094afb0caa658d7fb266d6a88c6 /lib/VMCore | |
parent | d0a203d76f4ef77ae1c392e8e73e2f05b676a5f2 (diff) |
Reverting 63765. This broke the build of both clang
and llvm-gcc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63786 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/AutoUpgrade.cpp | 2 | ||||
-rw-r--r-- | lib/VMCore/Function.cpp | 12 | ||||
-rw-r--r-- | lib/VMCore/Module.cpp | 19 | ||||
-rw-r--r-- | lib/VMCore/Verifier.cpp | 3 |
4 files changed, 8 insertions, 28 deletions
diff --git a/lib/VMCore/AutoUpgrade.cpp b/lib/VMCore/AutoUpgrade.cpp index dd366071b7..abad7af79b 100644 --- a/lib/VMCore/AutoUpgrade.cpp +++ b/lib/VMCore/AutoUpgrade.cpp @@ -217,7 +217,7 @@ bool llvm::UpgradeIntrinsicFunction(Function *F, Function *&NewFn) { // Upgrade intrinsic attributes. This does not change the function. if (NewFn) F = NewFn; - if (unsigned id = F->getIntrinsicID()) + if (unsigned id = F->getIntrinsicID(true)) F->setAttributes(Intrinsic::getAttributes((Intrinsic::ID)id)); return Upgraded; } diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index bc3b611820..bda2eff4c9 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -175,7 +175,7 @@ Function::Function(const FunctionType *Ty, LinkageTypes Linkage, ParentModule->getFunctionList().push_back(this); // Ensure intrinsics have the right parameter attributes. - if (unsigned IID = getIntrinsicID()) + if (unsigned IID = getIntrinsicID(true)) setAttributes(Intrinsic::getAttributes(Intrinsic::ID(IID))); } @@ -304,7 +304,7 @@ void Function::copyAttributesFrom(const GlobalValue *Src) { /// particular intrinsic functions which correspond to this value are defined in /// llvm/Intrinsics.h. /// -unsigned Function::getIntrinsicID() const { +unsigned Function::getIntrinsicID(bool noAssert) const { const ValueName *ValName = this->getValueName(); if (!ValName) return 0; @@ -315,9 +315,12 @@ unsigned Function::getIntrinsicID() const { || Name[2] != 'v' || Name[3] != 'm') return 0; // All intrinsics start with 'llvm.' + assert((Len != 5 || noAssert) && "'llvm.' is an invalid intrinsic name!"); + #define GET_FUNCTION_RECOGNIZER #include "llvm/Intrinsics.gen" #undef GET_FUNCTION_RECOGNIZER + assert(noAssert && "Invalid LLVM intrinsic name"); return 0; } @@ -370,9 +373,4 @@ Function *Intrinsic::getDeclaration(Module *M, ID id, const Type **Tys, getType(id, Tys, numTys))); } -// This defines the "Intrinsic::getIntrinsicForGCCBuiltin()" method. -#define GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN -#include "llvm/Intrinsics.gen" -#undef GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN - // vim: sw=2 ai diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp index 896245d69e..ef94796b24 100644 --- a/lib/VMCore/Module.cpp +++ b/lib/VMCore/Module.cpp @@ -171,25 +171,6 @@ Constant *Module::getOrInsertFunction(const std::string &Name, return F; } -Constant *Module::getOrInsertTargetIntrinsic(const std::string &Name, - const FunctionType *Ty, - AttrListPtr AttributeList) { - ValueSymbolTable &SymTab = getValueSymbolTable(); - - // See if we have a definition for the specified function already. - GlobalValue *F = dyn_cast_or_null<GlobalValue>(SymTab.lookup(Name)); - if (F == 0) { - // Nope, add it - Function *New = Function::Create(Ty, GlobalVariable::ExternalLinkage, Name); - New->setAttributes(AttributeList); - FunctionList.push_back(New); - return New; // Return the new prototype. - } - - // Otherwise, we just found the existing function or a prototype. - return F; -} - Constant *Module::getOrInsertFunction(const std::string &Name, const FunctionType *Ty) { AttrListPtr AttributeList = AttrListPtr::get((AttributeWithIndex *)0, 0); diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 99a5b92e5f..62d2930ae0 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -1004,9 +1004,10 @@ void Verifier::VerifyCallSite(CallSite CS) { void Verifier::visitCallInst(CallInst &CI) { VerifyCallSite(&CI); - if (Function *F = CI.getCalledFunction()) + if (Function *F = CI.getCalledFunction()) { if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID()) visitIntrinsicFunctionCall(ID, CI); + } } void Verifier::visitInvokeInst(InvokeInst &II) { |