Skip to content

Commit ebd26cc

Browse files
committed
[PowerPC] Delete PPCDarwinAsmPrinter and PPCMCAsmInfoDarwin
Darwin support has been removed. Reviewed By: nemanjai Differential Revision: https://reviews.llvm.org/D72063
1 parent ad20169 commit ebd26cc

File tree

8 files changed

+1
-399
lines changed

8 files changed

+1
-399
lines changed

llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,6 @@
1515

1616
using namespace llvm;
1717

18-
void PPCMCAsmInfoDarwin::anchor() { }
19-
20-
PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit, const Triple& T) {
21-
if (is64Bit) {
22-
CodePointerSize = CalleeSaveStackSlotSize = 8;
23-
}
24-
IsLittleEndian = false;
25-
26-
SeparatorString = "@";
27-
CommentString = ";";
28-
ExceptionsType = ExceptionHandling::DwarfCFI;
29-
30-
if (!is64Bit)
31-
Data64bitsDirective = nullptr; // We can't emit a 64-bit unit in PPC32 mode.
32-
33-
AssemblerDialect = 1; // New-Style mnemonics.
34-
SupportsDebugInformation= true; // Debug information.
35-
36-
// The installed assembler for OSX < 10.6 lacks some directives.
37-
// FIXME: this should really be a check on the assembler characteristics
38-
// rather than OS version
39-
if (T.isMacOSX() && T.isMacOSXVersionLT(10, 6))
40-
HasWeakDefCanBeHiddenDirective = false;
41-
42-
UseIntegratedAssembler = true;
43-
}
44-
4518
void PPCELFMCAsmInfo::anchor() { }
4619

