diff options
author | Fangrui Song <maskray@google.com> | 2020-01-01 19:27:55 -0800 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2020-01-12 11:02:02 -0800 |
commit | ebd26cc8c434f40fe8079ee823e7657b5138769f (patch) | |
tree | 527340cbba0d4e1aac57fe02a2b7aec616a7f5b9 /llvm/lib | |
parent | ad201691d5cc0f15f6f885f3847dcc6440ee3de5 (diff) | |
download | bcm5719-llvm-ebd26cc8c434f40fe8079ee823e7657b5138769f.tar.gz bcm5719-llvm-ebd26cc8c434f40fe8079ee823e7657b5138769f.zip |
[PowerPC] Delete PPCDarwinAsmPrinter and PPCMCAsmInfoDarwin
Darwin support has been removed.
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D72063
Diffstat (limited to 'llvm/lib')
4 files changed, 1 insertions, 201 deletions
diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp index a61c34ca6f1..dc2c216a3ef 100644 --- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp +++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp @@ -15,33 +15,6 @@ using namespace llvm; -void PPCMCAsmInfoDarwin::anchor() { } - -PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit, const Triple& T) { - if (is64Bit) { - CodePointerSize = CalleeSaveStackSlotSize = 8; - } - IsLittleEndian = false; - - SeparatorString = "@"; - CommentString = ";"; - ExceptionsType = ExceptionHandling::DwarfCFI; - - if (!is64Bit) - Data64bitsDirective = nullptr; // We can't emit a 64-bit unit in PPC32 mode. - - AssemblerDialect = 1; // New-Style mnemonics. - SupportsDebugInformation= true; // Debug information. - - // The installed assembler for OSX < 10.6 lacks some directives. - // FIXME: this should really be a check on the assembler characteristics - // rather than OS version - if (T.isMacOSX() && T.isMacOSXVersionLT(10, 6)) - HasWeakDefCanBeHiddenDirective = false; - - UseIntegratedAssembler = true; -} - void PPCELFMCAsmInfo::anchor() { } PPCELFMCAsmInfo::PPCELFMCAsmInfo(bool is64Bit, const Triple& T) { diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.h b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.h index 42cb62ad26a..8c52bbbd8a5 100644 --- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.h +++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.h @@ -20,13 +20,6 @@ namespace llvm { class Triple; -class PPCMCAsmInfoDarwin : public MCAsmInfoDarwin { - virtual void anchor(); - -public: - explicit PPCMCAsmInfoDarwin(bool is64Bit, const Triple &); -}; - class PPCELFMCAsmInfo : public MCAsmInfoELF { void anchor() override; diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp index 5e91bdb2f8d..18bff4c7883 100644 --- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp +++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp @@ -83,9 +83,7 @@ static MCAsmInfo *createPPCMCAsmInfo(const MCRegisterInfo &MRI, TheTriple.getArch() == Triple::ppc64le); MCAsmInfo *MAI; - if (TheTriple.isOSDarwin()) - MAI = new PPCMCAsmInfoDarwin(isPPC64, TheTriple); - else if (TheTriple.isOSBinFormatXCOFF()) + if (TheTriple.isOSBinFormatXCOFF()) MAI = new PPCXCOFFMCAsmInfo(isPPC64, TheTriple); else MAI = new PPCELFMCAsmInfo(isPPC64, TheTriple); diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp index 79d8660a322..f93f1c00e95 100644 --- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -147,22 +147,6 @@ public: void EmitInstruction(const MachineInstr *MI) override; }; -/// PPCDarwinAsmPrinter - PowerPC assembly printer, customized for Darwin/Mac -/// OS X -class PPCDarwinAsmPrinter : public PPCAsmPrinter { -public: - explicit PPCDarwinAsmPrinter(TargetMachine &TM, - std::unique_ptr<MCStreamer> Streamer) - : PPCAsmPrinter(TM, std::move(Streamer)) {} - - StringRef getPassName() const override { - return "Darwin PPC Assembly Printer"; - } - - bool doFinalization(Module &M) override; - void EmitStartOfAsmFile(Module &M) override; -}; - class PPCAIXAsmPrinter : public PPCAsmPrinter { private: static void ValidateGV(const GlobalVariable *GV); @@ -1595,152 +1579,6 @@ void PPCLinuxAsmPrinter::EmitFunctionBodyEnd() { } } -void PPCDarwinAsmPrinter::EmitStartOfAsmFile(Module &M) { - static const char *const CPUDirectives[] = { - "", - "ppc", - "ppc440", - "ppc601", - "ppc602", - "ppc603", - "ppc7400", - "ppc750", - "ppc970", - "ppcA2", - "ppce500", - "ppce500mc", - "ppce5500", - "power3", - "power4", - "power5", - "power5x", - "power6", - "power6x", - "power7", - // FIXME: why is power8 missing here? - "ppc64", - "ppc64le", - "power9", - "future" - }; - - // Get the numerically largest directive. - // FIXME: How should we merge darwin directives? - unsigned Directive = PPC::DIR_NONE; - for (const Function &F : M) { - const PPCSubtarget &STI = TM.getSubtarget<PPCSubtarget>(F); - unsigned FDir = STI.getCPUDirective(); - Directive = Directive > FDir ? FDir : STI.getCPUDirective(); - if (STI.hasMFOCRF() && Directive < PPC::DIR_970) - Directive = PPC::DIR_970; - if (STI.hasAltivec() && Directive < PPC::DIR_7400) - Directive = PPC::DIR_7400; - if (STI.isPPC64() && Directive < PPC::DIR_64) - Directive = PPC::DIR_64; - } - - assert(Directive <= PPC::DIR_64 && "Directive out of range."); - - assert(Directive < array_lengthof(CPUDirectives) && - "CPUDirectives[] might not be up-to-date!"); - PPCTargetStreamer &TStreamer = - *static_cast<PPCTargetStreamer *>(OutStreamer->getTargetStreamer()); - TStreamer.emitMachine(CPUDirectives[Directive]); - - // Prime text sections so they are adjacent. This reduces the likelihood a - // large data or debug section causes a branch to exceed 16M limit. - const TargetLoweringObjectFileMachO &TLOFMacho = - static_cast<const TargetLoweringObjectFileMachO &>(getObjFileLowering()); - OutStreamer->SwitchSection(TLOFMacho.getTextCoalSection()); - if (TM.getRelocationModel() == Reloc::PIC_) { - OutStreamer->SwitchSection( - OutContext.getMachOSection("__TEXT", "__picsymbolstub1", - MachO::S_SYMBOL_STUBS | - MachO::S_ATTR_PURE_INSTRUCTIONS, - 32, SectionKind::getText())); - } else if (TM.getRelocationModel() == Reloc::DynamicNoPIC) { - OutStreamer->SwitchSection( - OutContext.getMachOSection("__TEXT","__symbol_stub1", - MachO::S_SYMBOL_STUBS | - MachO::S_ATTR_PURE_INSTRUCTIONS, - 16, SectionKind::getText())); - } - OutStreamer->SwitchSection(getObjFileLowering().getTextSection()); -} - -bool PPCDarwinAsmPrinter::doFinalization(Module &M) { - bool isPPC64 = getDataLayout().getPointerSizeInBits() == 64; - - // Darwin/PPC always uses mach-o. - const TargetLoweringObjectFileMachO &TLOFMacho = - static_cast<const TargetLoweringObjectFileMachO &>(getObjFileLowering()); - if (MMI) { - MachineModuleInfoMachO &MMIMacho = - MMI->getObjFileInfo<MachineModuleInfoMachO>(); - - if (MAI->doesSupportExceptionHandling()) { - // Add the (possibly multiple) personalities to the set of global values. - // Only referenced functions get into the Personalities list. - for (const Function *Personality : MMI->getPersonalities()) { - if (Personality) { - MCSymbol *NLPSym = - getSymbolWithGlobalValueBase(Personality, "$non_lazy_ptr"); - MachineModuleInfoImpl::StubValueTy &StubSym = - MMIMacho.getGVStubEntry(NLPSym); - StubSym = - MachineModuleInfoImpl::StubValueTy(getSymbol(Personality), true); - } - } - } - - // Output stubs for dynamically-linked functions. - MachineModuleInfoMachO::SymbolListTy Stubs = MMIMacho.GetGVStubList(); - - // Output macho stubs for external and common global variables. - if (!Stubs.empty()) { - // Switch with ".non_lazy_symbol_pointer" directive. - OutStreamer->SwitchSection(TLOFMacho.getNonLazySymbolPointerSection()); - EmitAlignment(isPPC64 ? Align(8) : Align(4)); - - for (unsigned i = 0, e = Stubs.size(); i != e; ++i) { - // L_foo$stub: - OutStreamer->EmitLabel(Stubs[i].first); - // .indirect_symbol _foo - MachineModuleInfoImpl::StubValueTy &MCSym = Stubs[i].second; - OutStreamer->EmitSymbolAttribute(MCSym.getPointer(), - MCSA_IndirectSymbol); - - if (MCSym.getInt()) - // External to current translation unit. - OutStreamer->EmitIntValue(0, isPPC64 ? 8 : 4 /*size*/); - else - // Internal to current translation unit. - // - // When we place the LSDA into the TEXT section, the type info - // pointers - // need to be indirect and pc-rel. We accomplish this by using NLPs. - // However, sometimes the types are local to the file. So we need to - // fill in the value for the NLP in those cases. - OutStreamer->EmitValue( - MCSymbolRefExpr::create(MCSym.getPointer(), OutContext), - isPPC64 ? 8 : 4 /*size*/); - } - - Stubs.clear(); - OutStreamer->AddBlankLine(); - } - } - - // Funny Darwin hack: This flag tells the linker that no global symbols - // contain code that falls through to other global symbols (e.g. the obvious - // implementation of multiple entry points). If this doesn't occur, the - // linker can safely perform dead code stripping. Since LLVM never generates - // code that does this, it is always safe to set. - OutStreamer->EmitAssemblerFlag(MCAF_SubsectionsViaSymbols); - - return AsmPrinter::doFinalization(M); -} - void PPCAIXAsmPrinter::SetupMachineFunction(MachineFunction &MF) { // Get the function descriptor symbol. CurrentFnDescSym = getSymbol(&MF.getFunction()); @@ -1957,8 +1795,6 @@ PPCAIXAsmPrinter::getMCSymbolForTOCPseudoMO(const MachineOperand &MO) { static AsmPrinter * createPPCAsmPrinterPass(TargetMachine &tm, std::unique_ptr<MCStreamer> &&Streamer) { - if (tm.getTargetTriple().isMacOSX()) - return new PPCDarwinAsmPrinter(tm, std::move(Streamer)); if (tm.getTargetTriple().isOSAIX()) return new PPCAIXAsmPrinter(tm, std::move(Streamer)); |