| OLD | NEW |
| 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/bit_vector.h" | 8 #include "vm/bit_vector.h" |
| 9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
| 10 #include "vm/hash_map.h" | 10 #include "vm/hash_map.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 return deferred_prefixes_; | 289 return deferred_prefixes_; |
| 290 } | 290 } |
| 291 | 291 |
| 292 BitVector* captured_parameters() const { | 292 BitVector* captured_parameters() const { |
| 293 return captured_parameters_; | 293 return captured_parameters_; |
| 294 } | 294 } |
| 295 | 295 |
| 296 intptr_t inlining_id() const { return inlining_id_; } | 296 intptr_t inlining_id() const { return inlining_id_; } |
| 297 void set_inlining_id(intptr_t value) { inlining_id_ = value; } | 297 void set_inlining_id(intptr_t value) { inlining_id_ = value; } |
| 298 | 298 |
| 299 // Returns true if any instructions were canonicalized away. |
| 300 bool Canonicalize(); |
| 301 |
| 302 void SelectRepresentations(); |
| 303 |
| 304 void WidenSmiToInt32(); |
| 305 |
| 306 // Remove environments from the instructions which do not deoptimize. |
| 307 void EliminateEnvironments(); |
| 308 |
| 299 private: | 309 private: |
| 300 friend class IfConverter; | 310 friend class IfConverter; |
| 301 friend class BranchSimplifier; | 311 friend class BranchSimplifier; |
| 302 friend class ConstantPropagator; | 312 friend class ConstantPropagator; |
| 303 friend class DeadCodeElimination; | 313 friend class DeadCodeElimination; |
| 304 | 314 |
| 305 // SSA transformation methods and fields. | 315 // SSA transformation methods and fields. |
| 306 void ComputeDominators(GrowableArray<BitVector*>* dominance_frontier); | 316 void ComputeDominators(GrowableArray<BitVector*>* dominance_frontier); |
| 307 | 317 |
| 308 void CompressPath( | 318 void CompressPath( |
| (...skipping 24 matching lines...) Expand all Loading... |
| 333 void ReplacePredecessor(BlockEntryInstr* old_block, | 343 void ReplacePredecessor(BlockEntryInstr* old_block, |
| 334 BlockEntryInstr* new_block); | 344 BlockEntryInstr* new_block); |
| 335 | 345 |
| 336 // Find the natural loop for the back edge m->n and attach loop | 346 // Find the natural loop for the back edge m->n and attach loop |
| 337 // information to block n (loop header). The algorithm is described in | 347 // information to block n (loop header). The algorithm is described in |
| 338 // "Advanced Compiler Design & Implementation" (Muchnick) p192. | 348 // "Advanced Compiler Design & Implementation" (Muchnick) p192. |
| 339 // Returns a BitVector indexed by block pre-order number where each bit | 349 // Returns a BitVector indexed by block pre-order number where each bit |
| 340 // indicates membership in the loop. | 350 // indicates membership in the loop. |
| 341 BitVector* FindLoop(BlockEntryInstr* m, BlockEntryInstr* n) const; | 351 BitVector* FindLoop(BlockEntryInstr* m, BlockEntryInstr* n) const; |
| 342 | 352 |
| 353 void InsertConversionsFor(Definition* def); |
| 354 void ConvertUse(Value* use, Representation from); |
| 355 void ConvertEnvironmentUse(Value* use, Representation from); |
| 356 void InsertConversion(Representation from, |
| 357 Representation to, |
| 358 Value* use, |
| 359 bool is_environment_use); |
| 360 |
| 343 Thread* thread_; | 361 Thread* thread_; |
| 344 | 362 |
| 345 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used | 363 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used |
| 346 // if/when computing SSA. | 364 // if/when computing SSA. |
| 347 GrowableArray<intptr_t> parent_; | 365 GrowableArray<intptr_t> parent_; |
| 348 GrowableArray<BitVector*> assigned_vars_; | 366 GrowableArray<BitVector*> assigned_vars_; |
| 349 | 367 |
| 350 intptr_t current_ssa_temp_index_; | 368 intptr_t current_ssa_temp_index_; |
| 351 intptr_t max_block_id_; | 369 intptr_t max_block_id_; |
| 352 | 370 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 | 540 |
| 523 private: | 541 private: |
| 524 GrowableArray<Definition*> defs_; | 542 GrowableArray<Definition*> defs_; |
| 525 BitVector* contains_vector_; | 543 BitVector* contains_vector_; |
| 526 }; | 544 }; |
| 527 | 545 |
| 528 | 546 |
| 529 } // namespace dart | 547 } // namespace dart |
| 530 | 548 |
| 531 #endif // VM_FLOW_GRAPH_H_ | 549 #endif // VM_FLOW_GRAPH_H_ |
| OLD | NEW |