Compiler: rework dataflow iterator.
This cl addresses comments from 278630 - rework DatflowIterator
to be a parent class for the various iteration modes.
Change-Id: Ic16c093597e2d754761b4fdfa47f665d8b315542
diff --git a/src/compiler/dex/mir_optimization.cc b/src/compiler/dex/mir_optimization.cc
index bb3938b..759dc32 100644
--- a/src/compiler/dex/mir_optimization.cc
+++ b/src/compiler/dex/mir_optimization.cc
@@ -103,7 +103,7 @@
is_constant_v_ = AllocBitVector(cu_, GetNumSSARegs(), false);
constant_values_ = static_cast<int*>(NewMem(cu_, sizeof(int) * GetNumSSARegs(), true,
kAllocDFInfo));
- DataflowIterator iter(this, kAllNodes, false /* not iterative */);
+ AllNodesIterator iter(this, false /* not iterative */);
for (BasicBlock* bb = iter.Next(); bb != NULL; bb = iter.Next()) {
DoConstantPropogation(bb);
}
@@ -754,11 +754,11 @@
{
if (!(cu_->disable_opt & (1 << kNullCheckElimination))) {
DCHECK(temp_ssa_register_v_ != NULL);
- DataflowIterator iter(this, kAllNodes, false /* not iterative */);
+ AllNodesIterator iter(this, false /* not iterative */);
for (BasicBlock* bb = iter.Next(); bb != NULL; bb = iter.Next()) {
NullCheckEliminationInit(bb);
}
- DataflowIterator iter2(this, kPreOrderDFSTraversal, true /* iterative */);
+ PreOrderDfsIterator iter2(this, true /* iterative */);
bool change = false;
for (BasicBlock* bb = iter2.Next(change); bb != NULL; bb = iter2.Next(change)) {
change = EliminateNullChecks(bb);
@@ -771,7 +771,7 @@
void MIRGraph::BasicBlockCombine()
{
- DataflowIterator iter(this, kPreOrderDFSTraversal, false /* not iterative */);
+ PreOrderDfsIterator iter(this, false /* not iterative */);
for (BasicBlock* bb = iter.Next(); bb != NULL; bb = iter.Next()) {
CombineBlocks(bb);
}
@@ -782,7 +782,7 @@
void MIRGraph::CodeLayout()
{
- DataflowIterator iter(this, kAllNodes, false /* not iterative */);
+ AllNodesIterator iter(this, false /* not iterative */);
for (BasicBlock* bb = iter.Next(); bb != NULL; bb = iter.Next()) {
LayoutBlocks(bb);
}
@@ -796,7 +796,7 @@
Checkstats* stats =
static_cast<Checkstats*>(NewMem(cu_, sizeof(Checkstats), true, kAllocDFInfo));
cu_->checkstats = stats;
- DataflowIterator iter(this, kAllNodes, false /* not iterative */);
+ AllNodesIterator iter(this, false /* not iterative */);
for (BasicBlock* bb = iter.Next(); bb != NULL; bb = iter.Next()) {
CountChecks(bb);
}
@@ -853,11 +853,11 @@
CompilerInitGrowableList(cu_, &cu_->compiler_temps, 6, kListMisc);
DCHECK_EQ(cu_->num_compiler_temps, 0);
// Mark all blocks as not visited
- DataflowIterator iter(this, kAllNodes, false /* not iterative */);
+ AllNodesIterator iter(this, false /* not iterative */);
for (BasicBlock* bb = iter.Next(); bb != NULL; bb = iter.Next()) {
ClearVisitedFlag(bb);
}
- DataflowIterator iter2(this, kPreOrderDFSTraversal, false /* not iterative */);
+ PreOrderDfsIterator iter2(this, false /* not iterative */);
for (BasicBlock* bb = iter2.Next(); bb != NULL; bb = iter2.Next()) {
BuildExtendedBBList(bb);
}