mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-02 17:55:18 +00:00
change the -x86-asm-syntax=intel/att flag to be in X86TAI
instead of X86 Subtarget. This elimianates dependencies on X86Subtarget from X86TAI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78746 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b89030ab65
commit
ce914b8f94
@ -17,7 +17,7 @@
|
|||||||
#include "X86.h"
|
#include "X86.h"
|
||||||
#include "X86ATTAsmPrinter.h"
|
#include "X86ATTAsmPrinter.h"
|
||||||
#include "X86IntelAsmPrinter.h"
|
#include "X86IntelAsmPrinter.h"
|
||||||
#include "X86Subtarget.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
#include "llvm/Target/TargetRegistry.h"
|
#include "llvm/Target/TargetRegistry.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -28,9 +28,7 @@ using namespace llvm;
|
|||||||
static FunctionPass *createX86CodePrinterPass(formatted_raw_ostream &o,
|
static FunctionPass *createX86CodePrinterPass(formatted_raw_ostream &o,
|
||||||
TargetMachine &tm,
|
TargetMachine &tm,
|
||||||
bool verbose) {
|
bool verbose) {
|
||||||
const X86Subtarget *Subtarget = &tm.getSubtarget<X86Subtarget>();
|
if (tm.getTargetAsmInfo()->getAssemblerDialect() == 1)
|
||||||
|
|
||||||
if (Subtarget->isFlavorIntel())
|
|
||||||
return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
||||||
return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include "X86InstrInfo.h"
|
#include "X86InstrInfo.h"
|
||||||
#include "X86GenSubtarget.inc"
|
#include "X86GenSubtarget.inc"
|
||||||
#include "llvm/GlobalValue.h"
|
#include "llvm/GlobalValue.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
@ -27,14 +26,6 @@ using namespace llvm;
|
|||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static cl::opt<X86Subtarget::AsmWriterFlavorTy>
|
|
||||||
AsmWriterFlavor("x86-asm-syntax", cl::init(X86Subtarget::Unset),
|
|
||||||
cl::desc("Choose style of code to emit from X86 backend:"),
|
|
||||||
cl::values(
|
|
||||||
clEnumValN(X86Subtarget::ATT, "att", "Emit AT&T-style assembly"),
|
|
||||||
clEnumValN(X86Subtarget::Intel, "intel", "Emit Intel-style assembly"),
|
|
||||||
clEnumValEnd));
|
|
||||||
|
|
||||||
/// ClassifyGlobalReference - Classify a global variable reference for the
|
/// ClassifyGlobalReference - Classify a global variable reference for the
|
||||||
/// current subtarget according to how we should reference it in a non-pcrel
|
/// current subtarget according to how we should reference it in a non-pcrel
|
||||||
/// context.
|
/// context.
|
||||||
@ -386,8 +377,7 @@ static const char *GetCurrentX86CPU() {
|
|||||||
|
|
||||||
X86Subtarget::X86Subtarget(const std::string &TT, const std::string &FS,
|
X86Subtarget::X86Subtarget(const std::string &TT, const std::string &FS,
|
||||||
bool is64Bit)
|
bool is64Bit)
|
||||||
: AsmFlavor(AsmWriterFlavor)
|
: PICStyle(PICStyles::None)
|
||||||
, PICStyle(PICStyles::None)
|
|
||||||
, X86SSELevel(NoMMXSSE)
|
, X86SSELevel(NoMMXSSE)
|
||||||
, X863DNowLevel(NoThreeDNow)
|
, X863DNowLevel(NoThreeDNow)
|
||||||
, HasX86_64(false)
|
, HasX86_64(false)
|
||||||
@ -464,13 +454,6 @@ X86Subtarget::X86Subtarget(const std::string &TT, const std::string &FS,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the asm syntax hasn't been overridden on the command line, use whatever
|
|
||||||
// the target wants.
|
|
||||||
if (AsmFlavor == X86Subtarget::Unset) {
|
|
||||||
AsmFlavor = (TargetType == isWindows)
|
|
||||||
? X86Subtarget::Intel : X86Subtarget::ATT;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stack alignment is 16 bytes on Darwin (both 32 and 64 bit) and for all 64
|
// Stack alignment is 16 bytes on Darwin (both 32 and 64 bit) and for all 64
|
||||||
// bit targets.
|
// bit targets.
|
||||||
if (TargetType == isDarwin || Is64Bit)
|
if (TargetType == isDarwin || Is64Bit)
|
||||||
|
@ -34,12 +34,6 @@ enum Style {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class X86Subtarget : public TargetSubtarget {
|
class X86Subtarget : public TargetSubtarget {
|
||||||
public:
|
|
||||||
enum AsmWriterFlavorTy {
|
|
||||||
// Note: This numbering has to match the GCC assembler dialects for inline
|
|
||||||
// asm alternatives to work right.
|
|
||||||
ATT = 0, Intel = 1, Unset
|
|
||||||
};
|
|
||||||
protected:
|
protected:
|
||||||
enum X86SSEEnum {
|
enum X86SSEEnum {
|
||||||
NoMMXSSE, MMX, SSE1, SSE2, SSE3, SSSE3, SSE41, SSE42
|
NoMMXSSE, MMX, SSE1, SSE2, SSE3, SSSE3, SSE41, SSE42
|
||||||
@ -49,10 +43,6 @@ protected:
|
|||||||
NoThreeDNow, ThreeDNow, ThreeDNowA
|
NoThreeDNow, ThreeDNow, ThreeDNowA
|
||||||
};
|
};
|
||||||
|
|
||||||
/// AsmFlavor - Which x86 asm dialect to use.
|
|
||||||
///
|
|
||||||
AsmWriterFlavorTy AsmFlavor;
|
|
||||||
|
|
||||||
/// PICStyle - Which PIC style to use
|
/// PICStyle - Which PIC style to use
|
||||||
///
|
///
|
||||||
PICStyles::Style PICStyle;
|
PICStyles::Style PICStyle;
|
||||||
@ -152,13 +142,6 @@ public:
|
|||||||
bool hasFMA4() const { return HasFMA4; }
|
bool hasFMA4() const { return HasFMA4; }
|
||||||
bool isBTMemSlow() const { return IsBTMemSlow; }
|
bool isBTMemSlow() const { return IsBTMemSlow; }
|
||||||
|
|
||||||
unsigned getAsmFlavor() const {
|
|
||||||
return AsmFlavor != Unset ? unsigned(AsmFlavor) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isFlavorAtt() const { return AsmFlavor == ATT; }
|
|
||||||
bool isFlavorIntel() const { return AsmFlavor == Intel; }
|
|
||||||
|
|
||||||
bool isTargetDarwin() const { return TargetType == isDarwin; }
|
bool isTargetDarwin() const { return TargetType == isDarwin; }
|
||||||
bool isTargetELF() const { return TargetType == isELF; }
|
bool isTargetELF() const { return TargetType == isELF; }
|
||||||
bool isTargetWindows() const { return TargetType == isWindows; }
|
bool isTargetWindows() const { return TargetType == isWindows; }
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "X86TargetAsmInfo.h"
|
#include "X86TargetAsmInfo.h"
|
||||||
#include "X86TargetMachine.h"
|
#include "X86TargetMachine.h"
|
||||||
#include "X86Subtarget.h"
|
#include "X86Subtarget.h"
|
||||||
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/InlineAsm.h"
|
#include "llvm/InlineAsm.h"
|
||||||
#include "llvm/Instructions.h"
|
#include "llvm/Instructions.h"
|
||||||
@ -22,10 +23,25 @@
|
|||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include "llvm/Support/Dwarf.h"
|
#include "llvm/Support/Dwarf.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace llvm::dwarf;
|
using namespace llvm::dwarf;
|
||||||
|
|
||||||
|
|
||||||
|
enum AsmWriterFlavorTy {
|
||||||
|
// Note: This numbering has to match the GCC assembler dialects for inline
|
||||||
|
// asm alternatives to work right.
|
||||||
|
ATT = 0, Intel = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static cl::opt<AsmWriterFlavorTy>
|
||||||
|
AsmWriterFlavor("x86-asm-syntax", cl::init(ATT),
|
||||||
|
cl::desc("Choose style of code to emit from X86 backend:"),
|
||||||
|
cl::values(clEnumValN(ATT, "att", "Emit AT&T-style assembly"),
|
||||||
|
clEnumValN(Intel, "intel", "Emit Intel-style assembly"),
|
||||||
|
clEnumValEnd));
|
||||||
|
|
||||||
|
|
||||||
static const char *const x86_asm_table[] = {
|
static const char *const x86_asm_table[] = {
|
||||||
"{si}", "S",
|
"{si}", "S",
|
||||||
"{di}", "D",
|
"{di}", "D",
|
||||||
@ -40,7 +56,7 @@ static const char *const x86_asm_table[] = {
|
|||||||
|
|
||||||
X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM) {
|
X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM) {
|
||||||
AsmTransCBE = x86_asm_table;
|
AsmTransCBE = x86_asm_table;
|
||||||
AssemblerDialect = TM.getSubtarget<X86Subtarget>().getAsmFlavor();
|
AssemblerDialect = AsmWriterFlavor;
|
||||||
|
|
||||||
const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>();
|
const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>();
|
||||||
bool is64Bit = Subtarget->is64Bit();
|
bool is64Bit = Subtarget->is64Bit();
|
||||||
@ -74,7 +90,7 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM) {
|
|||||||
|
|
||||||
X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM) {
|
X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM) {
|
||||||
AsmTransCBE = x86_asm_table;
|
AsmTransCBE = x86_asm_table;
|
||||||
AssemblerDialect = TM.getSubtarget<X86Subtarget>().getAsmFlavor();
|
AssemblerDialect = AsmWriterFlavor;
|
||||||
|
|
||||||
PrivateGlobalPrefix = ".L";
|
PrivateGlobalPrefix = ".L";
|
||||||
WeakRefDirective = "\t.weak\t";
|
WeakRefDirective = "\t.weak\t";
|
||||||
@ -99,14 +115,13 @@ X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM) {
|
|||||||
|
|
||||||
X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const X86TargetMachine &TM) {
|
X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const X86TargetMachine &TM) {
|
||||||
AsmTransCBE = x86_asm_table;
|
AsmTransCBE = x86_asm_table;
|
||||||
AssemblerDialect = TM.getSubtarget<X86Subtarget>().getAsmFlavor();
|
AssemblerDialect = AsmWriterFlavor;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM) {
|
X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM) {
|
||||||
AsmTransCBE = x86_asm_table;
|
AsmTransCBE = x86_asm_table;
|
||||||
AssemblerDialect = TM.getSubtarget<X86Subtarget>().getAsmFlavor();
|
AssemblerDialect = AsmWriterFlavor;
|
||||||
|
|
||||||
GlobalPrefix = "_";
|
GlobalPrefix = "_";
|
||||||
CommentString = ";";
|
CommentString = ";";
|
||||||
|
Loading…
Reference in New Issue
Block a user