blob: 3329ce661c555d814b0533f2f6813f4f1b5f76df [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,
Evan Cheng276365d2011-06-30 01:53:36 +000027 const std::string &CPU,
Anton Korobeynikov7df84622009-07-16 14:36:52 +000028 const std::string &FS)
Chris Lattner0a31d2f2009-08-11 20:42:37 +000029 : LLVMTargetMachine(T, TT),
Evan Cheng276365d2011-06-30 01:53:36 +000030 Subtarget(TT, CPU, FS),
Anton Korobeynikov7df84622009-07-16 14:36:52 +000031 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 +000032 "-f64:64:64-f128:128:128-a0:16:16-n32:64"),
Dan Gohmanff7a5622010-05-11 17:31:57 +000033 InstrInfo(*this), TLInfo(*this), TSInfo(*this),
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000034 FrameLowering(Subtarget) {
Anton Korobeynikov6fe326c2009-07-16 14:16:05 +000035
36 if (getRelocationModel() == Reloc::Default)
37 setRelocationModel(Reloc::Static);
Anton Korobeynikov4403b932009-07-16 13:27:25 +000038}
39
40bool SystemZTargetMachine::addInstSelector(PassManagerBase &PM,
41 CodeGenOpt::Level OptLevel) {
42 // Install an instruction selector.
43 PM.add(createSystemZISelDag(*this, OptLevel));
44 return false;
45}