]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - contrib/llvm/lib/Target/PTX/PTXRegAlloc.cpp
MFC r234353:
[FreeBSD/stable/9.git] / contrib / llvm / lib / Target / PTX / PTXRegAlloc.cpp
1 //===-- PTXRegAlloc.cpp - PTX Register Allocator --------------------------===//
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 // This file contains a register allocator for PTX code.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #define DEBUG_TYPE "ptx-reg-alloc"
15
16 #include "PTX.h"
17 #include "llvm/CodeGen/MachineFunctionPass.h"
18 #include "llvm/CodeGen/RegAllocRegistry.h"
19
20 using namespace llvm;
21
22 namespace {
23   // Special register allocator for PTX.
24   class PTXRegAlloc : public MachineFunctionPass {
25   public:
26     static char ID;
27     PTXRegAlloc() : MachineFunctionPass(ID) {}
28
29     virtual const char* getPassName() const {
30       return "PTX Register Allocator";
31     }
32
33     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
34       AU.setPreservesCFG();
35       MachineFunctionPass::getAnalysisUsage(AU);
36     }
37
38     virtual bool runOnMachineFunction(MachineFunction &MF) {
39       // We do not actually do anything (at least not yet).
40       return false;
41     }
42   };
43
44   char PTXRegAlloc::ID = 0;
45
46   static RegisterRegAlloc
47     ptxRegAlloc("ptx", "PTX register allocator", createPTXRegisterAllocator);
48 }
49
50 FunctionPass *llvm::createPTXRegisterAllocator() {
51   return new PTXRegAlloc();
52 }
53