diff options
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r-- | lib/Transforms/IPO/DeadArgumentElimination.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/IPO/ExtractFunction.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/IPO/FunctionResolution.cpp | 18 | ||||
-rw-r--r-- | lib/Transforms/IPO/GlobalDCE.cpp | 6 | ||||
-rw-r--r-- | lib/Transforms/IPO/GlobalOpt.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/IPO/IPConstantPropagation.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/IPO/IndMemRemoval.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/IPO/Inliner.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/IPO/Internalize.cpp | 6 | ||||
-rw-r--r-- | lib/Transforms/IPO/PruneEH.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/IPO/RaiseAllocations.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/IPO/SimplifyLibCalls.cpp | 2 |
12 files changed, 30 insertions, 30 deletions
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp index d83f3e027d..fd1be4dda2 100644 --- a/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -114,7 +114,7 @@ ModulePass *llvm::createDeadArgHackingPass() { return new DAH(); } /// llvm.vastart is never called, the varargs list is dead for the function. bool DAE::DeleteDeadVarargs(Function &Fn) { assert(Fn.getFunctionType()->isVarArg() && "Function isn't varargs!"); - if (Fn.isExternal() || !Fn.hasInternalLinkage()) return false; + if (Fn.isDeclaration() || !Fn.hasInternalLinkage()) return false; // Ensure that the function is only directly called. for (Value::use_iterator I = Fn.use_begin(), E = Fn.use_end(); I != E; ++I) { diff --git a/lib/Transforms/IPO/ExtractFunction.cpp b/lib/Transforms/IPO/ExtractFunction.cpp index 3246cd96bb..0595b5c2f7 100644 --- a/lib/Transforms/IPO/ExtractFunction.cpp +++ b/lib/Transforms/IPO/ExtractFunction.cpp @@ -63,7 +63,7 @@ namespace { Named->setLinkage(GlobalValue::ExternalLinkage); Named->deleteBody(); - assert(Named->isExternal() && "This didn't make the function external!"); + assert(Named->isDeclaration() && "This didn't make the function external!"); return true; } @@ -73,7 +73,7 @@ namespace { // Mark all global variables internal for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) - if (!I->isExternal()) { + if (!I->isDeclaration()) { I->setInitializer(0); // Make all variables external I->setLinkage(GlobalValue::ExternalLinkage); } diff --git a/lib/Transforms/IPO/FunctionResolution.cpp b/lib/Transforms/IPO/FunctionResolution.cpp index 2ffbc7b9ae..21f4a95e81 100644 --- a/lib/Transforms/IPO/FunctionResolution.cpp +++ b/lib/Transforms/IPO/FunctionResolution.cpp @@ -174,13 +174,13 @@ static bool ProcessGlobalsWithSameName(Module &M, TargetData &TD, // to 'int (int)' or 'int ()' or whatever else is not completely generic. // Function *F = cast<Function>(Globals[i]); - if (!F->isExternal()) { - if (Concrete && !Concrete->isExternal()) + if (!F->isDeclaration()) { + if (Concrete && !Concrete->isDeclaration()) return false; // Found two different functions types. Can't choose! Concrete = Globals[i]; } else if (Concrete) { - if (Concrete->isExternal()) // If we have multiple external symbols... + if (Concrete->isDeclaration()) // If we have multiple external symbols... if (F->getFunctionType()->getNumParams() > cast<Function>(Concrete)->getFunctionType()->getNumParams()) Concrete = F; // We are more concrete than "Concrete"! @@ -190,7 +190,7 @@ static bool ProcessGlobalsWithSameName(Module &M, TargetData &TD, } } else { GlobalVariable *GV = cast<GlobalVariable>(Globals[i]); - if (!GV->isExternal()) { + if (!GV->isDeclaration()) { if (Concrete) { cerr << "WARNING: Two global variables with external linkage" << " exist with the same name: '" << GV->getName() @@ -211,7 +211,7 @@ static bool ProcessGlobalsWithSameName(Module &M, TargetData &TD, unsigned NumInstancesWithExternalLinkage = 0; for (unsigned i = 0, e = Globals.size(); i != e; ++i) { - if (Globals[i]->isExternal()) + if (Globals[i]->isDeclaration()) HasExternal = true; else if (!Globals[i]->hasInternalLinkage()) NumInstancesWithExternalLinkage++; @@ -306,7 +306,7 @@ bool FunctionResolvingPass::runOnModule(Module &M) { bool Changed = false; for (Module::iterator I = M.begin(), E = M.end(); I != E; ) { Function *F = I++; - if (F->use_empty() && F->isExternal()) { + if (F->use_empty() && F->isDeclaration()) { M.getFunctionList().erase(F); Changed = true; } else if (!F->hasInternalLinkage() && !F->getName().empty() && @@ -317,7 +317,7 @@ bool FunctionResolvingPass::runOnModule(Module &M) { for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ) { GlobalVariable *GV = I++; - if (GV->use_empty() && GV->isExternal()) { + if (GV->use_empty() && GV->isDeclaration()) { M.getGlobalList().erase(GV); Changed = true; } else if (!GV->hasInternalLinkage() && !GV->getName().empty()) @@ -337,7 +337,7 @@ bool FunctionResolvingPass::runOnModule(Module &M) { // dead. If so, remove them now. for (Module::iterator I = M.begin(), E = M.end(); I != E; ) - if (I->isExternal() && I->use_empty()) { + if (I->isDeclaration() && I->use_empty()) { Function *F = I; ++I; M.getFunctionList().erase(F); @@ -349,7 +349,7 @@ bool FunctionResolvingPass::runOnModule(Module &M) { for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ) - if (I->isExternal() && I->use_empty()) { + if (I->isDeclaration() && I->use_empty()) { GlobalVariable *GV = I; ++I; M.getGlobalList().erase(GV); diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp index 17dcb31859..0f868f976b 100644 --- a/lib/Transforms/IPO/GlobalDCE.cpp +++ b/lib/Transforms/IPO/GlobalDCE.cpp @@ -57,7 +57,7 @@ bool GlobalDCE::runOnModule(Module &M) { Changed |= RemoveUnusedGlobalValue(*I); // Functions with external linkage are needed if they have a body if ((!I->hasInternalLinkage() && !I->hasLinkOnceLinkage()) && - !I->isExternal()) + !I->isDeclaration()) GlobalIsNeeded(I); } @@ -66,7 +66,7 @@ bool GlobalDCE::runOnModule(Module &M) { // Externally visible & appending globals are needed, if they have an // initializer. if ((!I->hasInternalLinkage() && !I->hasLinkOnceLinkage()) && - !I->isExternal()) + !I->isDeclaration()) GlobalIsNeeded(I); } @@ -89,7 +89,7 @@ bool GlobalDCE::runOnModule(Module &M) { for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) if (!AliveGlobals.count(I)) { DeadFunctions.push_back(I); // Keep track of dead globals - if (!I->isExternal()) + if (!I->isDeclaration()) I->deleteBody(); } diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index d9ba12c784..02a3d08c05 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -1553,7 +1553,7 @@ static bool isSimpleEnoughPointerToCommit(Constant *C) { if (GlobalVariable *GV = dyn_cast<GlobalVariable>(C)) { if (!GV->hasExternalLinkage() && !GV->hasInternalLinkage()) return false; // do not allow weak/linkonce/dllimport/dllexport linkage. - return !GV->isExternal(); // reject external globals. + return !GV->isDeclaration(); // reject external globals. } if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) // Handle a constantexpr gep. @@ -1773,7 +1773,7 @@ static bool EvaluateFunction(Function *F, Constant *&RetVal, for (unsigned i = 1, e = CI->getNumOperands(); i != e; ++i) Formals.push_back(getVal(Values, CI->getOperand(i))); - if (Callee->isExternal()) { + if (Callee->isDeclaration()) { // If this is a function we can constant fold, do it. if (Constant *C = ConstantFoldCall(Callee, Formals)) { InstResult = C; diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp index be18f002e8..daaa5a7121 100644 --- a/lib/Transforms/IPO/IPConstantPropagation.cpp +++ b/lib/Transforms/IPO/IPConstantPropagation.cpp @@ -51,7 +51,7 @@ bool IPCP::runOnModule(Module &M) { while (LocalChange) { LocalChange = false; for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal()) { + if (!I->isDeclaration()) { // Delete any klingons. I->removeDeadConstantUsers(); if (I->hasInternalLinkage()) diff --git a/lib/Transforms/IPO/IndMemRemoval.cpp b/lib/Transforms/IPO/IndMemRemoval.cpp index fa414f25db..0d2f350e85 100644 --- a/lib/Transforms/IPO/IndMemRemoval.cpp +++ b/lib/Transforms/IPO/IndMemRemoval.cpp @@ -45,7 +45,7 @@ bool IndMemRemPass::runOnModule(Module &M) { //happen through intrinsics. bool changed = false; if (Function* F = M.getNamedFunction("free")) { - assert(F->isExternal() && "free not external?"); + assert(F->isDeclaration() && "free not external?"); if (!F->use_empty()) { Function* FN = new Function(F->getFunctionType(), GlobalValue::LinkOnceLinkage, @@ -60,7 +60,7 @@ bool IndMemRemPass::runOnModule(Module &M) { } } if (Function* F = M.getNamedFunction("malloc")) { - assert(F->isExternal() && "malloc not external?"); + assert(F->isDeclaration() && "malloc not external?"); if (!F->use_empty()) { Function* FN = new Function(F->getFunctionType(), GlobalValue::LinkOnceLinkage, diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp index 27dbf8ba50..b7ebe7781b 100644 --- a/lib/Transforms/IPO/Inliner.cpp +++ b/lib/Transforms/IPO/Inliner.cpp @@ -84,7 +84,7 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) { for (BasicBlock::iterator I = BB->begin(); I != BB->end(); ++I) { CallSite CS = CallSite::get(I); if (CS.getInstruction() && (!CS.getCalledFunction() || - !CS.getCalledFunction()->isExternal())) + !CS.getCalledFunction()->isDeclaration())) CallSites.push_back(CS); } @@ -109,7 +109,7 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) { for (unsigned CSi = 0; CSi != CallSites.size(); ++CSi) if (Function *Callee = CallSites[CSi].getCalledFunction()) { // Calls to external functions are never inlinable. - if (Callee->isExternal() || + if (Callee->isDeclaration() || CallSites[CSi].getInstruction()->getParent()->getParent() ==Callee){ if (SCC.size() == 1) { std::swap(CallSites[CSi], CallSites.back()); diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp index e5bacf611a..54312b70b1 100644 --- a/lib/Transforms/IPO/Internalize.cpp +++ b/lib/Transforms/IPO/Internalize.cpp @@ -96,7 +96,7 @@ bool InternalizePass::runOnModule(Module &M) { // if (ExternalNames.empty()) { Function *MainFunc = M.getMainFunction(); - if (MainFunc == 0 || MainFunc->isExternal()) + if (MainFunc == 0 || MainFunc->isDeclaration()) return false; // No main found, must be a library... // Preserve main, internalize all else. @@ -107,7 +107,7 @@ bool InternalizePass::runOnModule(Module &M) { // Found a main function, mark all functions not named main as internal. for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal() && // Function must be defined here + if (!I->isDeclaration() && // Function must be defined here !I->hasInternalLinkage() && // Can't already have internal linkage !ExternalNames.count(I->getName())) {// Not marked to keep external? I->setLinkage(GlobalValue::InternalLinkage); @@ -129,7 +129,7 @@ bool InternalizePass::runOnModule(Module &M) { // Mark all global variables with initializers as internal as well. for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) - if (!I->isExternal() && !I->hasInternalLinkage() && + if (!I->isDeclaration() && !I->hasInternalLinkage() && !ExternalNames.count(I->getName())) { // Special case handling of the global ctor and dtor list. When we // internalize it, we mark it constant, which allows elimination of diff --git a/lib/Transforms/IPO/PruneEH.cpp b/lib/Transforms/IPO/PruneEH.cpp index c9e3455c94..c92f428914 100644 --- a/lib/Transforms/IPO/PruneEH.cpp +++ b/lib/Transforms/IPO/PruneEH.cpp @@ -72,11 +72,11 @@ bool PruneEH::runOnSCC(const std::vector<CallGraphNode *> &SCC) { for (unsigned i = 0, e = SCC.size(); (!SCCMightUnwind || !SCCMightReturn) && i != e; ++i) { Function *F = SCC[i]->getFunction(); - if (F == 0 || (F->isExternal() && !F->getIntrinsicID())) { + if (F == 0 || (F->isDeclaration() && !F->getIntrinsicID())) { SCCMightUnwind = true; SCCMightReturn = true; } else { - if (F->isExternal()) + if (F->isDeclaration()) SCCMightReturn = true; // Check to see if this function performs an unwind or calls an diff --git a/lib/Transforms/IPO/RaiseAllocations.cpp b/lib/Transforms/IPO/RaiseAllocations.cpp index e7e57aa952..6082780e35 100644 --- a/lib/Transforms/IPO/RaiseAllocations.cpp +++ b/lib/Transforms/IPO/RaiseAllocations.cpp @@ -109,8 +109,8 @@ void RaiseAllocations::doInitialization(Module &M) { } // Don't mess with locally defined versions of these functions... - if (MallocFunc && !MallocFunc->isExternal()) MallocFunc = 0; - if (FreeFunc && !FreeFunc->isExternal()) FreeFunc = 0; + if (MallocFunc && !MallocFunc->isDeclaration()) MallocFunc = 0; + if (FreeFunc && !FreeFunc->isDeclaration()) FreeFunc = 0; } // run - Transform calls into instructions... diff --git a/lib/Transforms/IPO/SimplifyLibCalls.cpp b/lib/Transforms/IPO/SimplifyLibCalls.cpp index 037fef1a25..e4eb6e42c1 100644 --- a/lib/Transforms/IPO/SimplifyLibCalls.cpp +++ b/lib/Transforms/IPO/SimplifyLibCalls.cpp @@ -177,7 +177,7 @@ public: // because they live in a runtime library somewhere and were (probably) // not compiled by LLVM. So, we only act on external functions that // have external or dllimport linkage and non-empty uses. - if (!FI->isExternal() || + if (!FI->isDeclaration() || !(FI->hasExternalLinkage() || FI->hasDLLImportLinkage()) || FI->use_empty()) continue; |