Instead of yet another enum indicating the "assembly language flavor",

just use the one that's in the subtarget.

llvm-svn: 33255
This commit is contained in:
Bill Wendling 2007-01-16 09:29:17 +00:00
parent 5488ade154
commit c7b2ab9bdf
5 changed files with 22 additions and 18 deletions

View File

@ -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;
}
}

View File

@ -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

View File

@ -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)

View File

@ -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; }

View File

@ -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 {