blob: 48ea5f5ebd706ca76eed79cf21b20c8b5e2fbb49 [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
10#include "SystemZTargetAsmInfo.h"
11#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 Lattnera7ac47c2009-08-12 07:22:17 +000020 RegisterAsmInfo<SystemZTargetAsmInfo> 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"
31 "-f64:64:64-f128:128:128-a0:16:16"),
Anton Korobeynikov4403b932009-07-16 13:27:25 +000032 InstrInfo(*this), TLInfo(*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}