1 //===-- AllocaHoisting.h - Hosist allocas to the entry block ----*- C++ -*-===//
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 // Hoist the alloca instructions in the non-entry blocks to the entry blocks.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXALLOCAHOISTING_H
15 #define LLVM_LIB_TARGET_NVPTX_NVPTXALLOCAHOISTING_H
17 #include "llvm/CodeGen/MachineFunctionAnalysis.h"
18 #include "llvm/CodeGen/StackProtector.h"
19 #include "llvm/IR/DataLayout.h"
20 #include "llvm/Pass.h"
27 // Hoisting the alloca instructions in the non-entry blocks to the entry
29 class NVPTXAllocaHoisting : public FunctionPass {
31 static char ID; // Pass ID
32 NVPTXAllocaHoisting() : FunctionPass(ID) {}
34 void getAnalysisUsage(AnalysisUsage &AU) const override {
35 AU.addRequired<DataLayoutPass>();
36 AU.addPreserved<MachineFunctionAnalysis>();
37 AU.addPreserved<StackProtector>();
40 const char *getPassName() const override {
41 return "NVPTX specific alloca hoisting";
44 bool runOnFunction(Function &function) override;
47 extern FunctionPass *createAllocaHoisting();
49 } // end namespace llvm