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.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef NVPTX_ALLOCA_HOISTING_H_
|
|
|
|
#define NVPTX_ALLOCA_HOISTING_H_
|
|
|
|
|
|
|
|
#include "llvm/CodeGen/MachineFunctionAnalysis.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) {}
|
|
|
|
|
|
|
|
void getAnalysisUsage(AnalysisUsage &AU) const {
|
2012-10-09 00:38:25 +08:00
|
|
|
AU.addRequired<DataLayout>();
|
2013-12-19 11:17:11 +08:00
|
|
|
AU.addPreserved("stack-protector");
|
2012-05-05 04:18:50 +08:00
|
|
|
AU.addPreserved<MachineFunctionAnalysis>();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual const char *getPassName() const {
|
|
|
|
return "NVPTX specific alloca hoisting";
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool runOnFunction(Function &function);
|
|
|
|
};
|
|
|
|
|
|
|
|
extern FunctionPass *createAllocaHoisting();
|
|
|
|
|
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif // NVPTX_ALLOCA_HOISTING_H_
|