From cb9009993b20ab41fab56518d666ba69533db4b3 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Tue, 16 Jan 2007 09:29:17 +0000 Subject: [PATCH] Instead of yet another enum indicating the "assembly language flavor", just use the one that's in the subtarget. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33255 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/PowerPC/PPCSubtarget.cpp | 3 +++ lib/Target/PowerPC/PPCSubtarget.h | 13 ++++++++++++- lib/Target/PowerPC/PPCTargetAsmInfo.cpp | 9 +-------- lib/Target/X86/X86Subtarget.h | 4 ++++ lib/Target/X86/X86TargetAsmInfo.cpp | 11 ++--------- 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/lib/Target/PowerPC/PPCSubtarget.cpp b/lib/Target/PowerPC/PPCSubtarget.cpp index eca16c4a38c..235b9d591de 100644 --- a/lib/Target/PowerPC/PPCSubtarget.cpp +++ b/lib/Target/PowerPC/PPCSubtarget.cpp @@ -112,6 +112,9 @@ PPCSubtarget::PPCSubtarget(const TargetMachine &tm, const Module &M, // Set up darwin-specific properties. if (IsDarwin) { HasLazyResolverStubs = true; + AsmFlavor = NewMnemonic; + } else { + AsmFlavor = OldMnemonic; } } diff --git a/lib/Target/PowerPC/PPCSubtarget.h b/lib/Target/PowerPC/PPCSubtarget.h index 65d07d89526..63efe9e9636 100644 --- a/lib/Target/PowerPC/PPCSubtarget.h +++ b/lib/Target/PowerPC/PPCSubtarget.h @@ -40,6 +40,10 @@ class GlobalValue; class TargetMachine; class PPCSubtarget : public TargetSubtarget { +public: + enum AsmWriterFlavorTy { + OldMnemonic, NewMnemonic, Unset + }; protected: const TargetMachine &TM; @@ -53,6 +57,9 @@ protected: /// Which cpu directive was used. unsigned DarwinDirective; + /// AsmFlavor - Which PPC asm dialect to use. + AsmWriterFlavorTy AsmFlavor; + /// Used by the ISel to turn in optimizations for POWER4-derived architectures bool IsGigaProcessor; bool Has64BitSupport; @@ -120,8 +127,12 @@ public: bool hasSTFIWX() const { return HasSTFIWX; } bool hasAltivec() const { return HasAltivec; } bool isGigaProcessor() const { return IsGigaProcessor; } - + bool isDarwin() const { return IsDarwin; } + + unsigned getAsmFlavor() const { + return AsmFlavor != Unset ? unsigned(AsmFlavor) : 0; + } }; } // End llvm namespace diff --git a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp index 7912f705738..b9f5849bdf6 100644 --- a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp +++ b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp @@ -16,12 +16,6 @@ #include "llvm/Function.h" using namespace llvm; -// ASM variant to use. -enum { - PPC_OLD_MNEMONICS = 0, - PPC_NEW_MNEMONICS = 1 -}; - PPCTargetAsmInfo::PPCTargetAsmInfo(const PPCTargetMachine &TM) { bool isPPC64 = TM.getSubtargetImpl()->isPPC64(); @@ -32,7 +26,7 @@ PPCTargetAsmInfo::PPCTargetAsmInfo(const PPCTargetMachine &TM) { LCOMMDirective = "\t.lcomm\t"; InlineAsmStart = "# InlineAsm Start"; InlineAsmEnd = "# InlineAsm End"; - AssemblerDialect = PPC_OLD_MNEMONICS; + AssemblerDialect = TM.getSubtargetImpl()->getAsmFlavor(); NeedsSet = true; AddressSize = isPPC64 ? 8 : 4; @@ -63,7 +57,6 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) UsedDirective = "\t.no_dead_strip\t"; WeakRefDirective = "\t.weak_reference\t"; HiddenDirective = "\t.private_extern\t"; - AssemblerDialect = PPC_NEW_MNEMONICS; } LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM) diff --git a/lib/Target/X86/X86Subtarget.h b/lib/Target/X86/X86Subtarget.h index 43e85083920..e39c77b23aa 100644 --- a/lib/Target/X86/X86Subtarget.h +++ b/lib/Target/X86/X86Subtarget.h @@ -111,6 +111,10 @@ public: bool has3DNow() const { return X863DNowLevel >= ThreeDNow; } bool has3DNowA() const { return X863DNowLevel >= ThreeDNowA; } + unsigned getAsmFlavor() const { + return AsmFlavor != Unset ? unsigned(AsmFlavor) : 0; + } + bool isFlavorAtt() const { return AsmFlavor == ATT; } bool isFlavorIntel() const { return AsmFlavor == Intel; } diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp index 97e59a51c26..d80996fe161 100644 --- a/lib/Target/X86/X86TargetAsmInfo.cpp +++ b/lib/Target/X86/X86TargetAsmInfo.cpp @@ -21,12 +21,6 @@ #include "llvm/ADT/StringExtras.h" using namespace llvm; -// ASM variant to use. -enum { - X86_ATT = 0, - X86_INTEL = 1 -}; - static const char* x86_asm_table[] = {"{si}", "S", "{di}", "D", "{ax}", "a", @@ -44,7 +38,6 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) { // FIXME - Should be simplified. AsmTransCBE = x86_asm_table; - AssemblerDialect = X86_ATT; switch (Subtarget->TargetType) { case X86Subtarget::isDarwin: @@ -169,9 +162,9 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) { TextSectionStartSuffix = "\tsegment 'CODE'"; DataSectionStartSuffix = "\tsegment 'DATA'"; SectionEndDirectiveSuffix = "\tends\n"; - - AssemblerDialect = X86_INTEL; } + + AssemblerDialect = Subtarget->getAsmFlavor(); } bool X86TargetAsmInfo::LowerToBSwap(CallInst *CI) const { -- 2.34.1