1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

It makes no sense to have a ODR version of common

linkage, so remove it.

llvm-svn: 66690
This commit is contained in:
Duncan Sands 2009-03-11 20:14:15 +00:00
parent b31a9d0dc0
commit b27c523449
22 changed files with 29 additions and 61 deletions

View File

@ -552,15 +552,14 @@ All Global Variables and Functions have one of the following types of linkage:
</dd> </dd>
<dt><tt><b><a name="linkage_linkonce">linkonce_odr</a></b></tt>: </dt> <dt><tt><b><a name="linkage_linkonce">linkonce_odr</a></b></tt>: </dt>
<dt><tt><b><a name="linkage_common">common_odr</a></b></tt>: </dt>
<dt><tt><b><a name="linkage_weak">weak_odr</a></b></tt>: </dt> <dt><tt><b><a name="linkage_weak">weak_odr</a></b></tt>: </dt>
<dd>Some languages allow inequivalent globals to be merged, such as two <dd>Some languages allow inequivalent globals to be merged, such as two
functions with different semantics. Other languages, such as <tt>C++</tt>, functions with different semantics. Other languages, such as <tt>C++</tt>,
ensure that only equivalent globals are ever merged (the "one definition ensure that only equivalent globals are ever merged (the "one definition
rule" - <tt>odr</tt>). Such languages can use the <tt>linkonce_odr</tt>, rule" - <tt>odr</tt>). Such languages can use the <tt>linkonce_odr</tt>
<tt>common_odr</tt> and <tt>weak_odr</tt> linkage types to indicate that and <tt>weak_odr</tt> linkage types to indicate that the global will only
the global will only be merged with equivalent globals. These linkage be merged with equivalent globals. These linkage types are otherwise the
types are otherwise the same as their non-<tt>odr</tt> versions. same as their non-<tt>odr</tt> versions.
</dd> </dd>
<dt><tt><b><a name="linkage_external">externally visible</a></b></tt>:</dt> <dt><tt><b><a name="linkage_external">externally visible</a></b></tt>:</dt>

View File

