2012-05-05 04:18:50 +08:00
|
|
|
//===-- AllocaHoisting.h - Hosist allocas to the entry block ----*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Hoist the alloca instructions in the non-entry blocks to the entry blocks.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_NVPTX_NVPTXALLOCAHOISTING_H
|
|
|
|
#define LLVM_LIB_TARGET_NVPTX_NVPTXALLOCAHOISTING_H
|
2012-05-05 04:18:50 +08:00
|
|
|
|
|
|
|
#include "llvm/CodeGen/MachineFunctionAnalysis.h"
|
2015-01-28 12:57:56 +08:00
|
|
|
#include "llvm/CodeGen/StackProtector.h"
|
2013-01-02 19:36:10 +08:00
|
|
|
#include "llvm/IR/DataLayout.h"
|
2012-12-04 15:12:27 +08:00
|
|
|
#include "llvm/Pass.h"
|
2012-05-05 04:18:50 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class FunctionPass;
|
|
|
|
class Function;
|
|
|
|
|
|
|
|
// Hoisting the alloca instructions in the non-entry blocks to the entry
|
|
|
|
// block.
|
|
|
|
class NVPTXAllocaHoisting : public FunctionPass {
|
|
|
|
public:
|
|
|
|
static char ID; // Pass ID
|
|
|
|
NVPTXAllocaHoisting() : FunctionPass(ID) {}
|
|
|
|
|
2014-04-29 15:57:44 +08:00
|
|
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
2014-02-26 01:30:31 +08:00
|
|
|
AU.addRequired<DataLayoutPass>();
|
2012-05-05 04:18:50 +08:00
|
|
|
AU.addPreserved<MachineFunctionAnalysis>();
|
2015-01-28 12:57:56 +08:00
|
|
|
AU.addPreserved<StackProtector>();
|
2012-05-05 04:18:50 +08:00
|
|
|
}
|
|
|
|
|
2014-04-29 15:57:44 +08:00
|
|
|
const char *getPassName() const override {
|
2012-05-05 04:18:50 +08:00
|
|
|
return "NVPTX specific alloca hoisting";
|
|
|
|
}
|
|
|
|
|
2014-04-29 15:57:44 +08:00
|
|
|
bool runOnFunction(Function &function) override;
|
2012-05-05 04:18:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
extern FunctionPass *createAllocaHoisting();
|
|
|
|
|
|
|
|
} // end namespace llvm
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#endif
|