llvm.org GIT mirror llvm / c55e193
Have the TLOF creation take a Triple rather than needing a subtarget. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209937 91177308-0d34-0410-b5e6-96231b3b80d8 Eric Christopher 6 years ago
4 changed file(s) with 20 addition(s) and 21 deletion(s). Raw diff Collapse all Expand all
6666 //===----------------------------------------------------------------------===//
6767 // AArch64 Lowering public interface.
6868 //===----------------------------------------------------------------------===//
69 static TargetLoweringObjectFile *createTLOF(TargetMachine &TM) {
70 if (TM.getSubtarget().isTargetDarwin())
69 static TargetLoweringObjectFile *createTLOF(const Triple &TT) {
70 if (TT.isOSBinFormatMachO())
7171 return new AArch64_MachoTargetObjectFile();
7272
7373 return new AArch64_ELFTargetObjectFile();
7474 }
7575
7676 AArch64TargetLowering::AArch64TargetLowering(AArch64TargetMachine &TM)
77 : TargetLowering(TM, createTLOF(TM)) {
77 : TargetLowering(TM, createTLOF(Triple(TM.getTargetTriple()))) {
7878 Subtarget = &TM.getSubtarget();
7979
8080 // AArch64 doesn't have comparisons which set GPRs or setcc instructions, so
154154 addTypeForNEON(VT, MVT::v2f64, MVT::v4i32);
155155 }
156156
157 static TargetLoweringObjectFile *createTLOF(TargetMachine &TM) {
158 if (TM.getSubtarget().isTargetMachO())
157 static TargetLoweringObjectFile *createTLOF(const Triple &TT) {
158 if (TT.isOSBinFormatMachO())
159159 return new TargetLoweringObjectFileMachO();
160 if (TM.getSubtarget().isTargetWindows())
160 if (TT.isOSWindows())
161161 return new TargetLoweringObjectFileCOFF();
162162 return new ARMElfTargetObjectFile();
163163 }
164164
165165 ARMTargetLowering::ARMTargetLowering(TargetMachine &TM)
166 : TargetLowering(TM, createTLOF(TM)) {
166 : TargetLowering(TM, createTLOF(Triple(TM.getTargetTriple()))) {
167167 Subtarget = &TM.getSubtarget();
168168 RegInfo = TM.getRegisterInfo();
169169 Itins = TM.getInstrItineraryData();
1818 #include "PPCTargetObjectFile.h"
1919 #include "llvm/ADT/STLExtras.h"
2020 #include "llvm/ADT/StringSwitch.h"
21 #include "llvm/ADT/Triple.h"
2122 #include "llvm/CodeGen/CallingConvLower.h"
2223 #include "llvm/CodeGen/MachineFrameInfo.h"
2324 #include "llvm/CodeGen/MachineFunction.h"
4950 // FIXME: Remove this once the bug has been fixed!
5051 extern cl::opt ANDIGlueBug;
5152
52 static TargetLoweringObjectFile *createTLOF(const PPCTargetMachine &TM) {
53 if (TM.getSubtargetImpl()->isDarwin())
53 static TargetLoweringObjectFile *createTLOF(const Triple &TT) {
54 if (TT.isOSDarwin())
5455 return new TargetLoweringObjectFileMachO();
5556 else
5657 return new PPC64LinuxTargetObjectFile();
5758 }
5859
5960 PPCTargetLowering::PPCTargetLowering(PPCTargetMachine &TM)
60 : TargetLowering(TM, createTLOF(TM)), PPCSubTarget(*TM.getSubtargetImpl()) {
61 : TargetLowering(TM, createTLOF(Triple(TM.getTargetTriple()))),
62 PPCSubTarget(*TM.getSubtargetImpl()) {
6163 const PPCSubtarget *Subtarget = &TM.getSubtarget();
6264
6365 setPow2DivIsCheap();
177177 return Insert256BitVector(V, V2, NumElems/2, DAG, dl);
178178 }
179179
180 static TargetLoweringObjectFile *createTLOF(X86TargetMachine &TM) {
181 const X86Subtarget *Subtarget = &TM.getSubtarget();
182 bool is64Bit = Subtarget->is64Bit();
183
184 if (Subtarget->isTargetMacho()) {
185 if (is64Bit)
180 static TargetLoweringObjectFile *createTLOF(const Triple &TT) {
181 if (TT.isOSBinFormatMachO()) {
182 if (TT.getArch() == Triple::x86_64)
186183 return new X86_64MachoTargetObjectFile();
187184 return new TargetLoweringObjectFileMachO();
188185 }
189186
190 if (Subtarget->isTargetLinux())
187 if (TT.isOSLinux())
191188 return new X86LinuxTargetObjectFile();
192 if (Subtarget->isTargetELF())
189 if (TT.isOSBinFormatELF())
193190 return new TargetLoweringObjectFileELF();
194 if (Subtarget->isTargetKnownWindowsMSVC())
191 if (TT.isKnownWindowsMSVCEnvironment())
195192 return new X86WindowsTargetObjectFile();
196 if (Subtarget->isTargetCOFF())
193 if (TT.isOSBinFormatCOFF())
197194 return new TargetLoweringObjectFileCOFF();
198195 llvm_unreachable("unknown subtarget type");
199196 }
200197
201198 X86TargetLowering::X86TargetLowering(X86TargetMachine &TM)
202 : TargetLowering(TM, createTLOF(TM)) {
199 : TargetLowering(TM, createTLOF(Triple(TM.getTargetTriple()))) {
203200 Subtarget = &TM.getSubtarget();
204201 X86ScalarSSEf64 = Subtarget->hasSSE2();
205202 X86ScalarSSEf32 = Subtarget->hasSSE1();