OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of ssa; | 5 part of ssa; |
6 | 6 |
7 /** | 7 /** |
8 * Replaces some instructions with specialized versions to make codegen easier. | 8 * Replaces some instructions with specialized versions to make codegen easier. |
9 * Caches codegen information on nodes. | 9 * Caches codegen information on nodes. |
10 */ | 10 */ |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 visitPostDominatorTree(graph); | 607 visitPostDominatorTree(graph); |
608 } | 608 } |
609 | 609 |
610 /** | 610 /** |
611 * Check if a block has at least one statement other than | 611 * Check if a block has at least one statement other than |
612 * [instruction]. | 612 * [instruction]. |
613 */ | 613 */ |
614 bool hasAnyStatement(HBasicBlock block, HInstruction instruction) { | 614 bool hasAnyStatement(HBasicBlock block, HInstruction instruction) { |
615 // If [instruction] is not in [block], then if the block is not | 615 // If [instruction] is not in [block], then if the block is not |
616 // empty, we know there will be a statement to emit. | 616 // empty, we know there will be a statement to emit. |
617 if (!identical(instruction.block, block)) return !identical(block.last, bloc
k.first); | 617 if (!identical(instruction.block, block)) { |
| 618 return !identical(block.last, block.first); |
| 619 } |
618 | 620 |
619 // If [instruction] is not the last instruction of the block | 621 // If [instruction] is not the last instruction of the block |
620 // before the control flow instruction, or the last instruction, | 622 // before the control flow instruction, or the last instruction, |
621 // then we will have to emit a statement for that last instruction. | 623 // then we will have to emit a statement for that last instruction. |
622 if (instruction != block.last | 624 if (instruction != block.last |
623 && !identical(instruction, block.last.previous)) return true; | 625 && !identical(instruction, block.last.previous)) return true; |
624 | 626 |
625 // If one of the instructions in the block until [instruction] is | 627 // If one of the instructions in the block until [instruction] is |
626 // not generated at use site, then we will have to emit a | 628 // not generated at use site, then we will have to emit a |
627 // statement for it. | 629 // statement for it. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 } | 757 } |
756 | 758 |
757 // If [thenInput] is defined in the first predecessor, then it is only used | 759 // If [thenInput] is defined in the first predecessor, then it is only used |
758 // by [phi] and can be generated at use site. | 760 // by [phi] and can be generated at use site. |
759 if (identical(thenInput.block, end.predecessors[0])) { | 761 if (identical(thenInput.block, end.predecessors[0])) { |
760 assert(thenInput.usedBy.length == 1); | 762 assert(thenInput.usedBy.length == 1); |
761 markAsGenerateAtUseSite(thenInput); | 763 markAsGenerateAtUseSite(thenInput); |
762 } | 764 } |
763 } | 765 } |
764 } | 766 } |
OLD | NEW |