[llvm] c6be3ea - [NFC] clean up the AsmPrinter::emitLinkage for AIX part
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 11 10:34:31 PDT 2020
Author: diggerlin
Date: 2020-06-11T13:33:51-04:00
New Revision: c6be3ea524c2e4b64a8db0984148f2f50c8f8e25
URL: https://github.com/llvm/llvm-project/commit/c6be3ea524c2e4b64a8db0984148f2f50c8f8e25
DIFF: https://github.com/llvm/llvm-project/commit/c6be3ea524c2e4b64a8db0984148f2f50c8f8e25.diff
LOG: [NFC] clean up the AsmPrinter::emitLinkage for AIX part
SUMMARY:
Since we deal with aix emitLinkage in the PPCAIXAsmPrinter::emitLinkage() in the patch https://reviews.llvm.org/D75866. It do not go to AsmPrinter::emitLinkage() any more, we clean up some aix related code in the AsmPrinter::emitLinkage()
Reviewers: Jason liu
Differential Revision: https://reviews.llvm.org/D81613
Added:
Modified:
llvm/include/llvm/MC/MCAsmInfo.h
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/MC/MCAsmInfoXCOFF.cpp
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCAsmInfo.h b/llvm/include/llvm/MC/MCAsmInfo.h
index aac1e059302c..974155ff3319 100644
--- a/llvm/include/llvm/MC/MCAsmInfo.h
+++ b/llvm/include/llvm/MC/MCAsmInfo.h
@@ -311,10 +311,6 @@ class MCAsmInfo {
/// false.
bool HasAltEntry = false;
- /// True if this target supports the XCOFF .extern directive. Defaults to
- /// false.
- bool HasDotExternDirective = false;
-
/// Used to declare a global as being a weak symbol. Defaults to ".weak".
const char *WeakDirective;
@@ -335,10 +331,6 @@ class MCAsmInfo {
/// Defaults to false.
bool AvoidWeakIfComdat = false;
- /// True if we have a .lglobl directive, which is used to emit the information
- /// of a static symbol into the symbol table. Defaults to false.
- bool HasDotLGloblDirective = false;
-
/// This attribute, if not MCSA_Invalid, is used to declare a symbol as having
/// hidden visibility. Defaults to MCSA_Hidden.
MCSymbolAttr HiddenVisibilityAttr = MCSA_Hidden;
@@ -594,7 +586,6 @@ class MCAsmInfo {
bool hasIdentDirective() const { return HasIdentDirective; }
bool hasNoDeadStrip() const { return HasNoDeadStrip; }
bool hasAltEntry() const { return HasAltEntry; }
- bool hasDotExternDirective() const { return HasDotExternDirective; }
const char *getWeakDirective() const { return WeakDirective; }
const char *getWeakRefDirective() const { return WeakRefDirective; }
bool hasWeakDefDirective() const { return HasWeakDefDirective; }
@@ -605,8 +596,6 @@ class MCAsmInfo {
bool avoidWeakIfComdat() const { return AvoidWeakIfComdat; }
- bool hasDotLGloblDirective() const { return HasDotLGloblDirective; }
-
MCSymbolAttr getHiddenVisibilityAttr() const { return HiddenVisibilityAttr; }
MCSymbolAttr getHiddenDeclarationVisibilityAttr() const {
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 45ac517f3c68..2e7044bc6aa0 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -395,9 +395,6 @@ void AsmPrinter::emitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const {
GlobalValue::LinkageTypes Linkage = GV->getLinkage();
switch (Linkage) {
case GlobalValue::CommonLinkage:
- assert(!TM.getTargetTriple().isOSBinFormatXCOFF() &&
- "CommonLinkage of XCOFF should not come to this path.");
- LLVM_FALLTHROUGH;
case GlobalValue::LinkOnceAnyLinkage:
case GlobalValue::LinkOnceODRLinkage:
case GlobalValue::WeakAnyLinkage:
@@ -421,29 +418,13 @@ void AsmPrinter::emitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const {
}
return;
case GlobalValue::ExternalLinkage:
- if (MAI->hasDotExternDirective() && GV->isDeclaration())
- OutStreamer->emitSymbolAttribute(GVSym, MCSA_Extern);
- else
- OutStreamer->emitSymbolAttribute(GVSym, MCSA_Global);
+ OutStreamer->emitSymbolAttribute(GVSym, MCSA_Global);
return;
case GlobalValue::PrivateLinkage:
- return;
case GlobalValue::InternalLinkage:
- if (MAI->hasDotLGloblDirective())
- OutStreamer->emitSymbolAttribute(GVSym, MCSA_LGlobal);
return;
case GlobalValue::ExternalWeakLinkage:
- if (TM.getTargetTriple().isOSBinFormatXCOFF()) {
- OutStreamer->emitSymbolAttribute(GVSym, MCSA_Weak);
- return;
- }
- LLVM_FALLTHROUGH;
case GlobalValue::AvailableExternallyLinkage:
- if (MAI->hasDotExternDirective()) {
- OutStreamer->emitSymbolAttribute(GVSym, MCSA_Extern);
- return;
- }
- LLVM_FALLTHROUGH;
case GlobalValue::AppendingLinkage:
llvm_unreachable("Should never emit this");
}
diff --git a/llvm/lib/MC/MCAsmInfoXCOFF.cpp b/llvm/lib/MC/MCAsmInfoXCOFF.cpp
index 4a848426c196..1531f61da95e 100644
--- a/llvm/lib/MC/MCAsmInfoXCOFF.cpp
+++ b/llvm/lib/MC/MCAsmInfoXCOFF.cpp
@@ -32,8 +32,6 @@ MCAsmInfoXCOFF::MCAsmInfoXCOFF() {
COMMDirectiveAlignmentIsInBytes = false;
LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment;
HasDotTypeDotSizeDirective = false;
- HasDotExternDirective = true;
- HasDotLGloblDirective = true;
SymbolsHaveSMC = true;
UseIntegratedAssembler = false;
NeedsFunctionDescriptors = true;
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index d86aa576ef85..fdf5cec0d57f 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -1603,8 +1603,6 @@ void PPCAIXAsmPrinter::emitLinkage(const GlobalValue *GV,
case GlobalValue::PrivateLinkage:
return;
case GlobalValue::InternalLinkage:
- assert(MAI->hasDotLGloblDirective() &&
- "Expecting .lglobl to be supported for AIX.");
OutStreamer->emitSymbolAttribute(GVSym, MCSA_LGlobal);
return;
case GlobalValue::AppendingLinkage:
More information about the llvm-commits
mailing list