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 NVPTX_ALLOCA_HOISTING_H_
15 #define NVPTX_ALLOCA_HOISTING_H_
17 #include "llvm/CodeGen/MachineFunctionAnalysis.h"
18 #include "llvm/IR/DataLayout.h"
19 #include "llvm/Pass.h"
26 // Hoisting the alloca instructions in the non-entry blocks to the entry
28 class NVPTXAllocaHoisting : public FunctionPass {
30 static char ID; // Pass ID
31 NVPTXAllocaHoisting() : FunctionPass(ID) {}
33 void getAnalysisUsage(AnalysisUsage &AU) const override {
34 AU.addRequired<DataLayoutPass>();
35 AU.addPreserved("stack-protector");
36 AU.addPreserved<MachineFunctionAnalysis>();
39 const char *getPassName() const override {
40 return "NVPTX specific alloca hoisting";
43 bool runOnFunction(Function &function) override;
46 extern FunctionPass *createAllocaHoisting();
48 } // end namespace llvm
50 #endif // NVPTX_ALLOCA_HOISTING_H_