mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 21:32:10 +00:00
It makes no sense to have a ODR version of common
linkage, so remove it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66690 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
94244f3849
commit
4dc2b39bf8
@ -552,15 +552,14 @@ All Global Variables and Functions have one of the following types of linkage:
|
||||
</dd>
|
||||
|
||||
<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>
|
||||
<dd>Some languages allow inequivalent globals to be merged, such as two
|
||||
functions with different semantics. Other languages, such as <tt>C++</tt>,
|
||||
ensure that only equivalent globals are ever merged (the "one definition
|
||||
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
|
||||
the global will only be merged with equivalent globals. These linkage
|
||||
types are otherwise the same as their non-<tt>odr</tt> versions.
|
||||
rule" - <tt>odr</tt>). Such languages can use the <tt>linkonce_odr</tt>
|
||||
and <tt>weak_odr</tt> linkage types to indicate that the global will only
|
||||
be merged with equivalent globals. These linkage types are otherwise the
|
||||
same as their non-<tt>odr</tt> versions.
|
||||
</dd>
|
||||
|
||||
<dt><tt><b><a name="linkage_external">externally visible</a></b></tt>:</dt>
|
||||
|
@ -130,9 +130,7 @@ typedef enum {
|
||||
LLVMExternalWeakLinkage,/**< ExternalWeak linkage description */
|
||||
LLVMGhostLinkage, /**< Stand-in functions for streaming fns from
|
||||
bitcode */
|
||||
LLVMCommonAnyLinkage, /**< Tentative definitions */
|
||||
LLVMCommonODRLinkage /**< Same, but only replaced by something
|
||||
equivalent. */
|
||||
LLVMCommonLinkage /**< Tentative definitions */
|
||||
} LLVMLinkage;
|
||||
|
||||
typedef enum {
|
||||
|
@ -42,8 +42,7 @@ public:
|
||||
DLLExportLinkage, ///< Function to be accessible from DLL
|
||||
ExternalWeakLinkage,///< ExternalWeak linkage description
|
||||
GhostLinkage, ///< Stand-in functions for streaming fns from BC files
|
||||
CommonAnyLinkage, ///< Tentative definitions
|
||||
CommonODRLinkage ///< Same, but only replaced by something equivalent.
|
||||
CommonLinkage ///< Tentative definitions
|
||||
};
|
||||
|
||||
/// @brief An enumeration for the kinds of visibility of global values.
|
||||
@ -108,9 +107,6 @@ public:
|
||||
static LinkageTypes getWeakLinkage(bool ODR) {
|
||||
return ODR ? WeakODRLinkage : WeakAnyLinkage;
|
||||
}
|
||||
static LinkageTypes getCommonLinkage(bool ODR) {
|
||||
return ODR ? CommonODRLinkage : CommonAnyLinkage;
|
||||
}
|
||||
|
||||
bool hasExternalLinkage() const { return Linkage == ExternalLinkage; }
|
||||
bool hasLinkOnceLinkage() const {
|
||||
@ -129,9 +125,7 @@ public:
|
||||
bool hasDLLExportLinkage() const { return Linkage == DLLExportLinkage; }
|
||||
bool hasExternalWeakLinkage() const { return Linkage == ExternalWeakLinkage; }
|
||||
bool hasGhostLinkage() const { return Linkage == GhostLinkage; }
|
||||
bool hasCommonLinkage() const {
|
||||
return Linkage == CommonAnyLinkage || Linkage == CommonODRLinkage;
|
||||
}
|
||||
bool hasCommonLinkage() const { return Linkage == CommonLinkage; }
|
||||
|
||||
void setLinkage(LinkageTypes LT) { Linkage = LT; }
|
||||
LinkageTypes getLinkage() const { return Linkage; }
|
||||
@ -142,7 +136,7 @@ public:
|
||||
bool mayBeOverridden() const {
|
||||
return (Linkage == WeakAnyLinkage ||
|
||||
Linkage == LinkOnceAnyLinkage ||
|
||||
Linkage == CommonAnyLinkage ||
|
||||
Linkage == CommonLinkage ||
|
||||
Linkage == ExternalWeakLinkage);
|
||||
}
|
||||
|
||||
@ -153,8 +147,7 @@ public:
|
||||
Linkage == WeakODRLinkage ||
|
||||
Linkage == LinkOnceAnyLinkage ||
|
||||
Linkage == LinkOnceODRLinkage ||
|
||||
Linkage == CommonAnyLinkage ||
|
||||
Linkage == CommonODRLinkage ||
|
||||
Linkage == CommonLinkage ||
|
||||
Linkage == ExternalWeakLinkage);
|
||||
}
|
||||
|
||||
|
@ -463,7 +463,6 @@ lltok::Kind LLLexer::LexIdentifier() {
|
||||
KEYWORD(dllimport);
|
||||
KEYWORD(dllexport);
|
||||
KEYWORD(common);
|
||||
KEYWORD(common_odr);
|
||||
KEYWORD(default);
|
||||
KEYWORD(hidden);
|
||||
KEYWORD(protected);
|
||||
|
@ -122,7 +122,6 @@ bool LLParser::ParseTopLevelEntities() {
|
||||
case lltok::kw_appending: // OptionalLinkage
|
||||
case lltok::kw_dllexport: // OptionalLinkage
|
||||
case lltok::kw_common: // OptionalLinkage
|
||||
case lltok::kw_common_odr: // OptionalLinkage
|
||||
case lltok::kw_dllimport: // OptionalLinkage
|
||||
case lltok::kw_extern_weak: // OptionalLinkage
|
||||
case lltok::kw_external: { // OptionalLinkage
|
||||
@ -748,7 +747,6 @@ bool LLParser::ParseOptionalAttrs(unsigned &Attrs, unsigned AttrKind) {
|
||||
/// ::= 'appending'
|
||||
/// ::= 'dllexport'
|
||||
/// ::= 'common'
|
||||
/// ::= 'common_odr'
|
||||
/// ::= 'dllimport'
|
||||
/// ::= 'extern_weak'
|
||||
/// ::= 'external'
|
||||
@ -764,8 +762,7 @@ bool LLParser::ParseOptionalLinkage(unsigned &Res, bool &HasLinkage) {
|
||||
case lltok::kw_linkonce_odr: Res = GlobalValue::LinkOnceODRLinkage; break;
|
||||
case lltok::kw_appending: Res = GlobalValue::AppendingLinkage; break;
|
||||
case lltok::kw_dllexport: Res = GlobalValue::DLLExportLinkage; break;
|
||||
case lltok::kw_common: Res = GlobalValue::CommonAnyLinkage; break;
|
||||
case lltok::kw_common_odr: Res = GlobalValue::CommonODRLinkage; break;
|
||||
case lltok::kw_common: Res = GlobalValue::CommonLinkage; break;
|
||||
case lltok::kw_dllimport: Res = GlobalValue::DLLImportLinkage; break;
|
||||
case lltok::kw_extern_weak: Res = GlobalValue::ExternalWeakLinkage; break;
|
||||
case lltok::kw_external: Res = GlobalValue::ExternalLinkage; break;
|
||||
@ -2114,8 +2111,7 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) {
|
||||
break;
|
||||
case GlobalValue::AppendingLinkage:
|
||||
case GlobalValue::GhostLinkage:
|
||||
case GlobalValue::CommonAnyLinkage:
|
||||
case GlobalValue::CommonODRLinkage:
|
||||
case GlobalValue::CommonLinkage:
|
||||
return Error(LinkageLoc, "invalid function linkage type");
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ namespace lltok {
|
||||
kw_global, kw_constant,
|
||||
|
||||
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_extern_weak,
|
||||
kw_external, kw_thread_local,
|
||||
|
@ -66,11 +66,10 @@ static GlobalValue::LinkageTypes GetDecodedLinkage(unsigned Val) {
|
||||
case 5: return GlobalValue::DLLImportLinkage;
|
||||
case 6: return GlobalValue::DLLExportLinkage;
|
||||
case 7: return GlobalValue::ExternalWeakLinkage;
|
||||
case 8: return GlobalValue::CommonAnyLinkage;
|
||||
case 8: return GlobalValue::CommonLinkage;
|
||||
case 9: return GlobalValue::PrivateLinkage;
|
||||
case 10: return GlobalValue::WeakODRLinkage;
|
||||
case 11: return GlobalValue::LinkOnceODRLinkage;
|
||||
case 13: return GlobalValue::CommonODRLinkage;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -283,11 +283,10 @@ static unsigned getEncodedLinkage(const GlobalValue *GV) {
|
||||
case GlobalValue::DLLImportLinkage: return 5;
|
||||
case GlobalValue::DLLExportLinkage: return 6;
|
||||
case GlobalValue::ExternalWeakLinkage: return 7;
|
||||
case GlobalValue::CommonAnyLinkage: return 8;
|
||||
case GlobalValue::CommonLinkage: return 8;
|
||||
case GlobalValue::PrivateLinkage: return 9;
|
||||
case GlobalValue::WeakODRLinkage: return 10;
|
||||
case GlobalValue::LinkOnceODRLinkage: return 11;
|
||||
case GlobalValue::CommonODRLinkage: return 13;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -960,8 +960,7 @@ MachOSym::MachOSym(const GlobalValue *gv, std::string name, uint8_t sect,
|
||||
case GlobalValue::WeakODRLinkage:
|
||||
case GlobalValue::LinkOnceAnyLinkage:
|
||||
case GlobalValue::LinkOnceODRLinkage:
|
||||
case GlobalValue::CommonAnyLinkage:
|
||||
case GlobalValue::CommonODRLinkage:
|
||||
case GlobalValue::CommonLinkage:
|
||||
assert(!isa<Function>(gv) && "Unexpected linkage type for Function!");
|
||||
case GlobalValue::ExternalLinkage:
|
||||
GVName = TAI->getGlobalPrefix() + name;
|
||||
|
@ -901,8 +901,7 @@ void ARMAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
|
||||
|
||||
SwitchToSection(TAI->SectionForGlobal(GVar));
|
||||
switch (GVar->getLinkage()) {
|
||||
case GlobalValue::CommonAnyLinkage:
|
||||
case GlobalValue::CommonODRLinkage:
|
||||
case GlobalValue::CommonLinkage:
|
||||
case GlobalValue::LinkOnceAnyLinkage:
|
||||
case GlobalValue::LinkOnceODRLinkage:
|
||||
case GlobalValue::WeakAnyLinkage:
|
||||
|
@ -237,8 +237,7 @@ void AlphaAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
|
||||
case GlobalValue::LinkOnceODRLinkage:
|
||||
case GlobalValue::WeakAnyLinkage:
|
||||
case GlobalValue::WeakODRLinkage:
|
||||
case GlobalValue::CommonAnyLinkage:
|
||||
case GlobalValue::CommonODRLinkage:
|
||||
case GlobalValue::CommonLinkage:
|
||||
O << TAI->getWeakRefDirective() << name << '\n';
|
||||
break;
|
||||
case GlobalValue::AppendingLinkage:
|
||||
|
@ -561,8 +561,7 @@ void LinuxAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
|
||||
case GlobalValue::LinkOnceODRLinkage:
|
||||
case GlobalValue::WeakAnyLinkage:
|
||||
case GlobalValue::WeakODRLinkage:
|
||||
case GlobalValue::CommonAnyLinkage:
|
||||
case GlobalValue::CommonODRLinkage:
|
||||
case GlobalValue::CommonLinkage:
|
||||
O << "\t.global " << name << '\n'
|
||||
<< "\t.type " << name << ", @object\n"
|
||||
<< "\t.weak " << name << '\n';
|
||||
|
@ -314,10 +314,8 @@ namespace {
|
||||
Out << "GlobalValue::ExternalWeakLinkage"; break;
|
||||
case GlobalValue::GhostLinkage:
|
||||
Out << "GlobalValue::GhostLinkage"; break;
|
||||
case GlobalValue::CommonAnyLinkage:
|
||||
Out << "GlobalValue::CommonAnyLinkage"; break;
|
||||
case GlobalValue::CommonODRLinkage:
|
||||
Out << "GlobalValue::CommonODRLinkage"; break;
|
||||
case GlobalValue::CommonLinkage:
|
||||
Out << "GlobalValue::CommonLinkage"; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,8 +298,7 @@ void IA64AsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
|
||||
switch (GVar->getLinkage()) {
|
||||
case GlobalValue::LinkOnceAnyLinkage:
|
||||
case GlobalValue::LinkOnceODRLinkage:
|
||||
case GlobalValue::CommonAnyLinkage:
|
||||
case GlobalValue::CommonODRLinkage:
|
||||
case GlobalValue::CommonLinkage:
|
||||
case GlobalValue::WeakAnyLinkage:
|
||||
case GlobalValue::WeakODRLinkage:
|
||||
// Nonnull linkonce -> weak
|
||||
|
@ -521,8 +521,7 @@ printModuleLevelGV(const GlobalVariable* GVar) {
|
||||
switch (GVar->getLinkage()) {
|
||||
case GlobalValue::LinkOnceAnyLinkage:
|
||||
case GlobalValue::LinkOnceODRLinkage:
|
||||
case GlobalValue::CommonAnyLinkage:
|
||||
case GlobalValue::CommonODRLinkage:
|
||||
case GlobalValue::CommonLinkage:
|
||||
case GlobalValue::WeakAnyLinkage:
|
||||
case GlobalValue::WeakODRLinkage:
|
||||
// FIXME: Verify correct for weak.
|
||||
|
@ -715,8 +715,7 @@ void PPCLinuxAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
|
||||
case GlobalValue::LinkOnceODRLinkage:
|
||||
case GlobalValue::WeakAnyLinkage:
|
||||
case GlobalValue::WeakODRLinkage:
|
||||
case GlobalValue::CommonAnyLinkage:
|
||||
case GlobalValue::CommonODRLinkage:
|
||||
case GlobalValue::CommonLinkage:
|
||||
O << "\t.global " << name << '\n'
|
||||
<< "\t.type " << name << ", @object\n"
|
||||
<< "\t.weak " << name << '\n';
|
||||
@ -961,8 +960,7 @@ void PPCDarwinAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
|
||||
case GlobalValue::LinkOnceODRLinkage:
|
||||
case GlobalValue::WeakAnyLinkage:
|
||||
case GlobalValue::WeakODRLinkage:
|
||||
case GlobalValue::CommonAnyLinkage:
|
||||
case GlobalValue::CommonODRLinkage:
|
||||
case GlobalValue::CommonLinkage:
|
||||
O << "\t.globl " << name << '\n'
|
||||
<< "\t.weak_definition " << name << '\n';
|
||||
break;
|
||||
|
@ -276,8 +276,7 @@ void SparcAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
|
||||
}
|
||||
|
||||
switch (GVar->getLinkage()) {
|
||||
case GlobalValue::CommonAnyLinkage:
|
||||
case GlobalValue::CommonODRLinkage:
|
||||
case GlobalValue::CommonLinkage:
|
||||
case GlobalValue::LinkOnceAnyLinkage:
|
||||
case GlobalValue::LinkOnceODRLinkage:
|
||||
case GlobalValue::WeakAnyLinkage: // FIXME: Verify correct for weak.
|
||||
|
@ -856,8 +856,7 @@ void X86ATTAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
|
||||
}
|
||||
|
||||
switch (GVar->getLinkage()) {
|
||||
case GlobalValue::CommonAnyLinkage:
|
||||
case GlobalValue::CommonODRLinkage:
|
||||
case GlobalValue::CommonLinkage:
|
||||
case GlobalValue::LinkOnceAnyLinkage:
|
||||
case GlobalValue::LinkOnceODRLinkage:
|
||||
case GlobalValue::WeakAnyLinkage:
|
||||
|
@ -455,8 +455,7 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) {
|
||||
bool bCustomSegment = false;
|
||||
|
||||
switch (I->getLinkage()) {
|
||||
case GlobalValue::CommonAnyLinkage:
|
||||
case GlobalValue::CommonODRLinkage:
|
||||
case GlobalValue::CommonLinkage:
|
||||
case GlobalValue::LinkOnceAnyLinkage:
|
||||
case GlobalValue::LinkOnceODRLinkage:
|
||||
case GlobalValue::WeakAnyLinkage:
|
||||
|
@ -1189,8 +1189,7 @@ static void PrintLinkage(GlobalValue::LinkageTypes LT, raw_ostream &Out) {
|
||||
case GlobalValue::LinkOnceODRLinkage: Out << "linkonce_odr "; break;
|
||||
case GlobalValue::WeakAnyLinkage: Out << "weak "; break;
|
||||
case GlobalValue::WeakODRLinkage: Out << "weak_odr "; break;
|
||||
case GlobalValue::CommonAnyLinkage: Out << "common "; break;
|
||||
case GlobalValue::CommonODRLinkage: Out << "common_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;
|
||||
|
@ -88,7 +88,6 @@ GVInternalLinkage
|
||||
| appending
|
||||
| dllexport
|
||||
| common
|
||||
| "common_odr"
|
||||
;
|
||||
|
||||
GVExternalLinkage
|
||||
|
@ -41,7 +41,7 @@ syn keyword llvmStatement extractvalue insertvalue
|
||||
syn keyword llvmKeyword define declare global constant
|
||||
syn keyword llvmKeyword internal external
|
||||
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 hidden protected default
|
||||
syn keyword llvmKeyword except deplibs
|
||||
|
Loading…
Reference in New Issue
Block a user