1 //===-- SystemZTargetMachine.cpp - Define TargetMachine for SystemZ -----------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
13 #include "SystemZTargetAsmInfo.h"
14 #include "SystemZTargetMachine.h"
16 #include "llvm/Module.h"
17 #include "llvm/PassManager.h"
18 #include "llvm/Target/TargetMachineRegistry.h"
22 // Register the target.
23 RegisterTarget<SystemZTargetMachine> X(TheSystemZTarget,
25 "SystemZ [experimental]");
28 // Force static initialization.
29 extern "C" void LLVMInitializeSystemZTarget() {
33 const TargetAsmInfo *SystemZTargetMachine::createTargetAsmInfo() const {
34 // FIXME: Handle Solaris subtarget someday :)
35 return new SystemZTargetAsmInfo(*this);
38 /// SystemZTargetMachine ctor - Create an ILP64 architecture model
40 SystemZTargetMachine::SystemZTargetMachine(const Target &T,
42 const std::string &FS)
43 : LLVMTargetMachine(T),
44 Subtarget(*this, M, FS),
45 DataLayout("E-p:64:64:64-i8:8:16-i16:16:16-i32:32:32-i64:64:64-f32:32:32"
46 "-f64:64:64-f128:128:128-a0:16:16"),
47 InstrInfo(*this), TLInfo(*this),
48 FrameInfo(TargetFrameInfo::StackGrowsDown, 8, -160) {
50 if (getRelocationModel() == Reloc::Default)
51 setRelocationModel(Reloc::Static);
54 bool SystemZTargetMachine::addInstSelector(PassManagerBase &PM,
55 CodeGenOpt::Level OptLevel) {
56 // Install an instruction selector.
57 PM.add(createSystemZISelDag(*this, OptLevel));
61 unsigned SystemZTargetMachine::getModuleMatchQuality(const Module &M) {
62 std::string TT = M.getTargetTriple();
64 // We strongly match s390x
65 if (TT.size() >= 5 && TT[0] == 's' && TT[1] == '3' && TT[2] == '9' &&
66 TT[3] == '0' && TT[4] == 'x')