Canonicalize header guards into a common format.
[oota-llvm.git] / lib / Target / NVPTX / NVPTXAllocaHoisting.h
1 //===-- AllocaHoisting.h - Hosist allocas to the entry block ----*- C++ -*-===//
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 // Hoist the alloca instructions in the non-entry blocks to the entry blocks.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXALLOCAHOISTING_H
15 #define LLVM_LIB_TARGET_NVPTX_NVPTXALLOCAHOISTING_H
16
17 #include "llvm/CodeGen/MachineFunctionAnalysis.h"
18 #include "llvm/IR/DataLayout.h"
19 #include "llvm/Pass.h"
20
21 namespace llvm {
22
23 class FunctionPass;
24 class Function;
25
26 // Hoisting the alloca instructions in the non-entry blocks to the entry
27 // block.
28 class NVPTXAllocaHoisting : public FunctionPass {
29 public:
30   static char ID; // Pass ID
31   NVPTXAllocaHoisting() : FunctionPass(ID) {}
32
33   void getAnalysisUsage(AnalysisUsage &AU) const override {
34     AU.addRequired<DataLayoutPass>();
35     AU.addPreserved("stack-protector");
36     AU.addPreserved<MachineFunctionAnalysis>();
37   }
38
39   const char *getPassName() const override {
40     return "NVPTX specific alloca hoisting";
41   }
42
43   bool runOnFunction(Function &function) override;
44 };
45
46 extern FunctionPass *createAllocaHoisting();
47
48 } // end namespace llvm
49
50 #endif