diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 06642a9a77c7..e810cea17a01 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -70,53 +70,14 @@ Disable16Bit("disable-16bit", cl::Hidden, static SDValue getMOVL(SelectionDAG &DAG, DebugLoc dl, EVT VT, SDValue V1, SDValue V2); -// FIXME: This is for a test. -static cl::opt -EnableX86EHTest("enable-x86-eh-test", cl::Hidden); - -namespace llvm { - class X86_test_MachoTargetObjectFile : public TargetLoweringObjectFileMachO { - public: - virtual void Initialize(MCContext &Ctx, const TargetMachine &TM) { - TargetLoweringObjectFileMachO::Initialize(Ctx, TM); - - // Exception Handling. - LSDASection = getMachOSection("__TEXT", "__gcc_except_tab", 0, - SectionKind::getReadOnlyWithRel()); - } - - virtual unsigned getTTypeEncoding() const { - return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4; - } - }; - - class X8664_test_MachoTargetObjectFile : public X8664_MachoTargetObjectFile { - public: - virtual void Initialize(MCContext &Ctx, const TargetMachine &TM) { - TargetLoweringObjectFileMachO::Initialize(Ctx, TM); - - // Exception Handling. - LSDASection = getMachOSection("__TEXT", "__gcc_except_tab", 0, - SectionKind::getReadOnlyWithRel()); - } - - virtual unsigned getTTypeEncoding() const { - return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4; - } - }; -} - static TargetLoweringObjectFile *createTLOF(X86TargetMachine &TM) { switch (TM.getSubtarget().TargetType) { default: llvm_unreachable("unknown subtarget type"); case X86Subtarget::isDarwin: - // FIXME: This is for an EH test. - if (EnableX86EHTest) { - if (TM.getSubtarget().is64Bit()) - return new X8664_test_MachoTargetObjectFile(); - else - return new X86_test_MachoTargetObjectFile(); - } + if (TM.getSubtarget().is64Bit()) + return new X8664_MachoTargetObjectFile(); + else + return new X86_MachoTargetObjectFile(); if (TM.getSubtarget().is64Bit()) return new X8664_MachoTargetObjectFile(); diff --git a/llvm/lib/Target/X86/X86TargetObjectFile.cpp b/llvm/lib/Target/X86/X86TargetObjectFile.cpp index f49153b19d80..755967bd24fa 100644 --- a/llvm/lib/Target/X86/X86TargetObjectFile.cpp +++ b/llvm/lib/Target/X86/X86TargetObjectFile.cpp @@ -12,12 +12,26 @@ #include "X86TargetMachine.h" #include "llvm/CodeGen/MachineModuleInfoImpls.h" #include "llvm/MC/MCContext.h" +#include "llvm/MC/MCSectionMachO.h" #include "llvm/Target/Mangler.h" #include "llvm/ADT/SmallString.h" #include "llvm/Support/Dwarf.h" using namespace llvm; using namespace dwarf; +void X86_MachoTargetObjectFile::Initialize(MCContext &Ctx, + const TargetMachine &TM) { + TargetLoweringObjectFileMachO::Initialize(Ctx, TM); + + // Exception Handling. + LSDASection = getMachOSection("__TEXT", "__gcc_except_tab", 0, + SectionKind::getReadOnlyWithRel()); +} + +unsigned X86_MachoTargetObjectFile::getTTypeEncoding() const { + return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4; +} + const MCExpr *X8664_MachoTargetObjectFile:: getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, MachineModuleInfo *MMI, unsigned Encoding, diff --git a/llvm/lib/Target/X86/X86TargetObjectFile.h b/llvm/lib/Target/X86/X86TargetObjectFile.h index 8fef4d192bbd..2ae7631ef57a 100644 --- a/llvm/lib/Target/X86/X86TargetObjectFile.h +++ b/llvm/lib/Target/X86/X86TargetObjectFile.h @@ -17,11 +17,19 @@ namespace llvm { class X86TargetMachine; - /// X8664_MachoTargetObjectFile - This TLOF implementation is used for - /// Darwin/x86-64. - class X8664_MachoTargetObjectFile : public TargetLoweringObjectFileMachO { + /// X86_MachoTargetObjectFile - This TLOF implementation is used for Darwin + /// x86 variants. + class X86_MachoTargetObjectFile : public TargetLoweringObjectFileMachO { public: + virtual void Initialize(MCContext &Ctx, const TargetMachine &TM); + virtual unsigned getTTypeEncoding() const; + }; + + /// X8664_MachoTargetObjectFile - This TLOF implementation is used for Darwin + /// x86-64. + class X8664_MachoTargetObjectFile : public X86_MachoTargetObjectFile { + public: virtual const MCExpr * getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, MachineModuleInfo *MMI, unsigned Encoding,