]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - contrib/llvm/lib/Target/Alpha/AlphaTargetMachine.cpp
Copy head to stable/9 as part of 9.0-RELEASE release cycle.
[FreeBSD/stable/9.git] / contrib / llvm / lib / Target / Alpha / AlphaTargetMachine.cpp
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/Target/TargetRegistry.h"
18 using namespace llvm;
19
20 extern "C" void LLVMInitializeAlphaTarget() { 
21   // Register the target.
22   RegisterTargetMachine<AlphaTargetMachine> X(TheAlphaTarget);
23 }
24
25 AlphaTargetMachine::AlphaTargetMachine(const Target &T, const std::string &TT,
26                                        const std::string &CPU,
27                                        const std::string &FS)
28   : LLVMTargetMachine(T, TT, CPU, FS),
29     DataLayout("e-f128:128:128-n64"),
30     FrameLowering(Subtarget),
31     Subtarget(TT, CPU, FS),
32     TLInfo(*this),
33     TSInfo(*this) {
34   setRelocationModel(Reloc::PIC_);
35 }
36
37
38 //===----------------------------------------------------------------------===//
39 // Pass Pipeline Configuration
40 //===----------------------------------------------------------------------===//
41
42 bool AlphaTargetMachine::addInstSelector(PassManagerBase &PM,
43                                          CodeGenOpt::Level OptLevel) {
44   PM.add(createAlphaISelDag(*this));
45   return false;
46 }
47 bool AlphaTargetMachine::addPreEmitPass(PassManagerBase &PM,
48                                         CodeGenOpt::Level OptLevel) {
49   // Must run branch selection immediately preceding the asm printer
50   PM.add(createAlphaBranchSelectionPass());
51   PM.add(createAlphaLLRPPass(*this));
52   return false;
53 }