summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/AsmWriter.cpp
diff options
context:
space:
mode:
authorNico Rieck <nico.rieck@gmail.com>2014-01-14 11:55:03 +0000
committerNico Rieck <nico.rieck@gmail.com>2014-01-14 11:55:03 +0000
commite43aaf7967915408e5fb4dafed7fb391abdcbbe1 (patch)
tree304048f7c03b4245c22c925dc0da7bf4c38e693d /llvm/lib/IR/AsmWriter.cpp
parentda881a2742387360206798093624f6b226807d1b (diff)
downloadbcm5719-llvm-e43aaf7967915408e5fb4dafed7fb391abdcbbe1.tar.gz
bcm5719-llvm-e43aaf7967915408e5fb4dafed7fb391abdcbbe1.zip
Decouple dllexport/dllimport from linkage
Representing dllexport/dllimport as distinct linkage types prevents using these attributes on templates and inline functions. Instead of introducing further mixed linkage types to include linkonce and weak ODR, the old import/export linkage types are replaced with a new separate visibility-like specifier: define available_externally dllimport void @f() {} @Var = dllexport global i32 1, align 4 Linkage for dllexported globals and functions is now equal to their linkage without dllexport. Imported globals and functions must be either declarations with external linkage, or definitions with AvailableExternallyLinkage. llvm-svn: 199204
Diffstat (limited to 'llvm/lib/IR/AsmWriter.cpp')
-rw-r--r--llvm/lib/IR/AsmWriter.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 91684c9c70e..eba05c5f28e 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -1367,8 +1367,6 @@ static void PrintLinkage(GlobalValue::LinkageTypes LT,
case GlobalValue::WeakODRLinkage: Out << "weak_odr "; break;
case GlobalValue::CommonLinkage: Out << "common "; break;
case GlobalValue::AppendingLinkage: Out << "appending "; break;
- case GlobalValue::DLLImportLinkage: Out << "dllimport "; break;
- case GlobalValue::DLLExportLinkage: Out << "dllexport "; break;
case GlobalValue::ExternalWeakLinkage: Out << "extern_weak "; break;
case GlobalValue::AvailableExternallyLinkage:
Out << "available_externally ";
@@ -1386,6 +1384,15 @@ static void PrintVisibility(GlobalValue::VisibilityTypes Vis,
}
}
+static void PrintDLLStorageClass(GlobalValue::DLLStorageClassTypes SCT,
+ formatted_raw_ostream &Out) {
+ switch (SCT) {
+ case GlobalValue::DefaultStorageClass: break;
+ case GlobalValue::DLLImportStorageClass: Out << "dllimport "; break;
+ case GlobalValue::DLLExportStorageClass: Out << "dllexport "; break;
+ }
+}
+
static void PrintThreadLocalModel(GlobalVariable::ThreadLocalMode TLM,
formatted_raw_ostream &Out) {
switch (TLM) {
@@ -1418,6 +1425,7 @@ void AssemblyWriter::printGlobal(const GlobalVariable *GV) {
PrintLinkage(GV->getLinkage(), Out);
PrintVisibility(GV->getVisibility(), Out);
+ PrintDLLStorageClass(GV->getDLLStorageClass(), Out);
PrintThreadLocalModel(GV->getThreadLocalMode(), Out);
if (unsigned AddressSpace = GV->getType()->getAddressSpace())
@@ -1455,6 +1463,7 @@ void AssemblyWriter::printAlias(const GlobalAlias *GA) {
Out << " = ";
}
PrintVisibility(GA->getVisibility(), Out);
+ PrintDLLStorageClass(GA->getDLLStorageClass(), Out);
Out << "alias ";
@@ -1552,6 +1561,7 @@ void AssemblyWriter::printFunction(const Function *F) {
PrintLinkage(F->getLinkage(), Out);
PrintVisibility(F->getVisibility(), Out);
+ PrintDLLStorageClass(F->getDLLStorageClass(), Out);
// Print the calling convention.
if (F->getCallingConv() != CallingConv::C) {
OpenPOWER on IntegriCloud