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

Side by Side Diff: runtime/vm/flow_graph.h

Issue 515913003: Add loop printing to block comments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/flow_graph.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_FLOW_GRAPH_H_ 5 #ifndef VM_FLOW_GRAPH_H_
6 #define VM_FLOW_GRAPH_H_ 6 #define VM_FLOW_GRAPH_H_
7 7
8 #include "vm/growable_array.h" 8 #include "vm/growable_array.h"
9 #include "vm/hash_map.h" 9 #include "vm/hash_map.h"
10 #include "vm/intermediate_language.h" 10 #include "vm/intermediate_language.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 215
216 // Returns true if every Goto in the graph is expected to have a 216 // Returns true if every Goto in the graph is expected to have a
217 // deoptimization environment and can be used as deoptimization target 217 // deoptimization environment and can be used as deoptimization target
218 // for hoisted instructions. 218 // for hoisted instructions.
219 bool is_licm_allowed() const { return licm_allowed_; } 219 bool is_licm_allowed() const { return licm_allowed_; }
220 220
221 // Stop preserving environments on Goto instructions. LICM is not allowed 221 // Stop preserving environments on Goto instructions. LICM is not allowed
222 // after this point. 222 // after this point.
223 void disallow_licm() { licm_allowed_ = false; } 223 void disallow_licm() { licm_allowed_ = false; }
224 224
225 const ZoneGrowableArray<BlockEntryInstr*>& loop_headers() { 225 const ZoneGrowableArray<BlockEntryInstr*>& LoopHeaders() {
226 if (loop_headers_ == NULL) { 226 if (loop_headers_ == NULL) {
227 loop_headers_ = ComputeLoops(); 227 loop_headers_ = ComputeLoops();
228 } 228 }
229 return *loop_headers_; 229 return *loop_headers_;
230 } 230 }
231 231
232 const ZoneGrowableArray<BlockEntryInstr*>* loop_headers() const {
233 return loop_headers_;
234 }
235
236 // Finds natural loops in the flow graph and attaches a list of loop
237 // body blocks for each loop header.
238 ZoneGrowableArray<BlockEntryInstr*>* ComputeLoops() const;
239
232 // Per loop header invariant loads sets. Each set contains load id for 240 // Per loop header invariant loads sets. Each set contains load id for
233 // those loads that are not affected by anything in the loop and can be 241 // those loads that are not affected by anything in the loop and can be
234 // hoisted out. Sets are computed by LoadOptimizer. 242 // hoisted out. Sets are computed by LoadOptimizer.
235 ZoneGrowableArray<BitVector*>* loop_invariant_loads() const { 243 ZoneGrowableArray<BitVector*>* loop_invariant_loads() const {
236 return loop_invariant_loads_; 244 return loop_invariant_loads_;
237 } 245 }
238 void set_loop_invariant_loads( 246 void set_loop_invariant_loads(
239 ZoneGrowableArray<BitVector*>* loop_invariant_loads) { 247 ZoneGrowableArray<BitVector*>* loop_invariant_loads) {
240 loop_invariant_loads_ = loop_invariant_loads; 248 loop_invariant_loads_ = loop_invariant_loads;
241 } 249 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 void RemoveDeadPhis(GrowableArray<PhiInstr*>* live_phis); 296 void RemoveDeadPhis(GrowableArray<PhiInstr*>* live_phis);
289 297
290 void ReplacePredecessor(BlockEntryInstr* old_block, 298 void ReplacePredecessor(BlockEntryInstr* old_block,
291 BlockEntryInstr* new_block); 299 BlockEntryInstr* new_block);
292 300
293 // Find the natural loop for the back edge m->n and attach loop 301 // Find the natural loop for the back edge m->n and attach loop
294 // information to block n (loop header). The algorithm is described in 302 // information to block n (loop header). The algorithm is described in
295 // "Advanced Compiler Design & Implementation" (Muchnick) p192. 303 // "Advanced Compiler Design & Implementation" (Muchnick) p192.
296 // Returns a BitVector indexed by block pre-order number where each bit 304 // Returns a BitVector indexed by block pre-order number where each bit
297 // indicates membership in the loop. 305 // indicates membership in the loop.
298 BitVector* FindLoop(BlockEntryInstr* m, BlockEntryInstr* n); 306 BitVector* FindLoop(BlockEntryInstr* m, BlockEntryInstr* n) const;
299
300 // Finds natural loops in the flow graph and attaches a list of loop
301 // body blocks for each loop header.
302 ZoneGrowableArray<BlockEntryInstr*>* ComputeLoops();
303 307
304 Isolate* isolate_; 308 Isolate* isolate_;
305 309
306 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used 310 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used
307 // if/when computing SSA. 311 // if/when computing SSA.
308 GrowableArray<intptr_t> parent_; 312 GrowableArray<intptr_t> parent_;
309 GrowableArray<BitVector*> assigned_vars_; 313 GrowableArray<BitVector*> assigned_vars_;
310 314
311 intptr_t current_ssa_temp_index_; 315 intptr_t current_ssa_temp_index_;
312 intptr_t max_block_id_; 316 intptr_t max_block_id_;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 // Per block sets of available blocks. Block A is available at the block B if 439 // Per block sets of available blocks. Block A is available at the block B if
436 // and only if A dominates B and all paths from A to B are free of side 440 // and only if A dominates B and all paths from A to B are free of side
437 // effects. 441 // effects.
438 GrowableArray<BitVector*> available_at_; 442 GrowableArray<BitVector*> available_at_;
439 }; 443 };
440 444
441 445
442 } // namespace dart 446 } // namespace dart
443 447
444 #endif // VM_FLOW_GRAPH_H_ 448 #endif // VM_FLOW_GRAPH_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698