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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 void SelectRepresentations(); | 299 void SelectRepresentations(); |
300 | 300 |
301 void WidenSmiToInt32(); | 301 void WidenSmiToInt32(); |
302 | 302 |
303 // Remove environments from the instructions which do not deoptimize. | 303 // Remove environments from the instructions which do not deoptimize. |
304 void EliminateEnvironments(); | 304 void EliminateEnvironments(); |
305 | 305 |
306 bool IsReceiver(Definition* def) const; | 306 bool IsReceiver(Definition* def) const; |
307 | 307 |
| 308 // Optimize (a << b) & c pattern: if c is a positive Smi or zero, then the |
| 309 // shift can be a truncating Smi shift-left and result is always Smi. |
| 310 // Merge instructions (only per basic-block). |
| 311 void TryOptimizePatterns(); |
| 312 |
308 private: | 313 private: |
309 friend class IfConverter; | 314 friend class IfConverter; |
310 friend class BranchSimplifier; | 315 friend class BranchSimplifier; |
311 friend class ConstantPropagator; | 316 friend class ConstantPropagator; |
312 friend class DeadCodeElimination; | 317 friend class DeadCodeElimination; |
313 | 318 |
314 // SSA transformation methods and fields. | 319 // SSA transformation methods and fields. |
315 void ComputeDominators(GrowableArray<BitVector*>* dominance_frontier); | 320 void ComputeDominators(GrowableArray<BitVector*>* dominance_frontier); |
316 | 321 |
317 void CompressPath( | 322 void CompressPath( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 void ConvertEnvironmentUse(Value* use, Representation from); | 359 void ConvertEnvironmentUse(Value* use, Representation from); |
355 void InsertConversion(Representation from, | 360 void InsertConversion(Representation from, |
356 Representation to, | 361 Representation to, |
357 Value* use, | 362 Value* use, |
358 bool is_environment_use); | 363 bool is_environment_use); |
359 | 364 |
360 void ComputeIsReceiver(PhiInstr* phi) const; | 365 void ComputeIsReceiver(PhiInstr* phi) const; |
361 void ComputeIsReceiverRecursive(PhiInstr* phi, | 366 void ComputeIsReceiverRecursive(PhiInstr* phi, |
362 GrowableArray<PhiInstr*>* unmark) const; | 367 GrowableArray<PhiInstr*>* unmark) const; |
363 | 368 |
| 369 void OptimizeLeftShiftBitAndSmiOp( |
| 370 ForwardInstructionIterator* current_iterator, |
| 371 Definition* bit_and_instr, |
| 372 Definition* left_instr, |
| 373 Definition* right_instr); |
| 374 |
| 375 void TryMergeTruncDivMod(GrowableArray<BinarySmiOpInstr*>* merge_candidates); |
| 376 void TryMergeMathUnary(GrowableArray<MathUnaryInstr*>* merge_candidates); |
| 377 |
| 378 void AppendExtractNthOutputForMerged(Definition* instr, intptr_t ix, |
| 379 Representation rep, intptr_t cid); |
| 380 |
364 Thread* thread_; | 381 Thread* thread_; |
365 | 382 |
366 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used | 383 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used |
367 // if/when computing SSA. | 384 // if/when computing SSA. |
368 GrowableArray<intptr_t> parent_; | 385 GrowableArray<intptr_t> parent_; |
369 GrowableArray<BitVector*> assigned_vars_; | 386 GrowableArray<BitVector*> assigned_vars_; |
370 | 387 |
371 intptr_t current_ssa_temp_index_; | 388 intptr_t current_ssa_temp_index_; |
372 intptr_t max_block_id_; | 389 intptr_t max_block_id_; |
373 | 390 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 | 559 |
543 private: | 560 private: |
544 GrowableArray<Definition*> defs_; | 561 GrowableArray<Definition*> defs_; |
545 BitVector* contains_vector_; | 562 BitVector* contains_vector_; |
546 }; | 563 }; |
547 | 564 |
548 | 565 |
549 } // namespace dart | 566 } // namespace dart |
550 | 567 |
551 #endif // VM_FLOW_GRAPH_H_ | 568 #endif // VM_FLOW_GRAPH_H_ |
OLD | NEW |