diff options
author | Lang Hames <lhames@gmail.com> | 2015-01-06 23:04:36 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2015-01-06 23:04:36 +0000 |
commit | 66f755f84f4ed145d0daccc4e49338b48a517874 (patch) | |
tree | eed9beb6577413ec17bd71aae05e16e0fc2c77f9 /llvm/lib | |
parent | d0101a2dfd8f81f57989743afe812b0b47acab87 (diff) | |
download | bcm5719-llvm-66f755f84f4ed145d0daccc4e49338b48a517874.tar.gz bcm5719-llvm-66f755f84f4ed145d0daccc4e49338b48a517874.zip |
Revert r224935 "Refactor duplicated code. No intended functionality change."
This is affecting the behavior of some ObjC++ / AArch64 test cases on Darwin.
Reverting to get the bots green while I track down the source of the changed
behavior.
llvm-svn: 225311
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 54 | ||||
-rw-r--r-- | llvm/lib/MC/MCAsmInfo.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/MC/MCAsmInfoDarwin.cpp | 53 | ||||
-rw-r--r-- | llvm/lib/MC/MCAssembler.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.h | 3 | ||||
-rw-r--r-- | llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.h | 3 | ||||
-rw-r--r-- | llvm/lib/Target/TargetLoweringObjectFile.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/Target/TargetMachine.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp | 20 | ||||
-rw-r--r-- | llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h | 3 |
10 files changed, 87 insertions, 67 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 9f1e06b4725..3df1e4ea13e 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -573,6 +573,60 @@ const MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal( return S; } +bool TargetLoweringObjectFileMachO::isSectionAtomizableBySymbols( + const MCSection &Section) const { + const MCSectionMachO &SMO = static_cast<const MCSectionMachO&>(Section); + + // Sections holding 1 byte strings are atomized based on the data + // they contain. + // Sections holding 2 byte strings require symbols in order to be + // atomized. + // There is no dedicated section for 4 byte strings. + if (SMO.getKind().isMergeable1ByteCString()) + return false; + + if (SMO.getSegmentName() == "__TEXT" && + SMO.getSectionName() == "__objc_classname" && + SMO.getType() == MachO::S_CSTRING_LITERALS) + return false; + + if (SMO.getSegmentName() == "__TEXT" && + SMO.getSectionName() == "__objc_methname" && + SMO.getType() == MachO::S_CSTRING_LITERALS) + return false; + + if (SMO.getSegmentName() == "__TEXT" && + SMO.getSectionName() == "__objc_methtype" && + SMO.getType() == MachO::S_CSTRING_LITERALS) + return false; + + if (SMO.getSegmentName() == "__DATA" && + SMO.getSectionName() == "__cfstring") + return false; + + // no_dead_strip sections are not atomized in practice. + if (SMO.hasAttribute(MachO::S_ATTR_NO_DEAD_STRIP)) + return false; + + switch (SMO.getType()) { + default: + return true; + + // These sections are atomized at the element boundaries without using + // symbols. + case MachO::S_4BYTE_LITERALS: + case MachO::S_8BYTE_LITERALS: + case MachO::S_16BYTE_LITERALS: + case MachO::S_LITERAL_POINTERS: + case MachO::S_NON_LAZY_SYMBOL_POINTERS: + case MachO::S_LAZY_SYMBOL_POINTERS: + case MachO::S_MOD_INIT_FUNC_POINTERS: + case MachO::S_MOD_TERM_FUNC_POINTERS: + case MachO::S_INTERPOSING: + return false; + } +} + const MCSection *TargetLoweringObjectFileMachO:: SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const { diff --git a/llvm/lib/MC/MCAsmInfo.cpp b/llvm/lib/MC/MCAsmInfo.cpp index 04b804209a7..6fe2804e30a 100644 --- a/llvm/lib/MC/MCAsmInfo.cpp +++ b/llvm/lib/MC/MCAsmInfo.cpp @@ -109,10 +109,6 @@ MCAsmInfo::MCAsmInfo() { MCAsmInfo::~MCAsmInfo() { } -bool MCAsmInfo::isSectionAtomizableBySymbols(const MCSection &Section) const { - return false; -} - const MCExpr * MCAsmInfo::getExprForPersonalitySymbol(const MCSymbol *Sym, unsigned Encoding, diff --git a/llvm/lib/MC/MCAsmInfoDarwin.cpp b/llvm/lib/MC/MCAsmInfoDarwin.cpp index f346b93ec24..66a138b90c6 100644 --- a/llvm/lib/MC/MCAsmInfoDarwin.cpp +++ b/llvm/lib/MC/MCAsmInfoDarwin.cpp @@ -15,61 +15,10 @@ #include "llvm/MC/MCAsmInfoDarwin.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCExpr.h" -#include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCStreamer.h" using namespace llvm; -bool MCAsmInfoDarwin::isSectionAtomizableBySymbols( - const MCSection &Section) const { - const MCSectionMachO &SMO = static_cast<const MCSectionMachO &>(Section); - - // Sections holding 1 byte strings are atomized based on the data they - // contain. - // Sections holding 2 byte strings require symbols in order to be atomized. - // There is no dedicated section for 4 byte strings. - if (SMO.getKind().isMergeable1ByteCString()) - return false; - - if (SMO.getSegmentName() == "__TEXT" && - SMO.getSectionName() == "__objc_classname" && - SMO.getType() == MachO::S_CSTRING_LITERALS) - return false; - - if (SMO.getSegmentName() == "__TEXT" && - SMO.getSectionName() == "__objc_methname" && - SMO.getType() == MachO::S_CSTRING_LITERALS) - return false; - - if (SMO.getSegmentName() == "__TEXT" && - SMO.getSectionName() == "__objc_methtype" && - SMO.getType() == MachO::S_CSTRING_LITERALS) - return false; - - if (SMO.getSegmentName() == "__DATA" && SMO.getSectionName() == "__cfstring") - return false; - - // no_dead_strip sections are not atomized in practice. - if (SMO.hasAttribute(MachO::S_ATTR_NO_DEAD_STRIP)) - return false; - - switch (SMO.getType()) { - default: - return true; - - // These sections are atomized at the element boundaries without using - // symbols. - case MachO::S_4BYTE_LITERALS: - case MachO::S_8BYTE_LITERALS: - case MachO::S_16BYTE_LITERALS: - case MachO::S_LITERAL_POINTERS: - case MachO::S_NON_LAZY_SYMBOL_POINTERS: - case MachO::S_LAZY_SYMBOL_POINTERS: - case MachO::S_MOD_INIT_FUNC_POINTERS: - case MachO::S_MOD_TERM_FUNC_POINTERS: - case MachO::S_INTERPOSING: - return false; - } -} +void MCAsmInfoDarwin::anchor() { } MCAsmInfoDarwin::MCAsmInfoDarwin() { // Common settings for all Darwin targets. diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index 459488bfe15..85d0c13c710 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -12,7 +12,6 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/Twine.h" #include "llvm/MC/MCAsmBackend.h" -#include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCAsmLayout.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCContext.h" @@ -449,8 +448,8 @@ const MCSymbolData *MCAssembler::getAtom(const MCSymbolData *SD) const { // Non-linker visible symbols in sections which can't be atomized have no // defining atom. - if (!getContext().getAsmInfo()->isSectionAtomizableBySymbols( - SD->getFragment()->getParent()->getSection())) + if (!getBackend().isSectionAtomizable( + SD->getFragment()->getParent()->getSection())) return nullptr; // Otherwise, return the atom for the containing fragment. diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.h b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.h index 6cb471537f6..f1fef41a3b1 100644 --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.h +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.h @@ -21,8 +21,7 @@ namespace llvm { class ARMMCAsmInfoDarwin : public MCAsmInfoDarwin { - virtual void anchor(); - + void anchor() override; public: explicit ARMMCAsmInfoDarwin(StringRef TT); }; diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.h b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.h index 86ad3859b72..9f0294d0ffd 100644 --- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.h +++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.h @@ -21,8 +21,7 @@ namespace llvm { class Triple; class PPCMCAsmInfoDarwin : public MCAsmInfoDarwin { - virtual void anchor(); - + void anchor() override; public: explicit PPCMCAsmInfoDarwin(bool is64Bit, const Triple&); }; diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp index f34347382df..01139fb20cf 100644 --- a/llvm/lib/Target/TargetLoweringObjectFile.cpp +++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp @@ -270,6 +270,12 @@ SectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, return SelectSectionForGlobal(GV, Kind, Mang, TM); } +bool TargetLoweringObjectFile::isSectionAtomizableBySymbols( + const MCSection &Section) const { + return false; +} + + /// getSectionForConstant - Given a mergable constant with the /// specified size and relocation information, return a section that it /// should be placed in. diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp index cff9e062173..309e1bf2786 100644 --- a/llvm/lib/Target/TargetMachine.cpp +++ b/llvm/lib/Target/TargetMachine.cpp @@ -182,8 +182,7 @@ void TargetMachine::getNameWithPrefix(SmallVectorImpl<char> &Name, const TargetLoweringObjectFile &TLOF = getSubtargetImpl()->getTargetLowering()->getObjFileLowering(); const MCSection *TheSection = TLOF.SectionForGlobal(GV, GVKind, Mang, *this); - bool CannotUsePrivateLabel = - AsmInfo->isSectionAtomizableBySymbols(*TheSection); + bool CannotUsePrivateLabel = TLOF.isSectionAtomizableBySymbols(*TheSection); Mang.getNameWithPrefix(Name, GV, CannotUsePrivateLabel); } diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp index 164b4192ae6..03a1e02f188 100644 --- a/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp +++ b/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp @@ -790,6 +790,26 @@ public: return SMO.getType() == MachO::S_CSTRING_LITERALS; } + bool isSectionAtomizable(const MCSection &Section) const override { + const MCSectionMachO &SMO = static_cast<const MCSectionMachO&>(Section); + // Fixed sized data sections are uniqued, they cannot be diced into atoms. + switch (SMO.getType()) { + default: + return true; + + case MachO::S_4BYTE_LITERALS: + case MachO::S_8BYTE_LITERALS: + case MachO::S_16BYTE_LITERALS: + case MachO::S_LITERAL_POINTERS: + case MachO::S_NON_LAZY_SYMBOL_POINTERS: + case MachO::S_LAZY_SYMBOL_POINTERS: + case MachO::S_MOD_INIT_FUNC_POINTERS: + case MachO::S_MOD_TERM_FUNC_POINTERS: + case MachO::S_INTERPOSING: + return false; + } + } + /// \brief Generate the compact unwind encoding for the CFI instructions. uint32_t generateCompactUnwindEncoding( ArrayRef<MCCFIInstruction> Instrs) const override { diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h b/llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h index deaad2a5b8e..f2f06c358bf 100644 --- a/llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h +++ b/llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h @@ -23,8 +23,7 @@ namespace llvm { class Triple; class X86MCAsmInfoDarwin : public MCAsmInfoDarwin { - virtual void anchor(); - + void anchor() override; public: explicit X86MCAsmInfoDarwin(const Triple &Triple); }; |