From b27c5234499a76b1a8459f85701cabe256f299cc Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Wed, 11 Mar 2009 20:14:15 +0000 Subject: [PATCH] It makes no sense to have a ODR version of common linkage, so remove it. llvm-svn: 66690 --- docs/LangRef.html | 9 ++++----- include/llvm-c/Core.h | 4 +--- include/llvm/GlobalValue.h | 15 ++++----------- lib/AsmParser/LLLexer.cpp | 1 - lib/AsmParser/LLParser.cpp | 8 ++------ lib/AsmParser/LLToken.h | 2 +- lib/Bitcode/Reader/BitcodeReader.cpp | 3 +-- lib/Bitcode/Writer/BitcodeWriter.cpp | 3 +-- lib/CodeGen/MachOWriter.cpp | 3 +-- lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp | 3 +-- lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp | 3 +-- lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp | 3 +-- lib/Target/CppBackend/CPPBackend.cpp | 6 ++---- lib/Target/IA64/IA64AsmPrinter.cpp | 3 +-- lib/Target/Mips/MipsAsmPrinter.cpp | 3 +-- lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp | 6 ++---- lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp | 3 +-- lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp | 3 +-- lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp | 3 +-- lib/VMCore/AsmWriter.cpp | 3 +-- utils/llvm.grm | 1 - utils/vim/llvm.vim | 2 +- 22 files changed, 29 insertions(+), 61 deletions(-) diff --git a/docs/LangRef.html b/docs/LangRef.html index c698e8a90a9..94f3c3d75a8 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -552,15 +552,14 @@ All Global Variables and Functions have one of the following types of linkage:
linkonce_odr:
-
common_odr:
weak_odr:
Some languages allow inequivalent globals to be merged, such as two functions with different semantics. Other languages, such as C++, ensure that only equivalent globals are ever merged (the "one definition - rule" - odr). Such languages can use the linkonce_odr, - common_odr and weak_odr linkage types to indicate that - the global will only be merged with equivalent globals. These linkage - types are otherwise the same as their non-odr versions. + rule" - odr). Such languages can use the linkonce_odr + and weak_odr linkage types to indicate that the global will only + be merged with equivalent globals. These linkage types are otherwise the + same as their non-odr versions.
externally visible:
diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h index 34a91fa10fb..91b3bdfd74e 100644 --- a/include/llvm-c/Core.h +++ b/include/llvm-c/Core.h @@ -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 { diff --git a/include/llvm/GlobalValue.h b/include/llvm/GlobalValue.h index 7b1bfc0494b..e6a82ef22e9 100644 --- a/include/llvm/GlobalValue.h +++ b/include/llvm/GlobalValue.h @@ -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); } diff --git a/lib/AsmParser/LLLexer.cpp b/lib/AsmParser/LLLexer.cpp index d25b00153c0..5a38e6090f7 100644 --- a/lib/AsmParser/LLLexer.cpp +++ b/lib/AsmParser/LLLexer.cpp @@ -463,7 +463,6 @@ lltok::Kind LLLexer::LexIdentifier() { KEYWORD(dllimport); KEYWORD(dllexport); KEYWORD(common); - KEYWORD(common_odr); KEYWORD(default); KEYWORD(hidden); KEYWORD(protected); diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index c13c7fce145..9d0f24cda93 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -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"); } diff --git a/lib/AsmParser/LLToken.h b/lib/AsmParser/LLToken.h index 35a1bc345b0..ec3769bdd09 100644 --- a/lib/AsmParser/LLToken.h +++ b/lib/AsmParser/LLToken.h @@ -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, diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index abf1db23a38..299ce0b94a4 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -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; } } diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 940647fb54a..1055564be21 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -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; } } diff --git a/lib/CodeGen/MachOWriter.cpp b/lib/CodeGen/MachOWriter.cpp index 5fe05a4e8f0..d2e87917afb 100644 --- a/lib/CodeGen/MachOWriter.cpp +++ b/lib/CodeGen/MachOWriter.cpp @@ -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(gv) && "Unexpected linkage type for Function!"); case GlobalValue::ExternalLinkage: GVName = TAI->getGlobalPrefix() + name; diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index ae968e7b098..816940b9e76 100644 --- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -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: diff --git a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp index 5238b79d9d2..a654be9849a 100644 --- a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp +++ b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp @@ -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: diff --git a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp index 7731a9023a1..9b6e5409192 100644 --- a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp +++ b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp @@ -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'; diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 52646f0ce3d..38134d9189b 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -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; } } diff --git a/lib/Target/IA64/IA64AsmPrinter.cpp b/lib/Target/IA64/IA64AsmPrinter.cpp index d8ec2108c91..2d4519abcf4 100644 --- a/lib/Target/IA64/IA64AsmPrinter.cpp +++ b/lib/Target/IA64/IA64AsmPrinter.cpp @@ -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 diff --git a/lib/Target/Mips/MipsAsmPrinter.cpp b/lib/Target/Mips/MipsAsmPrinter.cpp index a22d7d6ebcd..816e8dce645 100644 --- a/lib/Target/Mips/MipsAsmPrinter.cpp +++ b/lib/Target/Mips/MipsAsmPrinter.cpp @@ -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. diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp index 4da53774d72..3de290f1a8d 100644 --- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp @@ -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; diff --git a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp index e0785d55823..ec4e6b25b44 100644 --- a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp +++ b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp @@ -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. diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp index e3b6c27dcba..2030d81260d 100644 --- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp @@ -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: diff --git a/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp index 12b9c2fd4a2..098b1fbf7dd 100644 --- a/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp @@ -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: diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index b72defb08a5..c1cc7bacf08 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -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; diff --git a/utils/llvm.grm b/utils/llvm.grm index 639d86213b7..31be46d22f6 100644 --- a/utils/llvm.grm +++ b/utils/llvm.grm @@ -88,7 +88,6 @@ GVInternalLinkage | appending | dllexport | common - | "common_odr" ; GVExternalLinkage diff --git a/utils/vim/llvm.vim b/utils/vim/llvm.vim index 7d56a4e56a7..201d8ddddbe 100644 --- a/utils/vim/llvm.vim +++ b/utils/vim/llvm.vim @@ -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