4720
PPCELFMCAsmInfo::PPCELFMCAsmInfo(bool is64Bit, const Triple& T) {

llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@
2020
namespace llvm {
2121
class Triple;
2222

23-
class PPCMCAsmInfoDarwin : public MCAsmInfoDarwin {
24-
virtual void anchor();
25-
26-
public:
27-
explicit PPCMCAsmInfoDarwin(bool is64Bit, const Triple &);
28-
};
29-
3023
class PPCELFMCAsmInfo : public MCAsmInfoELF {
3124
void anchor() override;
3225

llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ static MCAsmInfo *createPPCMCAsmInfo(const MCRegisterInfo &MRI,
8383
TheTriple.getArch() == Triple::ppc64le);
8484

8585
MCAsmInfo *MAI;
86-
if (TheTriple.isOSDarwin())
87-
MAI = new PPCMCAsmInfoDarwin(isPPC64, TheTriple);
88-
else if (TheTriple.isOSBinFormatXCOFF())
86+
if (TheTriple.isOSBinFormatXCOFF())
8987
MAI = new PPCXCOFFMCAsmInfo(isPPC64, TheTriple);
9088
else
9189
MAI = new PPCELFMCAsmInfo(isPPC64, TheTriple);

llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

Lines changed: 0 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -147,22 +147,6 @@ class PPCLinuxAsmPrinter : public PPCAsmPrinter {
147147
void EmitInstruction(const MachineInstr *MI) override;
148148
};
149149

150-
/// PPCDarwinAsmPrinter - PowerPC assembly printer, customized for Darwin/Mac
151-
/// OS X
152-
class PPCDarwinAsmPrinter : public PPCAsmPrinter {
153-
public:
154-
explicit PPCDarwinAsmPrinter(TargetMachine &TM,
155-
std::unique_ptr<MCStreamer> Streamer)
156-
: PPCAsmPrinter(TM, std::move(Streamer)) {}
157-
158-
StringRef getPassName() const override {
159-
return "Darwin PPC Assembly Printer";
160-
}
161-
162-
bool doFinalization(Module &M) override;
163-
void EmitStartOfAsmFile(Module &M) override;
164-
};
165-
166150
class PPCAIXAsmPrinter : public PPCAsmPrinter {
167151
private:
168152
static void ValidateGV(const GlobalVariable *GV);
@@ -1595,152 +1579,6 @@ void PPCLinuxAsmPrinter::EmitFunctionBodyEnd() {
15951579
}
15961580
}
15971581

1598-
void PPCDarwinAsmPrinter::EmitStartOfAsmFile(Module &M) {
1599-
static const char *const CPUDirectives[] = {
1600-
"",
1601-
"ppc",
1602-
"ppc440",
1603-
"ppc601",
1604-
"ppc602",
1605-
"ppc603",
1606-
"ppc7400",
1607-
"ppc750",
1608-
"ppc970",
1609-
"ppcA2",
1610-
"ppce500",
1611-
"ppce500mc",
1612-
"ppce5500",
1613-
"power3",
1614-
"power4",
1615-
"power5",
1616-
"power5x",
1617-
"power6",
1618-
"power6x",
1619-
"power7",
1620-
// FIXME: why is power8 missing here?
1621-
"ppc64",
1622-
"ppc64le",
1623-
"power9",
1624-
"future"
1625-
};
1626-
1627-
// Get the numerically largest directive.
1628-
// FIXME: How should we merge darwin directives?
1629-
unsigned Directive = PPC::DIR_NONE;
1630-
for (const Function &F : M) {
1631-
const PPCSubtarget &STI = TM.getSubtarget<PPCSubtarget>(F);
1632-
unsigned FDir = STI.getCPUDirective();
1633-
Directive = Directive > FDir ? FDir : STI.getCPUDirective();
1634-
if (STI.hasMFOCRF() && Directive < PPC::DIR_970)
1635-
Directive = PPC::DIR_970;
1636-
if (STI.hasAltivec() && Directive < PPC::DIR_7400)
1637-
Directive = PPC::DIR_7400;
1638-
if (STI.isPPC64() && Directive < PPC::DIR_64)
1639-
Directive = PPC::DIR_64;
1640-
}
1641-
1642-
assert(Directive <= PPC::DIR_64 && "Directive out of range.");
1643-
1644-
assert(Directive < array_lengthof(CPUDirectives) &&
1645-
"CPUDirectives[] might not be up-to-date!");
1646-
PPCTargetStreamer &TStreamer =
1647-
*static_cast<PPCTargetStreamer *>(OutStreamer->getTargetStreamer());
1648-
TStreamer.emitMachine(CPUDirectives[Directive]);
1649-
1650-
// Prime text sections so they are adjacent. This reduces the likelihood a
1651-
// large data or debug section causes a branch to exceed 16M limit.
1652-
const TargetLoweringObjectFileMachO &TLOFMacho =
1653-
static_cast<const TargetLoweringObjectFileMachO &>(getObjFileLowering());
1654-
OutStreamer->SwitchSection(TLOFMacho.getTextCoalSection());
1655-
if (TM.getRelocationModel() == Reloc::PIC_) {
1656-
OutStreamer->SwitchSection(
1657-
OutContext.getMachOSection("__TEXT", "__picsymbolstub1",
1658-
MachO::S_SYMBOL_STUBS |
1659-
MachO::S_ATTR_PURE_INSTRUCTIONS,
1660-
32, SectionKind::getText()));
1661-
} else if (TM.getRelocationModel() == Reloc::DynamicNoPIC) {
1662-
OutStreamer->SwitchSection(
1663-
OutContext.getMachOSection("__TEXT","__symbol_stub1",
1664-
MachO::S_SYMBOL_STUBS |
1665-
MachO::S_ATTR_PURE_INSTRUCTIONS,
1666-
16, SectionKind::getText()));
1667-
}
1668-
OutStreamer->SwitchSection(getObjFileLowering().getTextSection());
1669-
}
1670-
1671-
bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
1672-
bool isPPC64 = getDataLayout().getPointerSizeInBits() == 64;
1673-
1674-
// Darwin/PPC always uses mach-o.
1675-
const TargetLoweringObjectFileMachO &TLOFMacho =
1676-
static_cast<const TargetLoweringObjectFileMachO &>(getObjFileLowering());
1677-
if (MMI) {
1678-
MachineModuleInfoMachO &MMIMacho =
1679-
MMI->getObjFileInfo<MachineModuleInfoMachO>();
1680-
1681-
if (MAI->doesSupportExceptionHandling()) {
1682-
// Add the (possibly multiple) personalities to the set of global values.
1683-
// Only referenced functions get into the Personalities list.
1684-
for (const Function *Personality : MMI->getPersonalities()) {
1685-
if (Personality) {
1686-
MCSymbol *NLPSym =
1687-
getSymbolWithGlobalValueBase(Personality, "$non_lazy_ptr");
1688-
MachineModuleInfoImpl::StubValueTy &StubSym =
1689-
MMIMacho.getGVStubEntry(NLPSym);
1690-
StubSym =
1691-
MachineModuleInfoImpl::StubValueTy(getSymbol(Personality), true);
1692-
}
1693-
}
1694-
}
1695-
1696-
// Output stubs for dynamically-linked functions.
1697-
MachineModuleInfoMachO::SymbolListTy Stubs = MMIMacho.GetGVStubList();
1698-
1699-
// Output macho stubs for external and common global variables.
1700-
if (!Stubs.empty()) {
1701-
// Switch with ".non_lazy_symbol_pointer" directive.
1702-
OutStreamer->SwitchSection(TLOFMacho.getNonLazySymbolPointerSection());
1703-
EmitAlignment(isPPC64 ? Align(8) : Align(4));
1704-
1705-
for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
1706-
// L_foo$stub:
1707-
OutStreamer->EmitLabel(Stubs[i].first);
1708-
// .indirect_symbol _foo
1709-
MachineModuleInfoImpl::StubValueTy &MCSym = Stubs[i].second;
1710-
OutStreamer->EmitSymbolAttribute(MCSym.getPointer(),
1711-
MCSA_IndirectSymbol);
1712-
1713-
if (MCSym.getInt())
1714-
// External to current translation unit.
1715-
OutStreamer->EmitIntValue(0, isPPC64 ? 8 : 4 /*size*/);
1716-
else
1717-
// Internal to current translation unit.
1718-
//
1719-
// When we place the LSDA into the TEXT section, the type info
1720-
// pointers
1721-
// need to be indirect and pc-rel. We accomplish this by using NLPs.
1722-
// However, sometimes the types are local to the file. So we need to
1723-
// fill in the value for the NLP in those cases.
1724-
OutStreamer->EmitValue(
1725-
MCSymbolRefExpr::create(MCSym.getPointer(), OutContext),
1726-
isPPC64 ? 8 : 4 /*size*/);
1727-
}
1728-
1729-
Stubs.clear();
1730-
OutStreamer->AddBlankLine();
1731-
}
1732-
}
1733-
1734-
// Funny Darwin hack: This flag tells the linker that no global symbols
1735-
// contain code that falls through to other global symbols (e.g. the obvious
1736-
// implementation of multiple entry points). If this doesn't occur, the
1737-
// linker can safely perform dead code stripping. Since LLVM never generates
1738-
// code that does this, it is always safe to set.
1739-
OutStreamer->EmitAssemblerFlag(MCAF_SubsectionsViaSymbols);
1740-
1741-
return AsmPrinter::doFinalization(M);
1742-
}
1743-
17441582
void PPCAIXAsmPrinter::SetupMachineFunction(MachineFunction &MF) {
17451583
// Get the function descriptor symbol.
17461584
CurrentFnDescSym = getSymbol(&MF.getFunction());
@@ -1957,8 +1795,6 @@ PPCAIXAsmPrinter::getMCSymbolForTOCPseudoMO(const MachineOperand &MO) {
19571795
static AsmPrinter *
19581796
createPPCAsmPrinterPass(TargetMachine &tm,
19591797
std::unique_ptr<MCStreamer> &&Streamer) {
1960-
if (tm.getTargetTriple().isMacOSX())
1961-
return new PPCDarwinAsmPrinter(tm, std::move(Streamer));
19621798
if (tm.getTargetTriple().isOSAIX())
19631799
return new PPCAIXAsmPrinter(tm, std::move(Streamer));
19641800

llvm/test/CodeGen/PowerPC/hello-reloc.s

Lines changed: 0 additions & 140 deletions
This file was deleted.

0 commit comments

Comments
 (0)