llvm.org GIT mirror llvm / 61d13b1
Drop graph_ prefix git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294621 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Berlin 3 years ago
9 changed file(s) with 16 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
9090 // Provide iterator ranges for the graph traits nodes and children
9191 template
9292 iterator_range::nodes_iterator>
93 graph_nodes(const GraphType &G) {
93 nodes(const GraphType &G) {
9494 return make_range(GraphTraits::nodes_begin(G),
9595 GraphTraits::nodes_end(G));
9696 }
9797 template
9898 iterator_range>::nodes_iterator>
99 inverse_graph_nodes(const GraphType &G) {
99 inverse_nodes(const GraphType &G) {
100100 return make_range(GraphTraits>::nodes_begin(G),
101101 GraphTraits>::nodes_end(G));
102102 }
103103
104104 template
105105 iterator_range::ChildIteratorType>
106 graph_children(const typename GraphTraits::NodeRef &G) {
106 children(const typename GraphTraits::NodeRef &G) {
107107 return make_range(GraphTraits::child_begin(G),
108108 GraphTraits::child_end(G));
109109 }
110110
111111 template
112112 iterator_range>::ChildIteratorType>
113 inverse_graph_children(const typename GraphTraits::NodeRef &G) {
113 inverse_children(const typename GraphTraits::NodeRef &G) {
114114 return make_range(GraphTraits>::child_begin(G),
115115 GraphTraits>::child_end(G));
116116 }
781781 Calculate(*this, F);
782782 } else {
783783 // Initialize the roots list
784 for (auto *Node : graph_nodes(&F))
784 for (auto *Node : nodes(&F))
785785 if (TraitsTy::child_begin(Node) == TraitsTy::child_end(Node))
786786 addRoot(Node);
787787
199199
200200 // initialize the semi dominator to point to the parent node
201201 WInfo.Semi = WInfo.Parent;
202 for (const auto &N : inverse_graph_children(W))
202 for (const auto &N : inverse_children(W))
203203 if (DT.Info.count(N)) { // Only if this predecessor is reachable!
204204 unsigned SemiU = DT.Info[Eval(DT, N, i + 1)].Semi;
205205 if (SemiU < WInfo.Semi)
6363 BasicBlock *BB = Node->getBlock();
6464 // Succ is the successor in the direction we are calculating IDF, so it is
6565 // successor for IDF, and predecessor for Reverse IDF.
66 for (auto *Succ : graph_children(BB)) {
66 for (auto *Succ : children(BB)) {
6767 DomTreeNode *SuccNode = DT.getNode(Succ);
6868
6969 // Quickly skip all CFG edges that are also dominator tree edges instead
911911 }
912912
913913 // walk through all the block in func to check for unreachable
914 for (auto *MBB : graph_nodes(MF)) {
914 for (auto *MBB : nodes(MF)) {
915915 SccNum = getSCCNum(MBB);
916916 if (SccNum == INVALIDSCCNUM)
917917 dbgs() << "unreachable block BB" << MBB->getNumber() << "\n";
10771077 MachineBasicBlock *ExitBlk = *ExitBlks.begin();
10781078 assert(ExitBlk && "Loop has several exit block");
10791079 MBBVector LatchBlks;
1080 for (auto *LB : inverse_graph_children(LoopHeader))
1080 for (auto *LB : inverse_children(LoopHeader))
10811081 if (LoopRep->contains(LB))
10821082 LatchBlks.push_back(LB);
10831083
259259 RegisterSet NewAVs = AVs;
260260 NewAVs.insert(Defs);
261261
262 for (auto *DTN : graph_children(MDT->getNode(&B)))
262 for (auto *DTN : children(MDT->getNode(&B)))
263263 Changed |= visitBlock(*(DTN->getBlock()), T, NewAVs);
264264
265265 if (!T.TopDown)
981981 bool DeadCodeElimination::runOnNode(MachineDomTreeNode *N) {
982982 bool Changed = false;
983983
984 for (auto *DTN : graph_children(N))
984 for (auto *DTN : children(N))
985985 Changed |= runOnNode(DTN);
986986
987987 MachineBasicBlock *B = N->getBlock();
314314 // visited".
315315
316316 Order.push_back(Root);
317 for (auto *DTN : graph_children(DT->getNode(Root)))
317 for (auto *DTN : children(DT->getNode(Root)))
318318 getBlockTraversalOrder(DTN->getBlock(), Order);
319319 }
320320
12311231
12321232 for (unsigned i = 0; i < BO.size(); ++i) {
12331233 BasicBlock *B = cast(BO[i]);
1234 for (auto DTN : graph_children(DT->getNode(B)))
1234 for (auto DTN : children(DT->getNode(B)))
12351235 BO.push_back(DTN->getBlock());
12361236 }
12371237
220220
221221 bool HexagonGenExtract::visitBlock(BasicBlock *B) {
222222 // Depth-first, bottom-up traversal.
223 for (auto *DTN : graph_children(DT->getNode(B)))
223 for (auto *DTN : children(DT->getNode(B)))
224224 visitBlock(DTN->getBlock());
225225
226226 // Allow limiting the number of generated extracts for debugging purposes.
946946 BlockDefs.insert(InsDefs);
947947 }
948948
949 for (auto *DTN : graph_children(MDT->getNode(B))) {
949 for (auto *DTN : children(MDT->getNode(B))) {
950950 MachineBasicBlock *SB = DTN->getBlock();
951951 collectInBlock(SB, AVs);
952952 }
14191419 bool HexagonGenInsert::removeDeadCode(MachineDomTreeNode *N) {
14201420 bool Changed = false;
14211421
1422 for (auto *DTN : graph_children(N))
1422 for (auto *DTN : children(N))
14231423 Changed |= removeDeadCode(DTN);
14241424
14251425 MachineBasicBlock *B = N->getBlock();