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 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "SystemZTargetAsmInfo.h"
14 #include "SystemZTargetMachine.h"
15 #include "SystemZ.h"
16 #include "llvm/PassManager.h"
17 #include "llvm/Target/TargetRegistry.h"
18 using namespace llvm;
19 
20 extern "C" void LLVMInitializeSystemZTarget() {
21   // Register the target.
22   RegisterTargetMachine<SystemZTargetMachine> X(TheSystemZTarget);
23 }
24 
25 const TargetAsmInfo *SystemZTargetMachine::createTargetAsmInfo() const {
26   return new SystemZTargetAsmInfo();
27 }
28 
29 /// SystemZTargetMachine ctor - Create an ILP64 architecture model
30 ///
31 SystemZTargetMachine::SystemZTargetMachine(const Target &T,
32                                            const std::string &TT,
33                                            const std::string &FS)
34   : LLVMTargetMachine(T),
35     Subtarget(TT, FS),
36     DataLayout("E-p:64:64:64-i8:8:16-i16:16:16-i32:32:32-i64:64:64-f32:32:32"
37                "-f64:64:64-f128:128:128-a0:16:16"),
38     InstrInfo(*this), TLInfo(*this),
39     FrameInfo(TargetFrameInfo::StackGrowsDown, 8, -160) {
40 
41   if (getRelocationModel() == Reloc::Default)
42     setRelocationModel(Reloc::Static);
43 }
44 
45 bool SystemZTargetMachine::addInstSelector(PassManagerBase &PM,
46                                           CodeGenOpt::Level OptLevel) {
47   // Install an instruction selector.
48   PM.add(createSystemZISelDag(*this, OptLevel));
49   return false;
50 }
51