blob: 48298cc744e72dd5c672bc9d5199bc8010f2e799 [file] [log] [blame]
Daniel Dunbar0c795d62009-07-25 06:49:55 +00001//===-- SystemZTargetMachine.cpp - Define TargetMachine for SystemZ -------===//
Anton Korobeynikov4403b932009-07-16 13:27:25 +00002//
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//===----------------------------------------------------------------------===//
Anton Korobeynikov4403b932009-07-16 13:27:25 +00009
Anton Korobeynikov4403b932009-07-16 13:27:25 +000010#include "SystemZTargetMachine.h"
11#include "SystemZ.h"
Anton Korobeynikov4403b932009-07-16 13:27:25 +000012#include "llvm/PassManager.h"
Daniel Dunbar0c795d62009-07-25 06:49:55 +000013#include "llvm/Target/TargetRegistry.h"
Anton Korobeynikov4403b932009-07-16 13:27:25 +000014using namespace llvm;
15
Anton Korobeynikov7df84622009-07-16 14:36:52 +000016extern "C" void LLVMInitializeSystemZTarget() {
Daniel Dunbar0c795d62009-07-25 06:49:55 +000017 // Register the target.
18 RegisterTargetMachine<SystemZTargetMachine> X(TheSystemZTarget);
Anton Korobeynikov4403b932009-07-16 13:27:25 +000019}
20
21/// SystemZTargetMachine ctor - Create an ILP64 architecture model
22///
Anton Korobeynikov7df84622009-07-16 14:36:52 +000023SystemZTargetMachine::SystemZTargetMachine(const Target &T,
Daniel Dunbare28039c2009-08-02 23:37:13 +000024 const std::string &TT,
Evan Cheng276365d2011-06-30 01:53:36 +000025 const std::string &CPU,
Anton Korobeynikov7df84622009-07-16 14:36:52 +000026 const std::string &FS)
Evan Chengebdeeab2011-07-08 01:53:10 +000027 : LLVMTargetMachine(T, TT, CPU, FS),
Evan Cheng276365d2011-06-30 01:53:36 +000028 Subtarget(TT, CPU, FS),
Anton Korobeynikov7df84622009-07-16 14:36:52 +000029 DataLayout("E-p:64:64:64-i8:8:16-i16:16:16-i32:32:32-i64:64:64-f32:32:32"
Chris Lattner59a91782009-11-07 19:07:32 +000030 "-f64:64:64-f128:128:128-a0:16:16-n32:64"),
Dan Gohmanff7a5622010-05-11 17:31:57 +000031 InstrInfo(*this), TLInfo(*this), TSInfo(*this),
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000032 FrameLowering(Subtarget) {
Anton Korobeynikov6fe326c2009-07-16 14:16:05 +000033
34 if (getRelocationModel() == Reloc::Default)
35 setRelocationModel(Reloc::Static);
Anton Korobeynikov4403b932009-07-16 13:27:25 +000036}
37
38bool SystemZTargetMachine::addInstSelector(PassManagerBase &PM,
39 CodeGenOpt::Level OptLevel) {
40 // Install an instruction selector.
41 PM.add(createSystemZISelDag(*this, OptLevel));
42 return false;
43}