blob: f45827b2b300d47fae5f8a10240ed6ce71f1e778 [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
Chris Lattneraf76e592009-08-22 20:48:53 +000010#include "SystemZMCAsmInfo.h"
Anton Korobeynikov4403b932009-07-16 13:27:25 +000011#include "SystemZTargetMachine.h"
12#include "SystemZ.h"
Anton Korobeynikov4403b932009-07-16 13:27:25 +000013#include "llvm/PassManager.h"
Daniel Dunbar0c795d62009-07-25 06:49:55 +000014#include "llvm/Target/TargetRegistry.h"
Anton Korobeynikov4403b932009-07-16 13:27:25 +000015using namespace llvm;
16
Anton Korobeynikov7df84622009-07-16 14:36:52 +000017extern "C" void LLVMInitializeSystemZTarget() {
Daniel Dunbar0c795d62009-07-25 06:49:55 +000018 // Register the target.
19 RegisterTargetMachine<SystemZTargetMachine> X(TheSystemZTarget);
Chris Lattneraf76e592009-08-22 20:48:53 +000020 RegisterAsmInfo<SystemZMCAsmInfo> Y(TheSystemZTarget);
Anton Korobeynikov4403b932009-07-16 13:27:25 +000021}
22
23/// SystemZTargetMachine ctor - Create an ILP64 architecture model
24///
Anton Korobeynikov7df84622009-07-16 14:36:52 +000025SystemZTargetMachine::SystemZTargetMachine(const Target &T,
Daniel Dunbare28039c2009-08-02 23:37:13 +000026 const std::string &TT,
Anton Korobeynikov7df84622009-07-16 14:36:52 +000027 const std::string &FS)
Chris Lattner0a31d2f2009-08-11 20:42:37 +000028 : LLVMTargetMachine(T, TT),
Daniel Dunbare28039c2009-08-02 23:37:13 +000029 Subtarget(TT, FS),
Anton Korobeynikov7df84622009-07-16 14:36:52 +000030 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 +000031 "-f64:64:64-f128:128:128-a0:16:16-n32:64"),
Dan Gohmanff7a5622010-05-11 17:31:57 +000032 InstrInfo(*this), TLInfo(*this), TSInfo(*this),
Anton Korobeynikov51f613f2009-07-16 13:49:25 +000033 FrameInfo(TargetFrameInfo::StackGrowsDown, 8, -160) {
Anton Korobeynikov6fe326c2009-07-16 14:16:05 +000034
35 if (getRelocationModel() == Reloc::Default)
36 setRelocationModel(Reloc::Static);
Anton Korobeynikov4403b932009-07-16 13:27:25 +000037}
38
39bool SystemZTargetMachine::addInstSelector(PassManagerBase &PM,
40 CodeGenOpt::Level OptLevel) {
41 // Install an instruction selector.
42 PM.add(createSystemZISelDag(*this, OptLevel));
43 return false;
44}