NVPTXAllocaHoisting.h revision 243830
1117395Skan//===-- AllocaHoisting.h - Hosist allocas to the entry block ----*- C++ -*-===//
2117395Skan//
390075Sobrien//                     The LLVM Compiler Infrastructure
490075Sobrien//
590075Sobrien// This file is distributed under the University of Illinois Open Source
690075Sobrien// License. See LICENSE.TXT for details.
790075Sobrien//
890075Sobrien//===----------------------------------------------------------------------===//
990075Sobrien//
1090075Sobrien// Hoist the alloca instructions in the non-entry blocks to the entry blocks.
1190075Sobrien//
1290075Sobrien//===----------------------------------------------------------------------===//
13117395Skan
14117395Skan#ifndef NVPTX_ALLOCA_HOISTING_H_
1590075Sobrien#define NVPTX_ALLOCA_HOISTING_H_
1690075Sobrien
1790075Sobrien#include "llvm/CodeGen/MachineFunctionAnalysis.h"
1890075Sobrien#include "llvm/Pass.h"
1990075Sobrien#include "llvm/DataLayout.h"
2090075Sobrien
2190075Sobriennamespace llvm {
2290075Sobrien
2390075Sobrienclass FunctionPass;
24107590Sobrienclass Function;
25107590Sobrien
2696263Sobrien// Hoisting the alloca instructions in the non-entry blocks to the entry
2796263Sobrien// block.
2890075Sobrienclass NVPTXAllocaHoisting : public FunctionPass {
2990075Sobrienpublic:
3090075Sobrien  static char ID; // Pass ID
3190075Sobrien  NVPTXAllocaHoisting() : FunctionPass(ID) {}
32117395Skan
3390075Sobrien  void getAnalysisUsage(AnalysisUsage &AU) const {
3490075Sobrien    AU.addRequired<DataLayout>();
3590075Sobrien    AU.addPreserved<MachineFunctionAnalysis>();
3690075Sobrien  }
3790075Sobrien
38107590Sobrien  virtual const char *getPassName() const {
39107590Sobrien    return "NVPTX specific alloca hoisting";
40107590Sobrien  }
41107590Sobrien
42107590Sobrien  virtual bool runOnFunction(Function &function);
43107590Sobrien};
44117395Skan
45107590Sobrienextern FunctionPass *createAllocaHoisting();
46107590Sobrien
47117395Skan} // end namespace llvm
48117395Skan
49117395Skan#endif // NVPTX_ALLOCA_HOISTING_H_
50117395Skan