mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
Add a MachinePostDominator pass
This is used in the AMDIL and R600 backends. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164029 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
55
lib/CodeGen/MachinePostDominators.cpp
Normal file
55
lib/CodeGen/MachinePostDominators.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
//===- MachinePostDominators.cpp -Machine Post Dominator Calculation ------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements simple dominator construction algorithms for finding
|
||||
// post dominators on machine functions.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/CodeGen/MachinePostDominators.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
char MachinePostDominatorTree::ID = 0;
|
||||
|
||||
//declare initializeMachinePostDominatorTreePass
|
||||
INITIALIZE_PASS(MachinePostDominatorTree, "machinepostdomtree",
|
||||
"MachinePostDominator Tree Construction", true, true)
|
||||
|
||||
MachinePostDominatorTree::MachinePostDominatorTree() : MachineFunctionPass(ID) {
|
||||
initializeMachinePostDominatorTreePass(*PassRegistry::getPassRegistry());
|
||||
DT = new DominatorTreeBase<MachineBasicBlock>(true); //true indicate
|
||||
// postdominator
|
||||
}
|
||||
|
||||
FunctionPass *
|
||||
MachinePostDominatorTree::createMachinePostDominatorTreePass() {
|
||||
return new MachinePostDominatorTree();
|
||||
}
|
||||
|
||||
bool
|
||||
MachinePostDominatorTree::runOnMachineFunction(MachineFunction &F) {
|
||||
DT->recalculate(F);
|
||||
return false;
|
||||
}
|
||||
|
||||
MachinePostDominatorTree::~MachinePostDominatorTree() {
|
||||
delete DT;
|
||||
}
|
||||
|
||||
void
|
||||
MachinePostDominatorTree::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
}
|
||||
|
||||
void
|
||||
MachinePostDominatorTree::print(llvm::raw_ostream &OS, const Module *M) const {
|
||||
DT->print(OS);
|
||||
}
|
Reference in New Issue
Block a user