aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGordon Henriksen <gordonhenriksen@mac.com>2007-12-25 22:16:06 +0000
committerGordon Henriksen <gordonhenriksen@mac.com>2007-12-25 22:16:06 +0000
commit194c90ed2a8e74b5a1c5184835f84c572d524dad (patch)
treeb77faaa1cebd7341073265b7f230b82a86a80dc3
parent64910eeec481c90640a374e27011644217ebb130 (diff)
downloadexternal_llvm-194c90ed2a8e74b5a1c5184835f84c572d524dad.zip
external_llvm-194c90ed2a8e74b5a1c5184835f84c572d524dad.tar.gz
external_llvm-194c90ed2a8e74b5a1c5184835f84c572d524dad.tar.bz2
Fixing several transforms which would drop the collector attribute
when copying functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45356 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Linker/LinkModules.cpp2
-rw-r--r--lib/Transforms/IPO/ArgumentPromotion.cpp2
-rw-r--r--lib/Transforms/IPO/DeadArgumentElimination.cpp4
-rw-r--r--lib/Transforms/IPO/ExtractFunction.cpp2
-rw-r--r--tools/llvm2cpp/CppWriter.cpp5
5 files changed, 15 insertions, 0 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index 0f2afe5..3aea74e 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -359,6 +359,8 @@ static void CopyGVAttributes(GlobalValue *DestGV, const GlobalValue *SrcGV) {
Function *DestF = cast<Function>(DestGV);
DestF->setCallingConv(SrcF->getCallingConv());
DestF->setParamAttrs(SrcF->getParamAttrs());
+ if (SrcF->hasCollector())
+ DestF->setCollector(SrcF->getCollector());
}
}
diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp
index 26d8853..c66b285 100644
--- a/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -424,6 +424,8 @@ Function *ArgPromotion::DoPromotion(Function *F,
Function *NF = new Function(NFTy, F->getLinkage(), F->getName());
NF->setCallingConv(F->getCallingConv());
NF->setParamAttrs(PAL);
+ if (F->hasCollector())
+ NF->setCollector(F->getCollector());
F->getParent()->getFunctionList().insert(F, NF);
// Get the alias analysis information that we need to update to reflect our
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
index 6674ffd..d611307 100644
--- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -159,6 +159,8 @@ bool DAE::DeleteDeadVarargs(Function &Fn) {
Function *NF = new Function(NFTy, Fn.getLinkage());
NF->setCallingConv(Fn.getCallingConv());
NF->setParamAttrs(Fn.getParamAttrs());
+ if (Fn.hasCollector())
+ NF->setCollector(Fn.getCollector());
Fn.getParent()->getFunctionList().insert(&Fn, NF);
NF->takeName(&Fn);
@@ -541,6 +543,8 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) {
Function *NF = new Function(NFTy, F->getLinkage());
NF->setCallingConv(F->getCallingConv());
NF->setParamAttrs(PAL);
+ if (F->hasCollector())
+ NF->setCollector(F->getCollector());
F->getParent()->getFunctionList().insert(F, NF);
NF->takeName(F);
diff --git a/lib/Transforms/IPO/ExtractFunction.cpp b/lib/Transforms/IPO/ExtractFunction.cpp
index e5b2d41..013fefe 100644
--- a/lib/Transforms/IPO/ExtractFunction.cpp
+++ b/lib/Transforms/IPO/ExtractFunction.cpp
@@ -96,6 +96,8 @@ namespace {
GlobalValue::ExternalLinkage);
New->setCallingConv(I->getCallingConv());
New->setParamAttrs(I->getParamAttrs());
+ if (I->hasCollector())
+ New->setCollector(I->getCollector());
// If it's not the named function, delete the body of the function
I->dropAllReferences();
diff --git a/tools/llvm2cpp/CppWriter.cpp b/tools/llvm2cpp/CppWriter.cpp
index b3aaf25..ccb2a37 100644
--- a/tools/llvm2cpp/CppWriter.cpp
+++ b/tools/llvm2cpp/CppWriter.cpp
@@ -1572,6 +1572,11 @@ void CppWriter::printFunctionHead(const Function* F) {
Out << ");";
nl(Out);
}
+ if (F->hasCollector()) {
+ printCppName(F);
+ Out << "->setCollector(\"" << F->getCollector() << "\");";
+ nl(Out);
+ }
if (is_inline) {
Out << "}";
nl(Out);