blob: fc9be03d2f300ea39a4eafdaa82569df16c5b6cc [file] [log] [blame]
Andrew Lenharth3c127722005-01-24 18:45:41 +00001//===-- AlphaTargetMachine.cpp - Define TargetMachine for Alpha -----------===//
Misha Brukman89b8c8d2005-04-21 23:13:11 +00002//
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-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 Brukman89b8c8d2005-04-21 23:13:11 +00007//
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +00008//===----------------------------------------------------------------------===//
Misha Brukman89b8c8d2005-04-21 23:13:11 +00009//
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000010//
11//===----------------------------------------------------------------------===//
12
13#include "Alpha.h"
Andrew Lenharth55d04512005-07-22 20:52:16 +000014#include "AlphaJITInfo.h"
Chris Lattner7b26fce2009-08-22 20:48:53 +000015#include "AlphaMCAsmInfo.h"
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000016#include "AlphaTargetMachine.h"
Chris Lattner12e97302006-09-04 04:14:57 +000017#include "llvm/PassManager.h"
David Greenea31f96c2009-07-14 20:18:05 +000018#include "llvm/Support/FormattedStream.h"
Daniel Dunbar5680b4f2009-07-25 06:49:55 +000019#include "llvm/Target/TargetRegistry.h"
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000020using namespace llvm;
21
Daniel Dunbar5680b4f2009-07-25 06:49:55 +000022extern "C" void LLVMInitializeAlphaTarget() {
23 // Register the target.
24 RegisterTargetMachine<AlphaTargetMachine> X(TheAlphaTarget);
Chris Lattner7b26fce2009-08-22 20:48:53 +000025 RegisterAsmInfo<AlphaMCAsmInfo> Y(TheAlphaTarget);
Jim Laskeyae92ce82006-09-07 23:39:26 +000026}
27
Daniel Dunbarc3719c32009-08-02 23:37:13 +000028AlphaTargetMachine::AlphaTargetMachine(const Target &T, const std::string &TT,
Daniel Dunbare8338102009-07-15 20:24:03 +000029 const std::string &FS)
Chris Lattner2c309702009-08-11 20:42:37 +000030 : LLVMTargetMachine(T, TT),
Chris Lattner87143482009-11-07 19:07:32 +000031 DataLayout("e-f128:128:128-n64"),
Andrew Lenharth3a18a392005-08-03 22:33:21 +000032 FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
Andrew Lenhartha7a83b92005-09-29 22:54:56 +000033 JITInfo(*this),
Daniel Dunbarc3719c32009-08-02 23:37:13 +000034 Subtarget(TT, FS),
Dan Gohmanbb919df2010-05-11 17:31:57 +000035 TLInfo(*this),
36 TSInfo(*this) {
Andrew Lenharth5e2bacd2006-09-24 19:46:56 +000037 setRelocationModel(Reloc::PIC_);
Andrew Lenhartha7a83b92005-09-29 22:54:56 +000038}
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000039
Misha Brukman89b8c8d2005-04-21 23:13:11 +000040
Chris Lattner12e97302006-09-04 04:14:57 +000041//===----------------------------------------------------------------------===//
42// Pass Pipeline Configuration
43//===----------------------------------------------------------------------===//
Andrew Lenharthed4b6482005-03-02 17:21:38 +000044
Bill Wendling084669a2009-04-29 00:15:41 +000045bool AlphaTargetMachine::addInstSelector(PassManagerBase &PM,
Bill Wendling026e5d72009-04-29 23:29:43 +000046 CodeGenOpt::Level OptLevel) {
Andrew Lenharthc0bf3772006-01-23 21:56:07 +000047 PM.add(createAlphaISelDag(*this));
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000048 return false;
49}
Bill Wendling084669a2009-04-29 00:15:41 +000050bool AlphaTargetMachine::addPreEmitPass(PassManagerBase &PM,
Bill Wendling026e5d72009-04-29 23:29:43 +000051 CodeGenOpt::Level OptLevel) {
Andrew Lenharth55d04512005-07-22 20:52:16 +000052 // Must run branch selection immediately preceding the asm printer
Andrew Lenharth692e4152006-10-31 16:49:55 +000053 PM.add(createAlphaBranchSelectionPass());
Chris Lattnerd098c5a2009-07-15 21:40:24 +000054 PM.add(createAlphaLLRPPass(*this));
Chris Lattner12e97302006-09-04 04:14:57 +000055 return false;
Andrew Lenharth55d04512005-07-22 20:52:16 +000056}
Bill Wendling026e5d72009-04-29 23:29:43 +000057bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM,
58 CodeGenOpt::Level OptLevel,
Daniel Dunbarc9013922009-07-15 22:33:19 +000059 JITCodeEmitter &JCE) {
Bruno Cardoso Lopesa194c3a2009-05-30 20:51:52 +000060 PM.add(createAlphaJITCodeEmitterPass(*this, JCE));
Bruno Cardoso Lopesa194c3a2009-05-30 20:51:52 +000061 return false;
62}