@ -130,9 +130,7 @@ typedef enum {
LLVMExternalWeakLinkage,/**< ExternalWeak linkage description */ LLVMExternalWeakLinkage,/**< ExternalWeak linkage description */
LLVMGhostLinkage, /**< Stand-in functions for streaming fns from LLVMGhostLinkage, /**< Stand-in functions for streaming fns from
bitcode */ bitcode */
LLVMCommonAnyLinkage, /**< Tentative definitions */ LLVMCommonLinkage /**< Tentative definitions */
LLVMCommonODRLinkage /**< Same, but only replaced by something
equivalent. */
} LLVMLinkage; } LLVMLinkage;
typedef enum { typedef enum {

View File

@ -42,8 +42,7 @@ public:
DLLExportLinkage, ///< Function to be accessible from DLL DLLExportLinkage, ///< Function to be accessible from DLL
ExternalWeakLinkage,///< ExternalWeak linkage description ExternalWeakLinkage,///< ExternalWeak linkage description
GhostLinkage, ///< Stand-in functions for streaming fns from BC files GhostLinkage, ///< Stand-in functions for streaming fns from BC files
CommonAnyLinkage, ///< Tentative definitions CommonLinkage ///< Tentative definitions
CommonODRLinkage ///< Same, but only replaced by something equivalent.
}; };
/// @brief An enumeration for the kinds of visibility of global values. /// @brief An enumeration for the kinds of visibility of global values.
@ -108,9 +107,6 @@ public:
static LinkageTypes getWeakLinkage(bool ODR) { static LinkageTypes getWeakLinkage(bool ODR) {
return ODR ? WeakODRLinkage : WeakAnyLinkage; return ODR ? WeakODRLinkage : WeakAnyLinkage;
} }
static LinkageTypes getCommonLinkage(bool ODR) {
return ODR ? CommonODRLinkage : CommonAnyLinkage;
}
bool hasExternalLinkage() const { return Linkage == ExternalLinkage; } bool hasExternalLinkage() const { return Linkage == ExternalLinkage; }
bool hasLinkOnceLinkage() const { bool hasLinkOnceLinkage() const {
@ -129,9 +125,7 @@ public:
bool hasDLLExportLinkage() const { return Linkage == DLLExportLinkage; } bool hasDLLExportLinkage() const { return Linkage == DLLExportLinkage; }
bool hasExternalWeakLinkage() const { return Linkage == ExternalWeakLinkage; } bool hasExternalWeakLinkage() const { return Linkage == ExternalWeakLinkage; }
bool hasGhostLinkage() const { return Linkage == GhostLinkage; } bool hasGhostLinkage() const { return Linkage == GhostLinkage; }
bool hasCommonLinkage() const { bool hasCommonLinkage() const { return Linkage == CommonLinkage; }
return Linkage == CommonAnyLinkage || Linkage == CommonODRLinkage;
}
void setLinkage(LinkageTypes LT) { Linkage = LT; } void setLinkage(LinkageTypes LT) { Linkage = LT; }
LinkageTypes getLinkage() const { return Linkage; } LinkageTypes getLinkage() const { return Linkage; }
@ -142,7 +136,7 @@ public:
bool mayBeOverridden() const { bool mayBeOverridden() const {
return (Linkage == WeakAnyLinkage || return (Linkage == WeakAnyLinkage ||
Linkage == LinkOnceAnyLinkage || Linkage == LinkOnceAnyLinkage ||
Linkage == CommonAnyLinkage || Linkage == CommonLinkage ||
Linkage == ExternalWeakLinkage); Linkage == ExternalWeakLinkage);
} }
@ -153,8 +147,7 @@ public:
Linkage == WeakODRLinkage || Linkage == WeakODRLinkage ||
Linkage == LinkOnceAnyLinkage || Linkage == LinkOnceAnyLinkage ||
Linkage == LinkOnceODRLinkage || Linkage == LinkOnceODRLinkage ||
Linkage == CommonAnyLinkage || Linkage == CommonLinkage ||
Linkage == CommonODRLinkage ||
Linkage == ExternalWeakLinkage); Linkage == ExternalWeakLinkage);
} }

View File

