1 //===-- PTXRegAlloc.cpp - PTX Register Allocator --------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains a register allocator for PTX code.
12 //===----------------------------------------------------------------------===//
14 #define DEBUG_TYPE "ptx-reg-alloc"
17 #include "llvm/CodeGen/MachineFunctionPass.h"
18 #include "llvm/CodeGen/RegAllocRegistry.h"
23 // Special register allocator for PTX.
24 class PTXRegAlloc : public MachineFunctionPass {
27 PTXRegAlloc() : MachineFunctionPass(ID) {
28 initializePHIEliminationPass(*PassRegistry::getPassRegistry());
29 initializeTwoAddressInstructionPassPass(*PassRegistry::getPassRegistry());
32 virtual const char* getPassName() const {
33 return "PTX Register Allocator";
36 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
38 AU.addRequiredID(PHIEliminationID);
39 AU.addRequiredID(TwoAddressInstructionPassID);
40 MachineFunctionPass::getAnalysisUsage(AU);
43 virtual bool runOnMachineFunction(MachineFunction &MF) {
44 // We do not actually do anything (at least not yet).
49 char PTXRegAlloc::ID = 0;
51 static RegisterRegAlloc
52 ptxRegAlloc("ptx", "PTX register allocator", createPTXRegisterAllocator);
55 FunctionPass *llvm::createPTXRegisterAllocator() {
56 return new PTXRegAlloc();