1 //===-- AlphaTargetMachine.cpp - Define TargetMachine for Alpha -----------===//
2 //
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 //===----------------------------------------------------------------------===//
9 //
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "Alpha.h"
14 #include "AlphaTargetMachine.h"
15 #include "llvm/PassManager.h"
16 #include "llvm/Support/FormattedStream.h"
17 #include "llvm/Support/TargetRegistry.h"
18 using namespace llvm;
19
LLVMInitializeAlphaTarget()20 extern "C" void LLVMInitializeAlphaTarget() {
21 // Register the target.
22 RegisterTargetMachine<AlphaTargetMachine> X(TheAlphaTarget);
23 }
24
AlphaTargetMachine(const Target & T,StringRef TT,StringRef CPU,StringRef FS,Reloc::Model RM,CodeModel::Model CM)25 AlphaTargetMachine::AlphaTargetMachine(const Target &T, StringRef TT,
26 StringRef CPU, StringRef FS,
27 Reloc::Model RM, CodeModel::Model CM)
28 : LLVMTargetMachine(T, TT, CPU, FS, RM, CM),
29 DataLayout("e-f128:128:128-n64"),
30 FrameLowering(Subtarget),
31 Subtarget(TT, CPU, FS),
32 TLInfo(*this),
33 TSInfo(*this) {
34 }
35
36 //===----------------------------------------------------------------------===//
37 // Pass Pipeline Configuration
38 //===----------------------------------------------------------------------===//
39
addInstSelector(PassManagerBase & PM,CodeGenOpt::Level OptLevel)40 bool AlphaTargetMachine::addInstSelector(PassManagerBase &PM,
41 CodeGenOpt::Level OptLevel) {
42 PM.add(createAlphaISelDag(*this));
43 return false;
44 }
addPreEmitPass(PassManagerBase & PM,CodeGenOpt::Level OptLevel)45 bool AlphaTargetMachine::addPreEmitPass(PassManagerBase &PM,
46 CodeGenOpt::Level OptLevel) {
47 // Must run branch selection immediately preceding the asm printer
48 PM.add(createAlphaBranchSelectionPass());
49 PM.add(createAlphaLLRPPass(*this));
50 return false;
51 }
52