mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
Revert "Decouple dllexport/dllimport from linkage"
Revert this for now until I fix an issue in Clang with it. This reverts commit r199204. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199207 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -80,8 +80,8 @@ static GlobalValue::LinkageTypes GetDecodedLinkage(unsigned Val) {
|
||||
case 2: return GlobalValue::AppendingLinkage;
|
||||
case 3: return GlobalValue::InternalLinkage;
|
||||
case 4: return GlobalValue::LinkOnceAnyLinkage;
|
||||
case 5: return GlobalValue::ExternalLinkage; // Obsolete DLLImportLinkage
|
||||
case 6: return GlobalValue::ExternalLinkage; // Obsolete DLLExportLinkage
|
||||
case 5: return GlobalValue::DLLImportLinkage;
|
||||
case 6: return GlobalValue::DLLExportLinkage;
|
||||
case 7: return GlobalValue::ExternalWeakLinkage;
|
||||
case 8: return GlobalValue::CommonLinkage;
|
||||
case 9: return GlobalValue::PrivateLinkage;
|
||||
@ -102,16 +102,6 @@ static GlobalValue::VisibilityTypes GetDecodedVisibility(unsigned Val) {
|
||||
}
|
||||
}
|
||||
|
||||
static GlobalValue::DLLStorageClassTypes
|
||||
GetDecodedDLLStorageClass(unsigned Val) {
|
||||
switch (Val) {
|
||||
default: // Map unknown values to default.
|
||||
case 0: return GlobalValue::DefaultStorageClass;
|
||||
case 1: return GlobalValue::DLLImportStorageClass;
|
||||
case 2: return GlobalValue::DLLExportStorageClass;
|
||||
}
|
||||
}
|
||||
|
||||
static GlobalVariable::ThreadLocalMode GetDecodedThreadLocalMode(unsigned Val) {
|
||||
switch (Val) {
|
||||
case 0: return GlobalVariable::NotThreadLocal;
|
||||
@ -203,13 +193,6 @@ static SynchronizationScope GetDecodedSynchScope(unsigned Val) {
|
||||
}
|
||||
}
|
||||
|
||||
static void UpgradeDLLImportExportLinkage(llvm::GlobalValue *GV, unsigned Val) {
|
||||
switch (Val) {
|
||||
case 5: GV->setDLLStorageClass(GlobalValue::DLLImportStorageClass); break;
|
||||
case 6: GV->setDLLStorageClass(GlobalValue::DLLExportStorageClass); break;
|
||||
}
|
||||
}
|
||||
|
||||
namespace llvm {
|
||||
namespace {
|
||||
/// @brief A class for maintaining the slot number definition
|
||||
@ -1814,7 +1797,7 @@ error_code BitcodeReader::ParseModule(bool Resume) {
|
||||
}
|
||||
// GLOBALVAR: [pointer type, isconst, initid,
|
||||
// linkage, alignment, section, visibility, threadlocal,
|
||||
// unnamed_addr, dllstorageclass]
|
||||
// unnamed_addr]
|
||||
case bitc::MODULE_CODE_GLOBALVAR: {
|
||||
if (Record.size() < 6)
|
||||
return Error(InvalidRecord);
|
||||
@ -1860,11 +1843,6 @@ error_code BitcodeReader::ParseModule(bool Resume) {
|
||||
NewGV->setVisibility(Visibility);
|
||||
NewGV->setUnnamedAddr(UnnamedAddr);
|
||||
|
||||
if (Record.size() > 10)
|
||||
NewGV->setDLLStorageClass(GetDecodedDLLStorageClass(Record[10]));
|
||||
else
|
||||
UpgradeDLLImportExportLinkage(NewGV, Record[3]);
|
||||
|
||||
ValueList.push_back(NewGV);
|
||||
|
||||
// Remember which value to use for the global initializer.
|
||||
@ -1873,8 +1851,7 @@ error_code BitcodeReader::ParseModule(bool Resume) {
|
||||
break;
|
||||
}
|
||||
// FUNCTION: [type, callingconv, isproto, linkage, paramattr,
|
||||
// alignment, section, visibility, gc, unnamed_addr,
|
||||
// dllstorageclass]
|
||||
// alignment, section, visibility, gc, unnamed_addr]
|
||||
case bitc::MODULE_CODE_FUNCTION: {
|
||||
if (Record.size() < 8)
|
||||
return Error(InvalidRecord);
|
||||
@ -1914,12 +1891,6 @@ error_code BitcodeReader::ParseModule(bool Resume) {
|
||||
Func->setUnnamedAddr(UnnamedAddr);
|
||||
if (Record.size() > 10 && Record[10] != 0)
|
||||
FunctionPrefixes.push_back(std::make_pair(Func, Record[10]-1));
|
||||
|
||||
if (Record.size() > 11)
|
||||
Func->setDLLStorageClass(GetDecodedDLLStorageClass(Record[11]));
|
||||
else
|
||||
UpgradeDLLImportExportLinkage(Func, Record[3]);
|
||||
|
||||
ValueList.push_back(Func);
|
||||
|
||||
// If this is a function with a body, remember the prototype we are
|
||||
@ -1931,7 +1902,7 @@ error_code BitcodeReader::ParseModule(bool Resume) {
|
||||
break;
|
||||
}
|
||||
// ALIAS: [alias type, aliasee val#, linkage]
|
||||
// ALIAS: [alias type, aliasee val#, linkage, visibility, dllstorageclass]
|
||||
// ALIAS: [alias type, aliasee val#, linkage, visibility]
|
||||
case bitc::MODULE_CODE_ALIAS: {
|
||||
if (Record.size() < 3)
|
||||
return Error(InvalidRecord);
|
||||
@ -1946,10 +1917,6 @@ error_code BitcodeReader::ParseModule(bool Resume) {
|
||||
// Old bitcode files didn't have visibility field.
|
||||
if (Record.size() > 3)
|
||||
NewGA->setVisibility(GetDecodedVisibility(Record[3]));
|
||||
if (Record.size() > 4)
|
||||
NewGA->setDLLStorageClass(GetDecodedDLLStorageClass(Record[4]));
|
||||
else
|
||||
UpgradeDLLImportExportLinkage(NewGA, Record[2]);
|
||||
ValueList.push_back(NewGA);
|
||||
AliasInits.push_back(std::make_pair(NewGA, Record[1]));
|
||||
break;
|
||||
|
@ -481,6 +481,8 @@ static unsigned getEncodedLinkage(const GlobalValue *GV) {
|
||||
case GlobalValue::AppendingLinkage: return 2;
|
||||
case GlobalValue::InternalLinkage: return 3;
|
||||
case GlobalValue::LinkOnceAnyLinkage: return 4;
|
||||
case GlobalValue::DLLImportLinkage: return 5;
|
||||
case GlobalValue::DLLExportLinkage: return 6;
|
||||
case GlobalValue::ExternalWeakLinkage: return 7;
|
||||
case GlobalValue::CommonLinkage: return 8;
|
||||
case GlobalValue::PrivateLinkage: return 9;
|
||||
@ -502,15 +504,6 @@ static unsigned getEncodedVisibility(const GlobalValue *GV) {
|
||||
llvm_unreachable("Invalid visibility");
|
||||
}
|
||||
|
||||
static unsigned getEncodedDLLStorageClass(const GlobalValue *GV) {
|
||||
switch (GV->getDLLStorageClass()) {
|
||||
case GlobalValue::DefaultStorageClass: return 0;
|
||||
case GlobalValue::DLLImportStorageClass: return 1;
|
||||
case GlobalValue::DLLExportStorageClass: return 2;
|
||||
}
|
||||
llvm_unreachable("Invalid DLL storage class");
|
||||
}
|
||||
|
||||
static unsigned getEncodedThreadLocalMode(const GlobalVariable *GV) {
|
||||
switch (GV->getThreadLocalMode()) {
|
||||
case GlobalVariable::NotThreadLocal: return 0;
|
||||
@ -614,7 +607,7 @@ static void WriteModuleInfo(const Module *M, const ValueEnumerator &VE,
|
||||
|
||||
// GLOBALVAR: [type, isconst, initid,
|
||||
// linkage, alignment, section, visibility, threadlocal,
|
||||
// unnamed_addr, externally_initialized, dllstorageclass]
|
||||
// unnamed_addr, externally_initialized]
|
||||
Vals.push_back(VE.getTypeID(GV->getType()));
|
||||
Vals.push_back(GV->isConstant());
|
||||
Vals.push_back(GV->isDeclaration() ? 0 :
|
||||
@ -624,13 +617,11 @@ static void WriteModuleInfo(const Module *M, const ValueEnumerator &VE,
|
||||
Vals.push_back(GV->hasSection() ? SectionMap[GV->getSection()] : 0);
|
||||
if (GV->isThreadLocal() ||
|
||||
GV->getVisibility() != GlobalValue::DefaultVisibility ||
|
||||
GV->hasUnnamedAddr() || GV->isExternallyInitialized() ||
|
||||
GV->getDLLStorageClass() != GlobalValue::DefaultStorageClass) {
|
||||
GV->hasUnnamedAddr() || GV->isExternallyInitialized()) {
|
||||
Vals.push_back(getEncodedVisibility(GV));
|
||||
Vals.push_back(getEncodedThreadLocalMode(GV));
|
||||
Vals.push_back(GV->hasUnnamedAddr());
|
||||
Vals.push_back(GV->isExternallyInitialized());
|
||||
Vals.push_back(getEncodedDLLStorageClass(GV));
|
||||
} else {
|
||||
AbbrevToUse = SimpleGVarAbbrev;
|
||||
}
|
||||
@ -655,7 +646,6 @@ static void WriteModuleInfo(const Module *M, const ValueEnumerator &VE,
|
||||
Vals.push_back(F->hasUnnamedAddr());
|
||||
Vals.push_back(F->hasPrefixData() ? (VE.getValueID(F->getPrefixData()) + 1)
|
||||
: 0);
|
||||
Vals.push_back(getEncodedDLLStorageClass(F));
|
||||
|
||||
unsigned AbbrevToUse = 0;
|
||||
Stream.EmitRecord(bitc::MODULE_CODE_FUNCTION, Vals, AbbrevToUse);
|
||||
@ -670,7 +660,6 @@ static void WriteModuleInfo(const Module *M, const ValueEnumerator &VE,
|
||||
Vals.push_back(VE.getValueID(AI->getAliasee()));
|
||||
Vals.push_back(getEncodedLinkage(AI));
|
||||
Vals.push_back(getEncodedVisibility(AI));
|
||||
Vals.push_back(getEncodedDLLStorageClass(AI));
|
||||
unsigned AbbrevToUse = 0;
|
||||
Stream.EmitRecord(bitc::MODULE_CODE_ALIAS, Vals, AbbrevToUse);
|
||||
Vals.clear();
|
||||
|
Reference in New Issue
Block a user