Change TargetAsmInfo to be constructed via TargetRegistry from a Target+Triple
pair instead of from a virtual method on TargetMachine. This cuts the final
ties of TargetAsmInfo to TargetMachine, meaning that MC can now use
TargetAsmInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78802 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp
index 859ced7..d978eb1 100644
--- a/lib/Target/X86/X86TargetAsmInfo.cpp
+++ b/lib/Target/X86/X86TargetAsmInfo.cpp
@@ -13,6 +13,7 @@
#include "X86TargetAsmInfo.h"
#include "X86TargetMachine.h"
+#include "llvm/ADT/Triple.h"
#include "llvm/Support/CommandLine.h"
using namespace llvm;
@@ -42,12 +43,11 @@
"{cc}", "cc",
0,0};
-X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM) {
+X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const Triple &Triple) {
AsmTransCBE = x86_asm_table;
AssemblerDialect = AsmWriterFlavor;
- const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>();
- bool is64Bit = Subtarget->is64Bit();
+ bool is64Bit = Triple.getArch() == Triple::x86_64;
TextAlignFillValue = 0x90;
@@ -55,7 +55,7 @@
Data64bitsDirective = 0; // we can't emit a 64-bit unit
// Leopard and above support aligned common symbols.
- COMMDirectiveTakesAlignment = (Subtarget->getDarwinVers() >= 9);
+ COMMDirectiveTakesAlignment = Triple.getDarwinMajorNumber() >= 9;
if (is64Bit) {
PersonalityPrefix = "";
@@ -76,7 +76,7 @@
AbsoluteEHSectionOffsets = false;
}
-X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM) {
+X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const Triple &Triple) {
AsmTransCBE = x86_asm_table;
AssemblerDialect = AsmWriterFlavor;
@@ -97,17 +97,17 @@
AbsoluteEHSectionOffsets = false;
// On Linux we must declare when we can use a non-executable stack.
- if (TM.getSubtarget<X86Subtarget>().isLinux())
+ if (Triple.getOS() == Triple::Linux)
NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\",@progbits";
}
-X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const X86TargetMachine &TM) {
+X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const Triple &Triple) {
AsmTransCBE = x86_asm_table;
AssemblerDialect = AsmWriterFlavor;
}
-X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM) {
+X86WinTargetAsmInfo::X86WinTargetAsmInfo(const Triple &Triple) {
AsmTransCBE = x86_asm_table;
AssemblerDialect = AsmWriterFlavor;