blob: fc9be03d2f300ea39a4eafdaa82569df16c5b6cc [file] [log] [blame]
Andrew Lenharth886470e2005-01-24 18:45:41 +00001//===-- AlphaTargetMachine.cpp - Define TargetMachine for Alpha -----------===//
Misha Brukman4633f1c2005-04-21 23:13:11 +00002//
Andrew Lenharth304d0f32005-01-22 23:41:55 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Misha Brukman4633f1c2005-04-21 23:13:11 +00007//
Andrew Lenharth304d0f32005-01-22 23:41:55 +00008//===----------------------------------------------------------------------===//
Misha Brukman4633f1c2005-04-21 23:13:11 +00009//
Andrew Lenharth304d0f32005-01-22 23:41:55 +000010//
11//===----------------------------------------------------------------------===//
12
13#include "Alpha.h"
Andrew Lenharth0934ae02005-07-22 20:52:16 +000014#include "AlphaJITInfo.h"
Chris Lattneraf76e592009-08-22 20:48:53 +000015#include "AlphaMCAsmInfo.h"
Andrew Lenharth304d0f32005-01-22 23:41:55 +000016#include "AlphaTargetMachine.h"
Chris Lattner1911fd42006-09-04 04:14:57 +000017#include "llvm/PassManager.h"
David Greene71847812009-07-14 20:18:05 +000018#include "llvm/Support/FormattedStream.h"
Daniel Dunbar0c795d62009-07-25 06:49:55 +000019#include "llvm/Target/TargetRegistry.h"
Andrew Lenharth304d0f32005-01-22 23:41:55 +000020using namespace llvm;
21
Daniel Dunbar0c795d62009-07-25 06:49:55 +000022extern "C" void LLVMInitializeAlphaTarget() {
23 // Register the target.
24 RegisterTargetMachine<AlphaTargetMachine> X(TheAlphaTarget);
Chris Lattneraf76e592009-08-22 20:48:53 +000025 RegisterAsmInfo<AlphaMCAsmInfo> Y(TheAlphaTarget);
Jim Laskeyfde1b3b2006-09-07 23:39:26 +000026}
27
Daniel Dunbare28039c2009-08-02 23:37:13 +000028AlphaTargetMachine::AlphaTargetMachine(const Target &T, const std::string &TT,
Daniel Dunbar51b198a2009-07-15 20:24:03 +000029 const std::string &FS)
Chris Lattner0a31d2f2009-08-11 20:42:37 +000030 : LLVMTargetMachine(T, TT),
Chris Lattner59a91782009-11-07 19:07:32 +000031 DataLayout("e-f128:128:128-n64"),
Andrew Lenharthdc7c0b82005-08-03 22:33:21 +000032 FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
Andrew Lenharth120ab482005-09-29 22:54:56 +000033 JITInfo(*this),
Daniel Dunbare28039c2009-08-02 23:37:13 +000034 Subtarget(TT, FS),
Dan Gohmanff7a5622010-05-11 17:31:57 +000035 TLInfo(*this),
36 TSInfo(*this) {
Andrew Lenharth0607a2f2006-09-24 19:46:56 +000037 setRelocationModel(Reloc::PIC_);
Andrew Lenharth120ab482005-09-29 22:54:56 +000038}
Andrew Lenharth304d0f32005-01-22 23:41:55 +000039
Misha Brukman4633f1c2005-04-21 23:13:11 +000040
Chris Lattner1911fd42006-09-04 04:14:57 +000041//===----------------------------------------------------------------------===//
42// Pass Pipeline Configuration
43//===----------------------------------------------------------------------===//
Andrew Lenharthe4f161c2005-03-02 17:21:38 +000044
Bill Wendlingbe8cc2a2009-04-29 00:15:41 +000045bool AlphaTargetMachine::addInstSelector(PassManagerBase &PM,
Bill Wendling98a366d2009-04-29 23:29:43 +000046 CodeGenOpt::Level OptLevel) {
Andrew Lenharthfabd5ba2006-01-23 21:56:07 +000047 PM.add(createAlphaISelDag(*this));
Andrew Lenharth304d0f32005-01-22 23:41:55 +000048 return false;
49}
Bill Wendlingbe8cc2a2009-04-29 00:15:41 +000050bool AlphaTargetMachine::addPreEmitPass(PassManagerBase &PM,
Bill Wendling98a366d2009-04-29 23:29:43 +000051 CodeGenOpt::Level OptLevel) {
Andrew Lenharth0934ae02005-07-22 20:52:16 +000052 // Must run branch selection immediately preceding the asm printer
Andrew Lenharthf81173f2006-10-31 16:49:55 +000053 PM.add(createAlphaBranchSelectionPass());
Chris Lattner7add5ff2009-07-15 21:40:24 +000054 PM.add(createAlphaLLRPPass(*this));
Chris Lattner1911fd42006-09-04 04:14:57 +000055 return false;
Andrew Lenharth0934ae02005-07-22 20:52:16 +000056}
Bill Wendling98a366d2009-04-29 23:29:43 +000057bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM,
58 CodeGenOpt::Level OptLevel,
Daniel Dunbarcfe9a602009-07-15 22:33:19 +000059 JITCodeEmitter &JCE) {
Bruno Cardoso Lopesa3f99f92009-05-30 20:51:52 +000060 PM.add(createAlphaJITCodeEmitterPass(*this, JCE));
Bruno Cardoso Lopesa3f99f92009-05-30 20:51:52 +000061 return false;
62}