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"
21 /// SystemZTargetMachineModule - Note that this is used on hosts that
22 /// cannot link in a library unless there are references into the
23 /// library. In particular, it seems that it is not possible to get
24 /// things to work on Win32 without this. Though it is unused, do not
26 extern "C" int SystemZTargetMachineModule;
27 int SystemZTargetMachineModule = 0;
29 // Register the target.
30 static RegisterTarget<SystemZTargetMachine>
31 X("systemz", "SystemZ [experimental]");
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 Module &M, const std::string &FS)
41 : Subtarget(*this, M, FS),
42 DataLayout("E-p:64:64:64-i1:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128"),
43 InstrInfo(*this), TLInfo(*this),
44 FrameInfo(TargetFrameInfo::StackGrowsDown, 8, -160) {
47 bool SystemZTargetMachine::addInstSelector(PassManagerBase &PM,
48 CodeGenOpt::Level OptLevel) {
49 // Install an instruction selector.
50 PM.add(createSystemZISelDag(*this, OptLevel));
54 bool SystemZTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
55 CodeGenOpt::Level OptLevel,
58 // Output assembly language.
59 PM.add(createSystemZCodePrinterPass(Out, *this, OptLevel, Verbose));
63 unsigned SystemZTargetMachine::getModuleMatchQuality(const Module &M) {
64 std::string TT = M.getTargetTriple();
66 // We strongly match s390x
67 if (TT.size() >= 5 && TT[0] == 's' && TT[1] == '3' && TT[2] == '9' &&
68 TT[3] == '0' && TT[4] == 'x')