blob: 7fd53752bf66b27ac1e2fe60c051a2e6cd566f13 [file] [log] [blame]
Justin Holewinski247ee002011-09-22 16:45:33 +00001//===-- 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
20using namespace llvm;
21
22namespace {
23 // Special register allocator for PTX.
24 class PTXRegAlloc : public MachineFunctionPass {
25 public:
26 static char ID;
Andrew Trick8dd26252012-02-10 04:10:36 +000027 PTXRegAlloc() : MachineFunctionPass(ID) {}
Justin Holewinski247ee002011-09-22 16:45:33 +000028
29 virtual const char* getPassName() const {
30 return "PTX Register Allocator";
31 }
32
33 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
34 AU.setPreservesCFG();
Justin Holewinski247ee002011-09-22 16:45:33 +000035 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
50FunctionPass *llvm::createPTXRegisterAllocator() {
51 return new PTXRegAlloc();
52}
53