mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
NVPTX: move NVPTXAllocaHoisting into the cpp file
Also initialize without using static initialization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231822 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
73dff35fac
commit
f0d37a472f
@ -12,11 +12,33 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "NVPTXAllocaHoisting.h"
|
||||
#include "llvm/CodeGen/MachineFunctionAnalysis.h"
|
||||
#include "llvm/CodeGen/StackProtector.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace llvm {
|
||||
namespace {
|
||||
// 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 override {
|
||||
AU.addPreserved<MachineFunctionAnalysis>();
|
||||
AU.addPreserved<StackProtector>();
|
||||
}
|
||||
|
||||
const char *getPassName() const override {
|
||||
return "NVPTX specific alloca hoisting";
|
||||
}
|
||||
|
||||
bool runOnFunction(Function &function) override;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
bool NVPTXAllocaHoisting::runOnFunction(Function &function) {
|
||||
bool functionModified = false;
|
||||
@ -36,11 +58,15 @@ bool NVPTXAllocaHoisting::runOnFunction(Function &function) {
|
||||
return functionModified;
|
||||
}
|
||||
|
||||
char NVPTXAllocaHoisting::ID = 1;
|
||||
static RegisterPass<NVPTXAllocaHoisting>
|
||||
X("alloca-hoisting", "Hoisting alloca instructions in non-entry "
|
||||
"blocks to the entry block");
|
||||
char NVPTXAllocaHoisting::ID = 0;
|
||||
|
||||
FunctionPass *createAllocaHoisting() { return new NVPTXAllocaHoisting(); }
|
||||
namespace llvm {
|
||||
void initializeNVPTXAllocaHoistingPass(PassRegistry &);
|
||||
}
|
||||
|
||||
} // end namespace llvm
|
||||
INITIALIZE_PASS(
|
||||
NVPTXAllocaHoisting, "alloca-hoisting",
|
||||
"Hoisting alloca instructions in non-entry blocks to the entry block",
|
||||
false, false)
|
||||
|
||||
FunctionPass *llvm::createAllocaHoisting() { return new NVPTXAllocaHoisting; }
|
||||
|
@ -14,37 +14,10 @@
|
||||
#ifndef LLVM_LIB_TARGET_NVPTX_NVPTXALLOCAHOISTING_H
|
||||
#define LLVM_LIB_TARGET_NVPTX_NVPTXALLOCAHOISTING_H
|
||||
|
||||
#include "llvm/CodeGen/MachineFunctionAnalysis.h"
|
||||
#include "llvm/CodeGen/StackProtector.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/Pass.h"
|
||||
|
||||
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 override {
|
||||
AU.addPreserved<MachineFunctionAnalysis>();
|
||||
AU.addPreserved<StackProtector>();
|
||||
}
|
||||
|
||||
const char *getPassName() const override {
|
||||
return "NVPTX specific alloca hoisting";
|
||||
}
|
||||
|
||||
bool runOnFunction(Function &function) override;
|
||||
};
|
||||
|
||||
extern FunctionPass *createAllocaHoisting();
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
|
@ -50,6 +50,7 @@ using namespace llvm;
|
||||
namespace llvm {
|
||||
void initializeNVVMReflectPass(PassRegistry&);
|
||||
void initializeGenericToNVVMPass(PassRegistry&);
|
||||
void initializeNVPTXAllocaHoistingPass(PassRegistry &);
|
||||
void initializeNVPTXAssignValidGlobalNamesPass(PassRegistry&);
|
||||
void initializeNVPTXFavorNonGenericAddrSpacesPass(PassRegistry &);
|
||||
void initializeNVPTXLowerStructArgsPass(PassRegistry &);
|
||||
@ -64,6 +65,7 @@ extern "C" void LLVMInitializeNVPTXTarget() {
|
||||
// but it's very NVPTX-specific.
|
||||
initializeNVVMReflectPass(*PassRegistry::getPassRegistry());
|
||||
initializeGenericToNVVMPass(*PassRegistry::getPassRegistry());
|
||||
initializeNVPTXAllocaHoistingPass(*PassRegistry::getPassRegistry());
|
||||
initializeNVPTXAssignValidGlobalNamesPass(*PassRegistry::getPassRegistry());
|
||||
initializeNVPTXFavorNonGenericAddrSpacesPass(
|
||||
*PassRegistry::getPassRegistry());
|
||||
|
Loading…
Reference in New Issue
Block a user