From 8880325a92601d52c586a642cf4fb634bae81b13 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Fri, 4 May 2012 20:55:23 +0000 Subject: Rename the Region::block_iterator to Region::block_node_iterator, and add a new Region::block_iterator which actually iterates over the basic blocks of the region. The old iterator, now call 'block_node_iterator' iterates over RegionNodes which contain a single basic block. This works well with the GraphTraits-based iterator design, however most users actually want an iterator over the BasicBlocks inside these RegionNodes. Now the 'block_iterator' is a wrapper which exposes exactly this interface. Internally it uses the block_node_iterator to walk all nodes which are single basic blocks, but transparently unwraps the basic block to make user code simpler. While this patch is a bit of a wash, most of the updates are to internal users, not external users of the RegionInfo. I have an accompanying patch to Polly that is a strict simplification of every user of this interface, and I'm working on a pass that also wants the same simplified interface. This patch alone should have no functional impact. llvm-svn: 156202 --- llvm/lib/Analysis/RegionPrinter.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'llvm/lib/Analysis/RegionPrinter.cpp') diff --git a/llvm/lib/Analysis/RegionPrinter.cpp b/llvm/lib/Analysis/RegionPrinter.cpp index a1730b0a3ca..8b23cc70424 100644 --- a/llvm/lib/Analysis/RegionPrinter.cpp +++ b/llvm/lib/Analysis/RegionPrinter.cpp @@ -122,13 +122,11 @@ struct DOTGraphTraits : public DOTGraphTraits { RegionInfo *RI = R->getRegionInfo(); for (Region::const_block_iterator BI = R->block_begin(), - BE = R->block_end(); BI != BE; ++BI) { - BasicBlock *BB = (*BI)->getNodeAs(); - if (RI->getRegionFor(BB) == R) + BE = R->block_end(); BI != BE; ++BI) + if (RI->getRegionFor(*BI) == R) O.indent(2 * (depth + 1)) << "Node" - << static_cast(RI->getTopLevelRegion()->getBBNode(BB)) + << static_cast(RI->getTopLevelRegion()->getBBNode(*BI)) << ";\n"; - } O.indent(2 * depth) << "}\n"; } -- cgit v1.2.3