Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: src/IceLoopAnalyzer.h

Issue 1341423002: Reflow comments to use the full width. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix spelling and rebase Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceLiveness.cpp ('k') | src/IceLoopAnalyzer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceLoopAnalyzer.h - Loop Analysis ------------*- C++ -*-===// 1 //===- subzero/src/IceLoopAnalyzer.h - Loop Analysis ------------*- C++ -*-===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 17 matching lines...) Expand all
28 public: 28 public:
29 explicit LoopAnalyzer(Cfg *Func); 29 explicit LoopAnalyzer(Cfg *Func);
30 30
31 /// Use Tarjan's strongly connected components algorithm to identify outermost 31 /// Use Tarjan's strongly connected components algorithm to identify outermost
32 /// to innermost loops. By deleting the head of the loop from the graph, inner 32 /// to innermost loops. By deleting the head of the loop from the graph, inner
33 /// loops can be found. This assumes that the head node is not shared between 33 /// loops can be found. This assumes that the head node is not shared between
34 /// loops but instead all paths to the head come from 'continue' constructs. 34 /// loops but instead all paths to the head come from 'continue' constructs.
35 /// 35 ///
36 /// This only computes the loop nest depth within the function and does not 36 /// This only computes the loop nest depth within the function and does not
37 /// take into account whether the function was called from within a loop. 37 /// take into account whether the function was called from within a loop.
38 // TODO(ascull): this currently uses a extension of Tarjan's algorithm with
39 // is bounded linear. ncbray suggests another algorithm which is linear in
40 // practice but not bounded linear. I think it also finds dominators.
41 // http://lenx.100871.net/papers/loop-SAS.pdf
38 void computeLoopNestDepth(); 42 void computeLoopNestDepth();
39 43
40 private: 44 private:
41 using IndexT = uint32_t; 45 using IndexT = uint32_t;
42 static constexpr IndexT UndefinedIndex = 0; 46 static constexpr IndexT UndefinedIndex = 0;
43 static constexpr IndexT FirstDefinedIndex = 1; 47 static constexpr IndexT FirstDefinedIndex = 1;
44 48
45 // TODO(ascull): classify the other fields 49 // TODO(ascull): classify the other fields
46 class LoopNode { 50 class LoopNode {
47 LoopNode() = delete; 51 LoopNode() = delete;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 IndexT Index; 85 IndexT Index;
82 IndexT LowLink; 86 IndexT LowLink;
83 bool OnStack; 87 bool OnStack;
84 bool Deleted = false; 88 bool Deleted = false;
85 }; 89 };
86 90
87 using LoopNodeList = std::vector<LoopNode, CfgLocalAllocator<LoopNode>>; 91 using LoopNodeList = std::vector<LoopNode, CfgLocalAllocator<LoopNode>>;
88 using LoopNodePtrList = 92 using LoopNodePtrList =
89 std::vector<LoopNode *, CfgLocalAllocator<LoopNode *>>; 93 std::vector<LoopNode *, CfgLocalAllocator<LoopNode *>>;
90 94
91 /// Process the node as part as part of Tarjan's algorithm and return either 95 /// Process the node as part as part of Tarjan's algorithm and return either a
92 /// a node to recurse into or nullptr when the node has been fully processed. 96 /// node to recurse into or nullptr when the node has been fully processed.
93 LoopNode *processNode(LoopNode &Node); 97 LoopNode *processNode(LoopNode &Node);
94 98
95 /// The fuction to analyze for loops. 99 /// The function to analyze for loops.
96 Cfg *const Func; 100 Cfg *const Func;
97 /// A list of decorated nodes in the same order as Func->getNodes() which 101 /// A list of decorated nodes in the same order as Func->getNodes() which
98 /// means the node's index will also be valid in this list. 102 /// means the node's index will also be valid in this list.
99 LoopNodeList AllNodes; 103 LoopNodeList AllNodes;
100 /// This is used as a replacement for the call stack. 104 /// This is used as a replacement for the call stack.
101 LoopNodePtrList WorkStack; 105 LoopNodePtrList WorkStack;
102 /// Track which loop a node belongs to. 106 /// Track which loop a node belongs to.
103 LoopNodePtrList LoopStack; 107 LoopNodePtrList LoopStack;
104 /// The index to assign to the next visited node. 108 /// The index to assign to the next visited node.
105 IndexT NextIndex = FirstDefinedIndex; 109 IndexT NextIndex = FirstDefinedIndex;
106 /// The number of nodes which have been marked deleted. This is used to track 110 /// The number of nodes which have been marked deleted. This is used to track
107 /// when the iteration should end. 111 /// when the iteration should end.
108 LoopNodePtrList::size_type NumDeletedNodes = 0; 112 LoopNodePtrList::size_type NumDeletedNodes = 0;
109 }; 113 };
110 114
111 } // end of namespace Ice 115 } // end of namespace Ice
112 116
113 #endif // SUBZERO_SRC_ICELOOPANALYZER_H 117 #endif // SUBZERO_SRC_ICELOOPANALYZER_H
OLDNEW
« no previous file with comments | « src/IceLiveness.cpp ('k') | src/IceLoopAnalyzer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698