R600: Register AMDGPUCFGStructurizer pass

This enables -print-before-all to dump MachineInstrs after it is run.

Reviewed-by: Vincent Lejeune <vljn at ovi.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197057 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Tom Stellard 2013-12-11 17:51:47 +00:00
parent 23df2a7178
commit f8029c70e0
3 changed files with 23 additions and 10 deletions

View File

@ -32,7 +32,7 @@ FunctionPass *createR600EmitClauseMarkers();
FunctionPass *createR600ClauseMergePass(TargetMachine &tm);
FunctionPass *createR600Packetizer(TargetMachine &tm);
FunctionPass *createR600ControlFlowFinalizer(TargetMachine &tm);
FunctionPass *createAMDGPUCFGStructurizerPass(TargetMachine &tm);
FunctionPass *createAMDGPUCFGStructurizerPass();
// SI Passes
FunctionPass *createSITypeRewriter();

View File

@ -179,7 +179,7 @@ bool AMDGPUPassConfig::addPreSched2() {
bool AMDGPUPassConfig::addPreEmitPass() {
const AMDGPUSubtarget &ST = TM->getSubtarget<AMDGPUSubtarget>();
if (ST.getGeneration() <= AMDGPUSubtarget::NORTHERN_ISLANDS) {
addPass(createAMDGPUCFGStructurizerPass(*TM));
addPass(createAMDGPUCFGStructurizerPass());
addPass(createR600ExpandSpecialInstrsPass(*TM));
addPass(&FinalizeMachineBundlesID);
addPass(createR600Packetizer(*TM));

View File

@ -54,6 +54,10 @@ STATISTIC(numLoopcontPatternMatch, "CFGStructurizer number of loop-continue "
STATISTIC(numClonedBlock, "CFGStructurizer cloned blocks");
STATISTIC(numClonedInstr, "CFGStructurizer cloned instructions");
namespace llvm {
void initializeAMDGPUCFGStructurizerPass(PassRegistry&);
}
//===----------------------------------------------------------------------===//
//
// Miscellaneous utility for CFGStructurizer.
@ -131,13 +135,13 @@ public:
static char ID;
AMDGPUCFGStructurizer(TargetMachine &tm) :
MachineFunctionPass(ID), TM(tm),
TII(static_cast<const R600InstrInfo *>(tm.getInstrInfo())),
TRI(&TII->getRegisterInfo()) { }
AMDGPUCFGStructurizer() :
MachineFunctionPass(ID), TII(NULL), TRI(NULL) {
initializeAMDGPUCFGStructurizerPass(*PassRegistry::getPassRegistry());
}
const char *getPassName() const {
return "AMD IL Control Flow Graph structurizer Pass";
return "AMDGPU Control Flow Graph structurizer Pass";
}
void getAnalysisUsage(AnalysisUsage &AU) const {
@ -157,6 +161,8 @@ public:
bool prepare();
bool runOnMachineFunction(MachineFunction &MF) {
TII = static_cast<const R600InstrInfo *>(MF.getTarget().getInstrInfo());
TRI = &TII->getRegisterInfo();
DEBUG(MF.dump(););
OrderedBlks.clear();
FuncRep = &MF;
@ -173,7 +179,6 @@ public:
}
protected:
TargetMachine &TM;
MachineDominatorTree *MDT;
MachinePostDominatorTree *PDT;
MachineLoopInfo *MLI;
@ -1899,6 +1904,14 @@ char AMDGPUCFGStructurizer::ID = 0;
} // end anonymous namespace
FunctionPass *llvm::createAMDGPUCFGStructurizerPass(TargetMachine &tm) {
return new AMDGPUCFGStructurizer(tm);
INITIALIZE_PASS_BEGIN(AMDGPUCFGStructurizer, "amdgpustructurizer",
"AMDGPU CFG Structurizer", false, false)
INITIALIZE_PASS_DEPENDENCY(MachineDominatorTree)
INITIALIZE_PASS_DEPENDENCY(MachinePostDominatorTree)
INITIALIZE_PASS_DEPENDENCY(MachineLoopInfo)
INITIALIZE_PASS_END(AMDGPUCFGStructurizer, "amdgpustructurizer",
"AMDGPU CFG Structurizer", false, false)
FunctionPass *llvm::createAMDGPUCFGStructurizerPass() {
return new AMDGPUCFGStructurizer();
}