DataLayout: Report when the preferred alignment is less than the ABI
[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/CodeGen/StackProtector.h"
19 #include "llvm/IR/DataLayout.h"
20 #include "llvm/Pass.h"
21
22 namespace llvm {
23
24 class FunctionPass;
25 class Function;
26
27 // Hoisting the alloca instructions in the non-entry blocks to the entry
28 // block.
29 class NVPTXAllocaHoisting : public FunctionPass {
30 public:
31   static char ID; // Pass ID
32   NVPTXAllocaHoisting() : FunctionPass(ID) {}
33
34   void getAnalysisUsage(AnalysisUsage &AU) const override {
35     AU.addRequired<DataLayoutPass>();
36     AU.addPreserved<MachineFunctionAnalysis>();
37     AU.addPreserved<StackProtector>();
38   }
39
40   const char *getPassName() const override {
41     return "NVPTX specific alloca hoisting";
42   }
43
44   bool runOnFunction(Function &function) override;
45 };
46
47 extern FunctionPass *createAllocaHoisting();
48
49 } // end namespace llvm
50
51 #endif