LLVM API Documentation

NVPTXAllocaHoisting.h
Go to the documentation of this file.
00001 //===-- AllocaHoisting.h - Hosist allocas to the entry block ----*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // Hoist the alloca instructions in the non-entry blocks to the entry blocks.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXALLOCAHOISTING_H
00015 #define LLVM_LIB_TARGET_NVPTX_NVPTXALLOCAHOISTING_H
00016 
00017 #include "llvm/CodeGen/MachineFunctionAnalysis.h"
00018 #include "llvm/IR/DataLayout.h"
00019 #include "llvm/Pass.h"
00020 
00021 namespace llvm {
00022 
00023 class FunctionPass;
00024 class Function;
00025 
00026 // Hoisting the alloca instructions in the non-entry blocks to the entry
00027 // block.
00028 class NVPTXAllocaHoisting : public FunctionPass {
00029 public:
00030   static char ID; // Pass ID
00031   NVPTXAllocaHoisting() : FunctionPass(ID) {}
00032 
00033   void getAnalysisUsage(AnalysisUsage &AU) const override {
00034     AU.addRequired<DataLayoutPass>();
00035     AU.addPreserved("stack-protector");
00036     AU.addPreserved<MachineFunctionAnalysis>();
00037   }
00038 
00039   const char *getPassName() const override {
00040     return "NVPTX specific alloca hoisting";
00041   }
00042 
00043   bool runOnFunction(Function &function) override;
00044 };
00045 
00046 extern FunctionPass *createAllocaHoisting();
00047 
00048 } // end namespace llvm
00049 
00050 #endif