aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/android/tools/r8/ir/regalloc
diff options
context:
space:
mode:
authorIan Zerny <zerny@google.com>2017-07-03 15:49:19 +0200
committerIan Zerny <zerny@google.com>2017-07-03 15:49:19 +0200
commit3d4e8f27290151539ea30a2be65872001a9b837d (patch)
treec677bafc71e909762d8b91c886ada3da44e4be68 /src/main/java/com/android/tools/r8/ir/regalloc
parent5cbf5fab13e70af8a5f95f97555761a834db315e (diff)
downloadr8-3d4e8f27290151539ea30a2be65872001a9b837d.tar.gz
Replace DebugLocalRead instruction by annotations directly on instructions.
This is in preperation for emitting exact local changes which requires that the scope-end of a local is attached to the instruction at which it ends. The use of debug-local read instructions did not allow this for, eg, exiting instrucitons. R=ager, sgjesse, shertz Bug: 63243012 Change-Id: I4423452089180654afba982f42f07cf06f757791
Diffstat (limited to 'src/main/java/com/android/tools/r8/ir/regalloc')
-rw-r--r--src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java47
1 files changed, 30 insertions, 17 deletions
diff --git a/src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java b/src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java
index 2eae8e7c5..9d303cfa5 100644
--- a/src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java
+++ b/src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java
@@ -289,11 +289,6 @@ public class LinearScanRegisterAllocator implements RegisterAllocator {
Iterator<Instruction> instructionIterator = block.getInstructions().iterator();
while (instructionIterator.hasNext()) {
Instruction instruction = instructionIterator.next();
- // Remove any local-read instructions now that live ranges are computed.
- if (instruction.isDebugLocalRead()) {
- instructionIterator.remove();
- continue;
- }
if (!instruction.isDebugPosition()) {
continue;
}
@@ -1674,10 +1669,16 @@ public class LinearScanRegisterAllocator implements RegisterAllocator {
live.add(use);
}
}
- Value use = instruction.getPreviousLocalValue();
- if (use != null) {
- assert use.needsRegister();
- live.add(use);
+ if (options.debug) {
+ for (Value use : instruction.getDebugValues()) {
+ assert use.needsRegister();
+ live.add(use);
+ }
+ Value use = instruction.getPreviousLocalValue();
+ if (use != null) {
+ assert use.needsRegister();
+ live.add(use);
+ }
}
}
for (Phi phi : block.getPhis()) {
@@ -1794,15 +1795,27 @@ public class LinearScanRegisterAllocator implements RegisterAllocator {
new LiveIntervalsUse(instruction.getNumber(), instruction.maxInValueRegister()));
}
}
- Value use = instruction.getPreviousLocalValue();
- if (use != null) {
- assert use.needsRegister();
- if (!live.contains(use)) {
- live.add(use);
- addLiveRange(use, block, instruction.getNumber());
+ if (options.debug) {
+ int number = instruction.getNumber();
+ for (Value use : instruction.getDebugValues()) {
+ assert use.needsRegister();
+ if (!live.contains(use)) {
+ live.add(use);
+ addLiveRange(use, block, number);
+ }
+ LiveIntervals useIntervals = use.getLiveIntervals();
+ useIntervals.addUse(new LiveIntervalsUse(number, Constants.U16BIT_MAX));
+ }
+ Value use = instruction.getPreviousLocalValue();
+ if (use != null) {
+ assert use.needsRegister();
+ if (!live.contains(use)) {
+ live.add(use);
+ addLiveRange(use, block, number);
+ }
+ LiveIntervals useIntervals = use.getLiveIntervals();
+ useIntervals.addUse(new LiveIntervalsUse(number, Constants.U16BIT_MAX));
}
- LiveIntervals useIntervals = use.getLiveIntervals();
- useIntervals.addUse(new LiveIntervalsUse(instruction.getNumber(), Constants.U16BIT_MAX));
}
}
}