diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2006-09-14 18:23:27 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2006-09-14 18:23:27 +0000 |
commit | d61d39ec53110fdd148c33925e389abff528b481 (patch) | |
tree | d472b468851ea4e3a4700c6d626fb1049cbbf29a /llvm/lib/Transforms | |
parent | 616aa548b2739719ac53e01bdd620c9372aa6567 (diff) | |
download | bcm5719-llvm-d61d39ec53110fdd148c33925e389abff528b481.tar.gz bcm5719-llvm-d61d39ec53110fdd148c33925e389abff528b481.zip |
Adding dllimport, dllexport and external weak linkage types.
DLL* linkages got full (I hope) codegeneration support in C & both x86
assembler backends.
External weak linkage added for future use, we don't provide any
codegeneration, etc. support for it.
llvm-svn: 30374
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/IPO/GlobalOpt.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index 8324b432e89..609bd94aa1a 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -1245,7 +1245,7 @@ static Constant *getVal(std::map<Value*, Constant*> &ComputedValues, static bool isSimpleEnoughPointerToCommit(Constant *C) { if (GlobalVariable *GV = dyn_cast<GlobalVariable>(C)) { if (!GV->hasExternalLinkage() && !GV->hasInternalLinkage()) - return false; // do not allow weak/linkonce linkage. + return false; // do not allow weak/linkonce/dllimport/dllexport linkage. return !GV->isExternal(); // reject external globals. } if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) @@ -1254,7 +1254,7 @@ static bool isSimpleEnoughPointerToCommit(Constant *C) { isa<GlobalVariable>(CE->getOperand(0))) { GlobalVariable *GV = cast<GlobalVariable>(CE->getOperand(0)); if (!GV->hasExternalLinkage() && !GV->hasInternalLinkage()) - return false; // do not allow weak/linkonce linkage. + return false; // do not allow weak/linkonce/dllimport/dllexport linkage. return GV->hasInitializer() && ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE); } diff --git a/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp b/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp index 79cdf28e0a4..9f9c52788bc 100644 --- a/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp @@ -178,8 +178,10 @@ public: // All the "well-known" functions are external and have external linkage // 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 linkage and non-empty uses. - if (!FI->isExternal() || !FI->hasExternalLinkage() || FI->use_empty()) + // have external or dllimport linkage and non-empty uses. + if (!FI->isExternal() || + !(FI->hasExternalLinkage() || FI->hasDLLImportLinkage()) || + FI->use_empty()) continue; // Get the optimization class that pertains to this function |