| 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 16 matching lines...) Expand all Loading... |
| 27 HInstruction next = instruction.next; | 27 HInstruction next = instruction.next; |
| 28 HInstruction replacement = instruction.accept(this); | 28 HInstruction replacement = instruction.accept(this); |
| 29 if (replacement != instruction && replacement != null) { | 29 if (replacement != instruction && replacement != null) { |
| 30 block.rewrite(instruction, replacement); | 30 block.rewrite(instruction, replacement); |
| 31 | 31 |
| 32 // If the replacement instruction does not know its source element, use | 32 // If the replacement instruction does not know its source element, use |
| 33 // the source element of the instruction. | 33 // the source element of the instruction. |
| 34 if (replacement.sourceElement == null) { | 34 if (replacement.sourceElement == null) { |
| 35 replacement.sourceElement = instruction.sourceElement; | 35 replacement.sourceElement = instruction.sourceElement; |
| 36 } | 36 } |
| 37 if (replacement.sourcePosition == null) { | 37 if (replacement.sourceInformation == null) { |
| 38 replacement.sourcePosition = instruction.sourcePosition; | 38 replacement.sourceInformation = instruction.sourceInformation; |
| 39 } | 39 } |
| 40 if (!replacement.isInBasicBlock()) { | 40 if (!replacement.isInBasicBlock()) { |
| 41 // The constant folding can return an instruction that is already | 41 // The constant folding can return an instruction that is already |
| 42 // part of the graph (like an input), so we only add the replacement | 42 // part of the graph (like an input), so we only add the replacement |
| 43 // if necessary. | 43 // if necessary. |
| 44 block.addAfter(instruction, replacement); | 44 block.addAfter(instruction, replacement); |
| 45 // Visit the replacement as the next instruction in case it can also | 45 // Visit the replacement as the next instruction in case it can also |
| 46 // be constant folded away. | 46 // be constant folded away. |
| 47 next = replacement; | 47 next = replacement; |
| 48 } | 48 } |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 } | 730 } |
| 731 | 731 |
| 732 // If [thenInput] is defined in the first predecessor, then it is only used | 732 // If [thenInput] is defined in the first predecessor, then it is only used |
| 733 // by [phi] and can be generated at use site. | 733 // by [phi] and can be generated at use site. |
| 734 if (identical(thenInput.block, end.predecessors[0])) { | 734 if (identical(thenInput.block, end.predecessors[0])) { |
| 735 assert(thenInput.usedBy.length == 1); | 735 assert(thenInput.usedBy.length == 1); |
| 736 markAsGenerateAtUseSite(thenInput); | 736 markAsGenerateAtUseSite(thenInput); |
| 737 } | 737 } |
| 738 } | 738 } |
| 739 } | 739 } |
| OLD | NEW |