blob: b872fc63f232e516f0708a84d325e194457cdc18 [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"
Chris Lattneraf76e592009-08-22 20:48:53 +000014#include "AlphaMCAsmInfo.h"
Andrew Lenharth304d0f32005-01-22 23:41:55 +000015#include "AlphaTargetMachine.h"
Chris Lattner1911fd42006-09-04 04:14:57 +000016#include "llvm/PassManager.h"
David Greene71847812009-07-14 20:18:05 +000017#include "llvm/Support/FormattedStream.h"
Daniel Dunbar0c795d62009-07-25 06:49:55 +000018#include "llvm/Target/TargetRegistry.h"
Andrew Lenharth304d0f32005-01-22 23:41:55 +000019using namespace llvm;
20
Daniel Dunbar0c795d62009-07-25 06:49:55 +000021extern "C" void LLVMInitializeAlphaTarget() {
22 // Register the target.
23 RegisterTargetMachine<AlphaTargetMachine> X(TheAlphaTarget);
Chris Lattneraf76e592009-08-22 20:48:53 +000024 RegisterAsmInfo<AlphaMCAsmInfo> Y(TheAlphaTarget);
Jim Laskeyfde1b3b2006-09-07 23:39:26 +000025}
26
Daniel Dunbare28039c2009-08-02 23:37:13 +000027AlphaTargetMachine::AlphaTargetMachine(const Target &T, const std::string &TT,
Evan Cheng276365d2011-06-30 01:53:36 +000028 const std::string &CPU,
Daniel Dunbar51b198a2009-07-15 20:24:03 +000029 const std::string &FS)
Evan Chengebdeeab2011-07-08 01:53:10 +000030 : LLVMTargetMachine(T, TT, CPU, FS),
Chris Lattner59a91782009-11-07 19:07:32 +000031 DataLayout("e-f128:128:128-n64"),
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000032 FrameLowering(Subtarget),
Evan Cheng276365d2011-06-30 01:53:36 +000033 Subtarget(TT, CPU, FS),
Dan Gohmanff7a5622010-05-11 17:31:57 +000034 TLInfo(*this),
35 TSInfo(*this) {
Andrew Lenharth0607a2f2006-09-24 19:46:56 +000036 setRelocationModel(Reloc::PIC_);
Andrew Lenharth120ab482005-09-29 22:54:56 +000037}
Andrew Lenharth304d0f32005-01-22 23:41:55 +000038
Misha Brukman4633f1c2005-04-21 23:13:11 +000039
Chris Lattner1911fd42006-09-04 04:14:57 +000040//===----------------------------------------------------------------------===//
41// Pass Pipeline Configuration
42//===----------------------------------------------------------------------===//
Andrew Lenharthe4f161c2005-03-02 17:21:38 +000043
Bill Wendlingbe8cc2a2009-04-29 00:15:41 +000044bool AlphaTargetMachine::addInstSelector(PassManagerBase &PM,
Bill Wendling98a366d2009-04-29 23:29:43 +000045 CodeGenOpt::Level OptLevel) {
Andrew Lenharthfabd5ba2006-01-23 21:56:07 +000046 PM.add(createAlphaISelDag(*this));
Andrew Lenharth304d0f32005-01-22 23:41:55 +000047 return false;
48}
Bill Wendlingbe8cc2a2009-04-29 00:15:41 +000049bool AlphaTargetMachine::addPreEmitPass(PassManagerBase &PM,
Bill Wendling98a366d2009-04-29 23:29:43 +000050 CodeGenOpt::Level OptLevel) {
Andrew Lenharth0934ae02005-07-22 20:52:16 +000051 // Must run branch selection immediately preceding the asm printer
Andrew Lenharthf81173f2006-10-31 16:49:55 +000052 PM.add(createAlphaBranchSelectionPass());
Chris Lattner7add5ff2009-07-15 21:40:24 +000053 PM.add(createAlphaLLRPPass(*this));
Chris Lattner1911fd42006-09-04 04:14:57 +000054 return false;
Andrew Lenharth0934ae02005-07-22 20:52:16 +000055}