blob: 51b31a96098aa9c61f019cf94a5d11f386039d94 [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//===----------------------------------------------------------------------===//
9//
10//
11//===----------------------------------------------------------------------===//
12
13#include "SystemZTargetAsmInfo.h"
14#include "SystemZTargetMachine.h"
15#include "SystemZ.h"
Anton Korobeynikov4403b932009-07-16 13:27:25 +000016#include "llvm/PassManager.h"
Daniel Dunbar0c795d62009-07-25 06:49:55 +000017#include "llvm/Target/TargetRegistry.h"
Anton Korobeynikov4403b932009-07-16 13:27:25 +000018using namespace llvm;
19
Anton Korobeynikov7df84622009-07-16 14:36:52 +000020extern "C" void LLVMInitializeSystemZTarget() {
Daniel Dunbar0c795d62009-07-25 06:49:55 +000021 // Register the target.
22 RegisterTargetMachine<SystemZTargetMachine> X(TheSystemZTarget);
Anton Korobeynikov7df84622009-07-16 14:36:52 +000023}
Anton Korobeynikov4403b932009-07-16 13:27:25 +000024
25const TargetAsmInfo *SystemZTargetMachine::createTargetAsmInfo() const {
Chris Lattnere6483e32009-08-02 04:32:07 +000026 return new SystemZTargetAsmInfo();
Anton Korobeynikov4403b932009-07-16 13:27:25 +000027}
28
29/// SystemZTargetMachine ctor - Create an ILP64 architecture model
30///
Anton Korobeynikov7df84622009-07-16 14:36:52 +000031SystemZTargetMachine::SystemZTargetMachine(const Target &T,
Daniel Dunbare28039c2009-08-02 23:37:13 +000032 const std::string &TT,
Anton Korobeynikov7df84622009-07-16 14:36:52 +000033 const std::string &FS)
34 : LLVMTargetMachine(T),
Daniel Dunbare28039c2009-08-02 23:37:13 +000035 Subtarget(TT, FS),
Anton Korobeynikov7df84622009-07-16 14:36:52 +000036 DataLayout("E-p:64:64:64-i8:8:16-i16:16:16-i32:32:32-i64:64:64-f32:32:32"
37 "-f64:64:64-f128:128:128-a0:16:16"),
Anton Korobeynikov4403b932009-07-16 13:27:25 +000038 InstrInfo(*this), TLInfo(*this),
Anton Korobeynikov51f613f2009-07-16 13:49:25 +000039 FrameInfo(TargetFrameInfo::StackGrowsDown, 8, -160) {
Anton Korobeynikov6fe326c2009-07-16 14:16:05 +000040
41 if (getRelocationModel() == Reloc::Default)
42 setRelocationModel(Reloc::Static);
Anton Korobeynikov4403b932009-07-16 13:27:25 +000043}
44
45bool SystemZTargetMachine::addInstSelector(PassManagerBase &PM,
46 CodeGenOpt::Level OptLevel) {
47 // Install an instruction selector.
48 PM.add(createSystemZISelDag(*this, OptLevel));
49 return false;
50}