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 //===----------------------------------------------------------------------===//
10 #include "SystemZTargetMachine.h"
11 #include "llvm/CodeGen/Passes.h"
12 #include "llvm/Support/TargetRegistry.h"
16 extern "C" void LLVMInitializeSystemZTarget() {
17 // Register the target.
18 RegisterTargetMachine<SystemZTargetMachine> X(TheSystemZTarget);
21 SystemZTargetMachine::SystemZTargetMachine(const Target &T, StringRef TT,
22 StringRef CPU, StringRef FS,
23 const TargetOptions &Options,
27 : LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
28 Subtarget(TT, CPU, FS),
29 // Make sure that global data has at least 16 bits of alignment by default,
30 // so that we can refer to it using LARL. We don't have any special
31 // requirements for stack variables though.
32 DL("E-p:64:64:64-i1:8:16-i8:8:16-i16:16-i32:32-i64:64"
33 "-f32:32-f64:64-f128:64-a0:8:16-n32:64"),
34 InstrInfo(*this), TLInfo(*this), TSInfo(*this),
35 FrameLowering(*this, Subtarget) {
40 /// SystemZ Code Generator Pass Configuration Options.
41 class SystemZPassConfig : public TargetPassConfig {
43 SystemZPassConfig(SystemZTargetMachine *TM, PassManagerBase &PM)
44 : TargetPassConfig(TM, PM) {}
46 SystemZTargetMachine &getSystemZTargetMachine() const {
47 return getTM<SystemZTargetMachine>();
50 virtual bool addInstSelector();
52 } // end anonymous namespace
54 bool SystemZPassConfig::addInstSelector() {
55 addPass(createSystemZISelDag(getSystemZTargetMachine(), getOptLevel()));
59 TargetPassConfig *SystemZTargetMachine::createPassConfig(PassManagerBase &PM) {
60 return new SystemZPassConfig(this, PM);