@ -463,7 +463,6 @@ lltok::Kind LLLexer::LexIdentifier() {
KEYWORD(dllimport); KEYWORD(dllimport);
KEYWORD(dllexport); KEYWORD(dllexport);
KEYWORD(common); KEYWORD(common);
KEYWORD(common_odr);
KEYWORD(default); KEYWORD(default);
KEYWORD(hidden); KEYWORD(hidden);
KEYWORD(protected); KEYWORD(protected);

View File

@ -122,7 +122,6 @@ bool LLParser::ParseTopLevelEntities() {
case lltok::kw_appending: // OptionalLinkage case lltok::kw_appending: // OptionalLinkage
case lltok::kw_dllexport: // OptionalLinkage case lltok::kw_dllexport: // OptionalLinkage
case lltok::kw_common: // OptionalLinkage case lltok::kw_common: // OptionalLinkage
case lltok::kw_common_odr: // OptionalLinkage
case lltok::kw_dllimport: // OptionalLinkage case lltok::kw_dllimport: // OptionalLinkage
case lltok::kw_extern_weak: // OptionalLinkage case lltok::kw_extern_weak: // OptionalLinkage
case lltok::kw_external: { // OptionalLinkage case lltok::kw_external: { // OptionalLinkage
@ -748,7 +747,6 @@ bool LLParser::ParseOptionalAttrs(unsigned &Attrs, unsigned AttrKind) {
/// ::= 'appending' /// ::= 'appending'
/// ::= 'dllexport' /// ::= 'dllexport'
/// ::= 'common' /// ::= 'common'
/// ::= 'common_odr'
/// ::= 'dllimport' /// ::= 'dllimport'
/// ::= 'extern_weak' /// ::= 'extern_weak'
/// ::= 'external' /// ::= 'external'
@ -764,8 +762,7 @@ bool LLParser::ParseOptionalLinkage(unsigned &Res, bool &HasLinkage) {
case lltok::kw_linkonce_odr: Res = GlobalValue::LinkOnceODRLinkage; break; case lltok::kw_linkonce_odr: Res = GlobalValue::LinkOnceODRLinkage; break;
case lltok::kw_appending: Res = GlobalValue::AppendingLinkage; break; case lltok::kw_appending: Res = GlobalValue::AppendingLinkage; break;
case lltok::kw_dllexport: Res = GlobalValue::DLLExportLinkage; break; case lltok::kw_dllexport: Res = GlobalValue::DLLExportLinkage; break;
case lltok::kw_common: Res = GlobalValue::CommonAnyLinkage; break; case lltok::kw_common: Res = GlobalValue::CommonLinkage; break;
case lltok::kw_common_odr: Res = GlobalValue::CommonODRLinkage; break;
case lltok::kw_dllimport: Res = GlobalValue::DLLImportLinkage; break; case lltok::kw_dllimport: Res = GlobalValue::DLLImportLinkage; break;
case lltok::kw_extern_weak: Res = GlobalValue::ExternalWeakLinkage; break; case lltok::kw_extern_weak: Res = GlobalValue::ExternalWeakLinkage; break;
case lltok::kw_external: Res = GlobalValue::ExternalLinkage; break; case lltok::kw_external: Res = GlobalValue::ExternalLinkage; break;
@ -2114,8 +2111,7 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) {
break; break;
case GlobalValue::AppendingLinkage: case GlobalValue::AppendingLinkage:
case GlobalValue::GhostLinkage: case GlobalValue::GhostLinkage:
case GlobalValue::CommonAnyLinkage: case GlobalValue::CommonLinkage:
case GlobalValue::CommonODRLinkage:
return Error(LinkageLoc, "invalid function linkage type"); return Error(LinkageLoc, "invalid function linkage type");
} }

View File

@ -37,7 +37,7 @@ namespace lltok {
kw_global, kw_constant, kw_global, kw_constant,
kw_private, kw_internal, kw_linkonce, kw_linkonce_odr, kw_weak, kw_weak_odr, kw_private, kw_internal, kw_linkonce, kw_linkonce_odr, kw_weak, kw_weak_odr,
kw_appending, kw_dllimport, kw_dllexport, kw_common, kw_common_odr, kw_appending, kw_dllimport, kw_dllexport, kw_common,
kw_default, kw_hidden, kw_protected, kw_default, kw_hidden, kw_protected,
kw_extern_weak, kw_extern_weak,
kw_external, kw_thread_local, kw_external, kw_thread_local,

View File

@ -66,11 +66,10 @@ static GlobalValue::LinkageTypes GetDecodedLinkage(unsigned Val) {
case 5: return GlobalValue::DLLImportLinkage; case 5: return GlobalValue::DLLImportLinkage;
case 6: return GlobalValue::DLLExportLinkage; case 6: return GlobalValue::DLLExportLinkage;
case 7: return GlobalValue::ExternalWeakLinkage; case 7: return GlobalValue::ExternalWeakLinkage;
case 8: return GlobalValue::CommonAnyLinkage; case 8: return GlobalValue::CommonLinkage;
case 9: return GlobalValue::PrivateLinkage; case 9: return GlobalValue::PrivateLinkage;
case 10: return GlobalValue::WeakODRLinkage; case 10: return GlobalValue::WeakODRLinkage;
case 11: return GlobalValue::LinkOnceODRLinkage; case 11: return GlobalValue::LinkOnceODRLinkage;
case 13: return GlobalValue::CommonODRLinkage;
} }
} }

View File

@ -283,11 +283,10 @@ static unsigned getEncodedLinkage(const GlobalValue *GV) {
case GlobalValue::DLLImportLinkage: return 5; case GlobalValue::DLLImportLinkage: return 5;
case GlobalValue::DLLExportLinkage: return 6; case GlobalValue::DLLExportLinkage: return 6;
case GlobalValue::ExternalWeakLinkage: return 7; case GlobalValue::ExternalWeakLinkage: return 7;
case GlobalValue::CommonAnyLinkage: return 8; case GlobalValue::CommonLinkage: return 8;
case GlobalValue::PrivateLinkage: return 9; case GlobalValue::PrivateLinkage: return 9;
case GlobalValue::WeakODRLinkage: return 10; case GlobalValue::WeakODRLinkage: return 10;
case GlobalValue::LinkOnceODRLinkage: return 11; case GlobalValue::LinkOnceODRLinkage: return 11;
case GlobalValue::CommonODRLinkage: return 13;
} }
} }

