Add a pair of hooks to DominanceInfo.

This exposes hooks for accessing internal dominance nodes, and updating the internal DFS numbers.

Closes tensorflow/mlir#151

COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/151 from schweitzpgi:dominance_hooks 69d14214a423b816cbd59feffcacdd02f3b5f921
PiperOrigin-RevId: 272287352
This commit is contained in:
Eric Schweitz 2019-10-01 13:55:10 -07:00 committed by A. Unique TensorFlower
parent c760f233b3
commit 9e6dde3977
2 changed files with 17 additions and 0 deletions

View File

@ -90,6 +90,12 @@ public:
bool properlyDominates(Block *a, Block *b) {
return super::properlyDominates(a, b);
}
/// Return the dominance node from the Region containing block A.
DominanceInfoNode *getNode(Block *a);
/// Update the internal DFS numbers for the dominance nodes.
void updateDFSNumbers();
};
/// A class for computing basic postdominance information.

View File

@ -142,6 +142,17 @@ bool DominanceInfo::properlyDominates(Value *a, Operation *b) {
return dominates(cast<BlockArgument>(a)->getOwner(), b->getBlock());
}
DominanceInfoNode *DominanceInfo::getNode(Block *a) {
auto *region = a->getParent();
assert(dominanceInfos.count(region) != 0);
return dominanceInfos[region]->getNode(a);
}
void DominanceInfo::updateDFSNumbers() {
for (auto &iter : dominanceInfos)
iter.second->updateDFSNumbers();
}
//===----------------------------------------------------------------------===//
// PostDominanceInfo
//===----------------------------------------------------------------------===//