Fix the ridiculous SubtargetFeatures API where it implicitly expects CPU name to
[oota-llvm.git] / lib / Target / SystemZ / SystemZTargetMachine.cpp
1 //===-- SystemZTargetMachine.cpp - Define TargetMachine for SystemZ -------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "SystemZMCAsmInfo.h"
11 #include "SystemZTargetMachine.h"
12 #include "SystemZ.h"
13 #include "llvm/PassManager.h"
14 #include "llvm/Target/TargetRegistry.h"
15 using namespace llvm;
16
17 extern "C" void LLVMInitializeSystemZTarget() {
18   // Register the target.
19   RegisterTargetMachine<SystemZTargetMachine> X(TheSystemZTarget);
20   RegisterAsmInfo<SystemZMCAsmInfo> Y(TheSystemZTarget);
21 }
22
23 /// SystemZTargetMachine ctor - Create an ILP64 architecture model
24 ///
25 SystemZTargetMachine::SystemZTargetMachine(const Target &T,
26                                            const std::string &TT,
27                                            const std::string &CPU,
28                                            const std::string &FS)
29   : LLVMTargetMachine(T, TT),
30     Subtarget(TT, CPU, FS),
31     DataLayout("E-p:64:64:64-i8:8:16-i16:16:16-i32:32:32-i64:64:64-f32:32:32"
32                "-f64:64:64-f128:128:128-a0:16:16-n32:64"),
33     InstrInfo(*this), TLInfo(*this), TSInfo(*this),
34     FrameLowering(Subtarget) {
35
36   if (getRelocationModel() == Reloc::Default)
37     setRelocationModel(Reloc::Static);
38 }
39
40 bool SystemZTargetMachine::addInstSelector(PassManagerBase &PM,
41                                           CodeGenOpt::Level OptLevel) {
42   // Install an instruction selector.
43   PM.add(createSystemZISelDag(*this, OptLevel));
44   return false;
45 }