View File

@ -960,8 +960,7 @@ MachOSym::MachOSym(const GlobalValue *gv, std::string name, uint8_t sect,
case GlobalValue::WeakODRLinkage: case GlobalValue::WeakODRLinkage:
case GlobalValue::LinkOnceAnyLinkage: case GlobalValue::LinkOnceAnyLinkage:
case GlobalValue::LinkOnceODRLinkage: case GlobalValue::LinkOnceODRLinkage:
case GlobalValue::CommonAnyLinkage: case GlobalValue::CommonLinkage:
case GlobalValue::CommonODRLinkage:
assert(!isa<Function>(gv) && "Unexpected linkage type for Function!"); assert(!isa<Function>(gv) && "Unexpected linkage type for Function!");
case GlobalValue::ExternalLinkage: case GlobalValue::ExternalLinkage:
GVName = TAI->getGlobalPrefix() + name; GVName = TAI->getGlobalPrefix() + name;

View File

@ -901,8 +901,7 @@ void ARMAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
SwitchToSection(TAI->SectionForGlobal(GVar)); SwitchToSection(TAI->SectionForGlobal(GVar));
switch (GVar->getLinkage()) { switch (GVar->getLinkage()) {
case GlobalValue::CommonAnyLinkage: case GlobalValue::CommonLinkage:
case GlobalValue::CommonODRLinkage:
case GlobalValue::LinkOnceAnyLinkage: case GlobalValue::LinkOnceAnyLinkage:
case GlobalValue::LinkOnceODRLinkage: case GlobalValue::LinkOnceODRLinkage:
case GlobalValue::WeakAnyLinkage: case GlobalValue::WeakAnyLinkage:

View File

@ -237,8 +237,7 @@ void AlphaAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
case GlobalValue::LinkOnceODRLinkage: case GlobalValue::LinkOnceODRLinkage:
case GlobalValue::WeakAnyLinkage: case GlobalValue::WeakAnyLinkage:
case GlobalValue::WeakODRLinkage: case GlobalValue::WeakODRLinkage:
case GlobalValue::CommonAnyLinkage: case GlobalValue::CommonLinkage:
case GlobalValue::CommonODRLinkage:
O << TAI->getWeakRefDirective() << name << '\n'; O << TAI->getWeakRefDirective() << name << '\n';
break; break;
case GlobalValue::AppendingLinkage: case GlobalValue::AppendingLinkage:

View File

@ -561,8 +561,7 @@ void LinuxAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
case GlobalValue::LinkOnceODRLinkage: case GlobalValue::LinkOnceODRLinkage:
case GlobalValue::WeakAnyLinkage: case GlobalValue::WeakAnyLinkage:
case GlobalValue::WeakODRLinkage: case GlobalValue::WeakODRLinkage:
case GlobalValue::CommonAnyLinkage: case GlobalValue::CommonLinkage:
case GlobalValue::CommonODRLinkage:
O << "\t.global " << name << '\n' O << "\t.global " << name << '\n'
<< "\t.type " << name << ", @object\n" << "\t.type " << name << ", @object\n"
<< "\t.weak " << name << '\n'; << "\t.weak " << name << '\n';

View File

@ -314,10 +314,8 @@ namespace {
Out << "GlobalValue::ExternalWeakLinkage"; break; Out << "GlobalValue::ExternalWeakLinkage"; break;
case GlobalValue::GhostLinkage: case GlobalValue::GhostLinkage:
Out << "GlobalValue::GhostLinkage"; break; Out << "GlobalValue::GhostLinkage"; break;
case GlobalValue::CommonAnyLinkage: case GlobalValue::CommonLinkage:
Out << "GlobalValue::CommonAnyLinkage"; break; Out << "GlobalValue::CommonLinkage"; break;
case GlobalValue::CommonODRLinkage:
Out << "GlobalValue::CommonODRLinkage"; break;
} }
} }

