blob: fc9be03d2f300ea39a4eafdaa82569df16c5b6cc [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===-- AlphaTargetMachine.cpp - Define TargetMachine for Alpha -----------===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner081ce942007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007//
8//===----------------------------------------------------------------------===//
9//
10//
11//===----------------------------------------------------------------------===//
12
13#include "Alpha.h"
14#include "AlphaJITInfo.h"
Chris Lattner621c44d2009-08-22 20:48:53 +000015#include "AlphaMCAsmInfo.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +000016#include "AlphaTargetMachine.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +000017#include "llvm/PassManager.h"
David Greene302008d2009-07-14 20:18:05 +000018#include "llvm/Support/FormattedStream.h"
Daniel Dunbarc680b012009-07-25 06:49:55 +000019#include "llvm/Target/TargetRegistry.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +000020using namespace llvm;
21
Daniel Dunbarc680b012009-07-25 06:49:55 +000022extern "C" void LLVMInitializeAlphaTarget() {
23 // Register the target.
24 RegisterTargetMachine<AlphaTargetMachine> X(TheAlphaTarget);
Chris Lattner621c44d2009-08-22 20:48:53 +000025 RegisterAsmInfo<AlphaMCAsmInfo> Y(TheAlphaTarget);
Dan Gohmanf17a25c2007-07-18 16:29:46 +000026}
27
Daniel Dunbarf5c2b852009-08-02 23:37:13 +000028AlphaTargetMachine::AlphaTargetMachine(const Target &T, const std::string &TT,
Daniel Dunbarfe5939f2009-07-15 20:24:03 +000029 const std::string &FS)
Chris Lattnerd9236ec2009-08-11 20:42:37 +000030 : LLVMTargetMachine(T, TT),
Chris Lattner1b60b162009-11-07 19:07:32 +000031 DataLayout("e-f128:128:128-n64"),
Dan Gohmanf17a25c2007-07-18 16:29:46 +000032 FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
33 JITInfo(*this),
Daniel Dunbarf5c2b852009-08-02 23:37:13 +000034 Subtarget(TT, FS),
Dan Gohmancfbb3232010-05-11 17:31:57 +000035 TLInfo(*this),
36 TSInfo(*this) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000037 setRelocationModel(Reloc::PIC_);
38}
39
40
41//===----------------------------------------------------------------------===//
42// Pass Pipeline Configuration
43//===----------------------------------------------------------------------===//
44
Bill Wendling58ed5d22009-04-29 00:15:41 +000045bool AlphaTargetMachine::addInstSelector(PassManagerBase &PM,
Bill Wendling5ed22ac2009-04-29 23:29:43 +000046 CodeGenOpt::Level OptLevel) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000047 PM.add(createAlphaISelDag(*this));
48 return false;
49}
Bill Wendling58ed5d22009-04-29 00:15:41 +000050bool AlphaTargetMachine::addPreEmitPass(PassManagerBase &PM,
Bill Wendling5ed22ac2009-04-29 23:29:43 +000051 CodeGenOpt::Level OptLevel) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000052 // Must run branch selection immediately preceding the asm printer
53 PM.add(createAlphaBranchSelectionPass());
Chris Lattnerb7720eb2009-07-15 21:40:24 +000054 PM.add(createAlphaLLRPPass(*this));
Dan Gohmanf17a25c2007-07-18 16:29:46 +000055 return false;
56}
Bill Wendling5ed22ac2009-04-29 23:29:43 +000057bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM,
58 CodeGenOpt::Level OptLevel,
Daniel Dunbar3e0ad8b2009-07-15 22:33:19 +000059 JITCodeEmitter &JCE) {
Bruno Cardoso Lopes1ea31ff2009-05-30 20:51:52 +000060 PM.add(createAlphaJITCodeEmitterPass(*this, JCE));
Bruno Cardoso Lopes1ea31ff2009-05-30 20:51:52 +000061 return false;
62}