summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-04-16 20:28:45 +0000
committerChris Lattner <sabre@nondot.org>2003-04-16 20:28:45 +0000
commit379a8d2d1cb3f5b6dbe13b94ed09a29d3e400a89 (patch)
tree76f2336957b62005e10d223d5493eda780e27cef /llvm/lib/Transforms/IPO
parentf0e92b575f675ee8fb09b7fdb56cc27e8a5bdd21 (diff)
downloadbcm5719-llvm-379a8d2d1cb3f5b6dbe13b94ed09a29d3e400a89.tar.gz
bcm5719-llvm-379a8d2d1cb3f5b6dbe13b94ed09a29d3e400a89.zip
Add new linkage types to support a real frontend
llvm-svn: 5786
Diffstat (limited to 'llvm/lib/Transforms/IPO')
-rw-r--r--llvm/lib/Transforms/IPO/ExtractFunction.cpp8
-rw-r--r--llvm/lib/Transforms/IPO/Internalize.cpp4
-rw-r--r--llvm/lib/Transforms/IPO/MutateStructTypes.cpp3
-rw-r--r--llvm/lib/Transforms/IPO/Parallelize.cpp3
-rw-r--r--llvm/lib/Transforms/IPO/PoolAllocate.cpp3
5 files changed, 12 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/IPO/ExtractFunction.cpp b/llvm/lib/Transforms/IPO/ExtractFunction.cpp
index a2d28f58c68..f16c3f32530 100644
--- a/llvm/lib/Transforms/IPO/ExtractFunction.cpp
+++ b/llvm/lib/Transforms/IPO/ExtractFunction.cpp
@@ -16,13 +16,13 @@ namespace {
}
// Make sure our result is globally accessable...
- Named->setInternalLinkage(false);
+ Named->setLinkage(GlobalValue::ExternalLinkage);
// Mark all global variables internal
for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
if (!I->isExternal()) {
I->setInitializer(0); // Make all variables external
- I->setInternalLinkage(false); // Make sure it's not internal
+ I->setLinkage(GlobalValue::ExternalLinkage);
}
// All of the functions may be used by global variables or the named
@@ -35,7 +35,9 @@ namespace {
for (Module::iterator I = M.begin(); ; ++I) {
if (&*I != Named) {
- Function *New = new Function(I->getFunctionType(),false,I->getName());
+ Function *New = new Function(I->getFunctionType(),
+ GlobalValue::ExternalLinkage,
+ I->getName());
I->setName(""); // Remove Old name
// If it's not the named function, delete the body of the function
diff --git a/llvm/lib/Transforms/IPO/Internalize.cpp b/llvm/lib/Transforms/IPO/Internalize.cpp
index 910e1d4322d..f09fd141c72 100644
--- a/llvm/lib/Transforms/IPO/Internalize.cpp
+++ b/llvm/lib/Transforms/IPO/Internalize.cpp
@@ -29,7 +29,7 @@ namespace {
if (&*I != MainFunc && // Leave the main function external
!I->isExternal() && // Function must be defined here
!I->hasInternalLinkage()) { // Can't already have internal linkage
- I->setInternalLinkage(true);
+ I->setLinkage(GlobalValue::InternalLinkage);
Changed = true;
++NumFunctions;
DEBUG(std::cerr << "Internalizing func " << I->getName() << "\n");
@@ -38,7 +38,7 @@ namespace {
// Mark all global variables with initializers as internal as well...
for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
if (!I->isExternal() && I->hasExternalLinkage()) {
- I->setInternalLinkage(true);
+ I->setLinkage(GlobalValue::InternalLinkage);
Changed = true;
++NumGlobals;
DEBUG(std::cerr << "Internalizing gvar " << I->getName() << "\n");
diff --git a/llvm/lib/Transforms/IPO/MutateStructTypes.cpp b/llvm/lib/Transforms/IPO/MutateStructTypes.cpp
index b7418ec6e3e..8e58d4dbb20 100644
--- a/llvm/lib/Transforms/IPO/MutateStructTypes.cpp
+++ b/llvm/lib/Transforms/IPO/MutateStructTypes.cpp
@@ -250,8 +250,7 @@ void MutateStructTypes::processGlobals(Module &M) {
cast<FunctionType>(ConvertType(I->getFunctionType()));
// Create a new function to put stuff into...
- Function *NewMeth = new Function(NewMTy, I->hasInternalLinkage(),
- I->getName());
+ Function *NewMeth = new Function(NewMTy, I->getLinkage(), I->getName());
if (I->hasName())
I->setName("OLD."+I->getName());
diff --git a/llvm/lib/Transforms/IPO/Parallelize.cpp b/llvm/lib/Transforms/IPO/Parallelize.cpp
index 08c800eb1c7..46fbcc7d855 100644
--- a/llvm/lib/Transforms/IPO/Parallelize.cpp
+++ b/llvm/lib/Transforms/IPO/Parallelize.cpp
@@ -137,7 +137,8 @@ Cilkifier::Cilkifier(Module& M)
DummySyncFunc = new Function(FunctionType::get( Type::VoidTy,
std::vector<const Type*>(),
/*isVararg*/ false),
- /*isInternal*/ false, DummySyncFuncName, &M);
+ GlobalValue::ExternalLinkage, DummySyncFuncName,
+ &M);
}
void Cilkifier::TransformFunc(Function* F,
diff --git a/llvm/lib/Transforms/IPO/PoolAllocate.cpp b/llvm/lib/Transforms/IPO/PoolAllocate.cpp
index b2efc12de27..844d0c15ffa 100644
--- a/llvm/lib/Transforms/IPO/PoolAllocate.cpp
+++ b/llvm/lib/Transforms/IPO/PoolAllocate.cpp
@@ -161,7 +161,8 @@ Function *PoolAllocate::MakeFunctionClone(Function &F) {
FunctionType *FuncTy = FunctionType::get(OldFuncTy->getReturnType(), ArgTys,
OldFuncTy->isVarArg());
// Create the new function...
- Function *New = new Function(FuncTy, true, F.getName(), F.getParent());
+ Function *New = new Function(FuncTy, GlobalValue::InternalLinkage,
+ F.getName(), F.getParent());
// Set the rest of the new arguments names to be PDa<n> and add entries to the
// pool descriptors map
OpenPOWER on IntegriCloud