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

Unified Diff: runtime/vm/flow_graph.h

Issue 10909094: Implement loop invariant code motion for check instructions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/flow_graph.h
===================================================================
--- runtime/vm/flow_graph.h (revision 11934)
+++ runtime/vm/flow_graph.h (working copy)
@@ -18,6 +18,27 @@
class ReturnInstr;
class StaticCallInstr;
+
+class BlockIterator : public ValueObject {
+ public:
+ explicit BlockIterator(const GrowableArray<BlockEntryInstr*>& block_order)
+ : block_order_(block_order), current_(0) { }
+
+ void Advance() {
+ ASSERT(!Done());
+ current_++;
+ }
+
+ bool Done() const { return current_ >= block_order_.length(); }
+
+ BlockEntryInstr* Current() const { return block_order_[current_]; }
+
+ private:
+ const GrowableArray<BlockEntryInstr*>& block_order_;
+ intptr_t current_;
+};
+
+
// Class to incapsulate the construction and manipulation of the flow graph.
class FlowGraph: public ZoneAllocated {
public:
@@ -54,6 +75,14 @@
return reverse_postorder_;
}
+ // Iterators.
+ BlockIterator reverse_postorder_iterator() const {
+ return BlockIterator(reverse_postorder());
+ }
+ BlockIterator postorder_iterator() const {
+ return BlockIterator(postorder());
+ }
+
intptr_t max_virtual_register_number() const {
return current_ssa_temp_index();
}
@@ -71,6 +100,10 @@
void ComputeSSA(intptr_t next_virtual_register_number = 0);
void ComputeUseLists();
+ // Finds natural loops in the flow graph and attaches a list of loop
+ // body blocks for each loop header.
+ void ComputeLoops(GrowableArray<BlockEntryInstr*>* loop_headers);
+
void InlineCall(StaticCallInstr* call, FlowGraph* callee_graph);
// TODO(zerny): Once the SSA is feature complete this should be removed.

Powered by Google App Engine
This is Rietveld 408576698