1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

[RegionIterator] clang-format some pieces. NFC.

llvm-svn: 278992
This commit is contained in:
Tim Shen 2016-08-17 22:12:49 +00:00
parent c1662528d1
commit 424577f51c

View File

@ -172,25 +172,23 @@ public:
/// ///
/// Note that the incoming node must be a bb node, otherwise it will trigger /// Note that the incoming node must be a bb node, otherwise it will trigger
/// an assertion when we try to get a BasicBlock. /// an assertion when we try to get a BasicBlock.
inline RNSuccIterator(NodeType* node) : inline RNSuccIterator(NodeType *node)
Node(node), : Node(node), Itor(BlockTraits::child_begin(node->getEntry())) {
Itor(BlockTraits::child_begin(node->getEntry())) { assert(!Node->isSubRegion() &&
assert(!Node->isSubRegion() "Subregion node not allowed in flat iterating mode!");
&& "Subregion node not allowed in flat iterating mode!"); assert(Node->getParent() && "A BB node must have a parent!");
assert(Node->getParent() && "A BB node must have a parent!");
// Skip the exit block of the iterating region. // Skip the exit block of the iterating region.
while (BlockTraits::child_end(Node->getEntry()) != Itor while (BlockTraits::child_end(Node->getEntry()) != Itor &&
&& Node->getParent()->getExit() == *Itor) Node->getParent()->getExit() == *Itor)
++Itor; ++Itor;
} }
/// @brief Create an end iterator /// @brief Create an end iterator
inline RNSuccIterator(NodeType* node, bool) : inline RNSuccIterator(NodeType *node, bool)
Node(node), : Node(node), Itor(BlockTraits::child_end(node->getEntry())) {
Itor(BlockTraits::child_end(node->getEntry())) { assert(!Node->isSubRegion() &&
assert(!Node->isSubRegion() "Subregion node not allowed in flat iterating mode!");
&& "Subregion node not allowed in flat iterating mode!");
} }
inline bool operator==(const Self& x) const { inline bool operator==(const Self& x) const {
@ -275,34 +273,35 @@ inline RNSuccIterator<NodeType, BlockT, RegionT> succ_end(NodeType* Node) {
} \ } \
} }
#define RegionGraphTraits(RegionT, NodeT) \ #define RegionGraphTraits(RegionT, NodeT) \
template<> struct GraphTraits<RegionT*> \ template <> struct GraphTraits<RegionT *> : public GraphTraits<NodeT *> { \
: public GraphTraits<NodeT*> { \ typedef df_iterator<NodeType *> nodes_iterator; \
typedef df_iterator<NodeType*> nodes_iterator; \ static NodeType *getEntryNode(RegionT *R) { \
static NodeType *getEntryNode(RegionT* R) { \ return R->getNode(R->getEntry()); \
return R->getNode(R->getEntry()); \ } \
} \ static nodes_iterator nodes_begin(RegionT *R) { \
static nodes_iterator nodes_begin(RegionT* R) { \ return nodes_iterator::begin(getEntryNode(R)); \
return nodes_iterator::begin(getEntryNode(R)); \ } \
} \ static nodes_iterator nodes_end(RegionT *R) { \
static nodes_iterator nodes_end(RegionT* R) { \ return nodes_iterator::end(getEntryNode(R)); \
return nodes_iterator::end(getEntryNode(R)); \ } \
} \ }; \
}; \ template <> \
template<> struct GraphTraits<FlatIt<RegionT*> > \ struct GraphTraits<FlatIt<RegionT *>> \
: public GraphTraits<FlatIt<NodeT*> > { \ : public GraphTraits<FlatIt<NodeT *>> { \
typedef df_iterator<NodeType*, SmallPtrSet<NodeType*, 8>, false, \ typedef df_iterator<NodeType *, SmallPtrSet<NodeType *, 8>, false, \
GraphTraits<FlatIt<NodeType*> > > nodes_iterator; \ GraphTraits<FlatIt<NodeType *>>> \
static NodeType *getEntryNode(RegionT* R) { \ nodes_iterator; \
return R->getBBNode(R->getEntry()); \ static NodeType *getEntryNode(RegionT *R) { \
} \ return R->getBBNode(R->getEntry()); \
static nodes_iterator nodes_begin(RegionT* R) { \ } \
return nodes_iterator::begin(getEntryNode(R)); \ static nodes_iterator nodes_begin(RegionT *R) { \
} \ return nodes_iterator::begin(getEntryNode(R)); \
static nodes_iterator nodes_end(RegionT* R) { \ } \
return nodes_iterator::end(getEntryNode(R)); \ static nodes_iterator nodes_end(RegionT *R) { \
} \ return nodes_iterator::end(getEntryNode(R)); \
} } \
}
RegionNodeGraphTraits(RegionNode, BasicBlock, Region); RegionNodeGraphTraits(RegionNode, BasicBlock, Region);
RegionNodeGraphTraits(const RegionNode, BasicBlock, Region); RegionNodeGraphTraits(const RegionNode, BasicBlock, Region);