Add physical register counting functions
[oota-llvm.git] / lib / Target / PTX / PTXTargetMachine.cpp
1 //===-- PTXTargetMachine.cpp - Define TargetMachine for PTX ---------------===//
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 // Top-level implementation for the PTX target.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "PTX.h"
15 #include "PTXMCAsmInfo.h"
16 #include "PTXMCAsmStreamer.h"
17 #include "PTXTargetMachine.h"
18 #include "llvm/PassManager.h"
19 #include "llvm/Target/TargetRegistry.h"
20
21 using namespace llvm;
22
23 extern "C" void LLVMInitializePTXTarget() {
24   RegisterTargetMachine<PTXTargetMachine> X(ThePTXTarget);
25   RegisterAsmInfo<PTXMCAsmInfo> Y(ThePTXTarget);
26   TargetRegistry::RegisterAsmStreamer(ThePTXTarget, createPTXAsmStreamer);
27 }
28
29 // DataLayout and FrameInfo are filled with dummy data
30 PTXTargetMachine::PTXTargetMachine(const Target &T,
31                                    const std::string &TT,
32                                    const std::string &FS)
33   : LLVMTargetMachine(T, TT),
34     DataLayout("e-p:32:32-i64:32:32-f64:32:32-v128:32:128-v64:32:64-n32:64"),
35     FrameInfo(TargetFrameInfo::StackGrowsDown, 2, -2),
36     InstrInfo(*this),
37     TLInfo(*this),
38     Subtarget(TT, FS) {
39 }
40
41 bool PTXTargetMachine::addInstSelector(PassManagerBase &PM,
42                                        CodeGenOpt::Level OptLevel) {
43   PM.add(createPTXISelDag(*this, OptLevel));
44   PM.add(createPTXMFInfoExtract(*this, OptLevel));
45   return false;
46 }