View File

@ -298,8 +298,7 @@ void IA64AsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
switch (GVar->getLinkage()) { switch (GVar->getLinkage()) {
case GlobalValue::LinkOnceAnyLinkage: case GlobalValue::LinkOnceAnyLinkage:
case GlobalValue::LinkOnceODRLinkage: case GlobalValue::LinkOnceODRLinkage:
case GlobalValue::CommonAnyLinkage: case GlobalValue::CommonLinkage:
case GlobalValue::CommonODRLinkage:
case GlobalValue::WeakAnyLinkage: case GlobalValue::WeakAnyLinkage:
case GlobalValue::WeakODRLinkage: case GlobalValue::WeakODRLinkage:
// Nonnull linkonce -> weak // Nonnull linkonce -> weak

View File

@ -521,8 +521,7 @@ printModuleLevelGV(const GlobalVariable* GVar) {
switch (GVar->getLinkage()) { switch (GVar->getLinkage()) {
case GlobalValue::LinkOnceAnyLinkage: case GlobalValue::LinkOnceAnyLinkage:
case GlobalValue::LinkOnceODRLinkage: case GlobalValue::LinkOnceODRLinkage:
case GlobalValue::CommonAnyLinkage: case GlobalValue::CommonLinkage:
case GlobalValue::CommonODRLinkage:
case GlobalValue::WeakAnyLinkage: case GlobalValue::WeakAnyLinkage:
case GlobalValue::WeakODRLinkage: case GlobalValue::WeakODRLinkage:
// FIXME: Verify correct for weak. // FIXME: Verify correct for weak.

View File

@ -715,8 +715,7 @@ void PPCLinuxAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
case GlobalValue::LinkOnceODRLinkage: case GlobalValue::LinkOnceODRLinkage:
case GlobalValue::WeakAnyLinkage: case GlobalValue::WeakAnyLinkage:
case GlobalValue::WeakODRLinkage: case GlobalValue::WeakODRLinkage:
case GlobalValue::CommonAnyLinkage: case GlobalValue::CommonLinkage:
case GlobalValue::CommonODRLinkage:
O << "\t.global " << name << '\n' O << "\t.global " << name << '\n'
<< "\t.type " << name << ", @object\n" << "\t.type " << name << ", @object\n"
<< "\t.weak " << name << '\n'; << "\t.weak " << name << '\n';
@ -961,8 +960,7 @@ void PPCDarwinAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
case GlobalValue::LinkOnceODRLinkage: case GlobalValue::LinkOnceODRLinkage:
case GlobalValue::WeakAnyLinkage: case GlobalValue::WeakAnyLinkage:
case GlobalValue::WeakODRLinkage: case GlobalValue::WeakODRLinkage:
case GlobalValue::CommonAnyLinkage: case GlobalValue::CommonLinkage:
case GlobalValue::CommonODRLinkage:
O << "\t.globl " << name << '\n' O << "\t.globl " << name << '\n'
<< "\t.weak_definition " << name << '\n'; << "\t.weak_definition " << name << '\n';
break; break;

View File

@ -276,8 +276,7 @@ void SparcAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
} }
switch (GVar->getLinkage()) { switch (GVar->getLinkage()) {
case GlobalValue::CommonAnyLinkage: case GlobalValue::CommonLinkage:
case GlobalValue::CommonODRLinkage:
case GlobalValue::LinkOnceAnyLinkage: case GlobalValue::LinkOnceAnyLinkage:
case GlobalValue::LinkOnceODRLinkage: case GlobalValue::LinkOnceODRLinkage:
case GlobalValue::WeakAnyLinkage: // FIXME: Verify correct for weak. case GlobalValue::WeakAnyLinkage: // FIXME: Verify correct for weak.

View File

@ -856,8 +856,7 @@ void X86ATTAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
} }
switch (GVar->getLinkage()) { switch (GVar->getLinkage()) {
case GlobalValue::CommonAnyLinkage: case GlobalValue::CommonLinkage:
case GlobalValue::CommonODRLinkage:
case GlobalValue::LinkOnceAnyLinkage: case GlobalValue::LinkOnceAnyLinkage:
case GlobalValue::LinkOnceODRLinkage: case GlobalValue::LinkOnceODRLinkage:
case GlobalValue::WeakAnyLinkage: case GlobalValue::WeakAnyLinkage:

View File

@ -455,8 +455,7 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) {
bool bCustomSegment = false; bool bCustomSegment = false;
switch (I->getLinkage()) { switch (I->getLinkage()) {
case GlobalValue::CommonAnyLinkage: case GlobalValue::CommonLinkage:
case GlobalValue::CommonODRLinkage:
case GlobalValue::LinkOnceAnyLinkage: case GlobalValue::LinkOnceAnyLinkage:
case GlobalValue::LinkOnceODRLinkage: case GlobalValue::LinkOnceODRLinkage:
case GlobalValue::WeakAnyLinkage: case GlobalValue::WeakAnyLinkage:

View File

@ -1189,8 +1189,7 @@ static void PrintLinkage(GlobalValue::LinkageTypes LT, raw_ostream &Out) {
case GlobalValue::LinkOnceODRLinkage: Out << "linkonce_odr "; break; case GlobalValue::LinkOnceODRLinkage: Out << "linkonce_odr "; break;
case GlobalValue::WeakAnyLinkage: Out << "weak "; break; case GlobalValue::WeakAnyLinkage: Out << "weak "; break;
case GlobalValue::WeakODRLinkage: Out << "weak_odr "; break; case GlobalValue::WeakODRLinkage: Out << "weak_odr "; break;
case GlobalValue::CommonAnyLinkage: Out << "common "; break; case GlobalValue::CommonLinkage: Out << "common "; break;
case GlobalValue::CommonODRLinkage: Out << "common_odr "; break;
case GlobalValue::AppendingLinkage: Out << "appending "; break; case GlobalValue::AppendingLinkage: Out << "appending "; break;
case GlobalValue::DLLImportLinkage: Out << "dllimport "; break; case GlobalValue::DLLImportLinkage: Out << "dllimport "; break;
case GlobalValue::DLLExportLinkage: Out << "dllexport "; break; case GlobalValue::DLLExportLinkage: Out << "dllexport "; break;

View File

@ -88,7 +88,6 @@ GVInternalLinkage
| appending | appending
| dllexport | dllexport
| common | common
| "common_odr"
; ;
GVExternalLinkage GVExternalLinkage

View File

@ -41,7 +41,7 @@ syn keyword llvmStatement extractvalue insertvalue
syn keyword llvmKeyword define declare global constant syn keyword llvmKeyword define declare global constant
syn keyword llvmKeyword internal external syn keyword llvmKeyword internal external
syn keyword llvmKeyword linkonce linkonce_odr weak weak_odr appending syn keyword llvmKeyword linkonce linkonce_odr weak weak_odr appending
syn keyword llvmKeyword common common_odr extern_weak syn keyword llvmKeyword common extern_weak
syn keyword llvmKeyword thread_local dllimport dllexport syn keyword llvmKeyword thread_local dllimport dllexport
syn keyword llvmKeyword hidden protected default syn keyword llvmKeyword hidden protected default
syn keyword llvmKeyword except deplibs syn keyword llvmKeyword except deplibs