changeset 23066:41dc027f8de7

TraceRA: add hints for moves to fixed registers.
author Josef Eisl <josef.eisl@jku.at>
date Mon, 23 Nov 2015 11:17:37 +0100
parents cc80ff107273
children a9f8295094c3
files graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/trace/TraceLinearScanLifetimeAnalysisPhase.java
diffstat 1 files changed, 17 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/trace/TraceLinearScanLifetimeAnalysisPhase.java	Mon Nov 23 09:58:08 2015 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/trace/TraceLinearScanLifetimeAnalysisPhase.java	Mon Nov 23 11:17:37 2015 +0100
@@ -330,8 +330,11 @@
 
                 op.forEachRegisterHint(targetValue, mode, (registerHint, valueMode, valueFlags) -> {
                     if (TraceLinearScan.isVariableOrRegister(registerHint)) {
-                        AllocatableValue fromValue;
-                        AllocatableValue toValue;
+                        /*
+                         * TODO (je): clean up
+                         */
+                        final AllocatableValue fromValue;
+                        final AllocatableValue toValue;
                         /* hints always point from def to use */
                         if (hintAtDef) {
                             fromValue = (AllocatableValue) registerHint;
@@ -340,14 +343,21 @@
                             fromValue = (AllocatableValue) targetValue;
                             toValue = (AllocatableValue) registerHint;
                         }
+                        Debug.log("addRegisterHint %s to %s", fromValue, toValue);
+                        final TraceInterval to;
+                        final IntervalHint from;
                         if (isRegister(toValue)) {
-                            /* fixed register: no need for a hint */
-                            return null;
+                            if (isRegister(fromValue)) {
+                                // fixed to fixed move
+                                return null;
+                            }
+                            from = getIntervalHint(toValue);
+                            to = allocator.getOrCreateInterval(fromValue);
+                        } else {
+                            to = allocator.getOrCreateInterval(toValue);
+                            from = getIntervalHint(fromValue);
                         }
 
-                        TraceInterval to = allocator.getOrCreateInterval(toValue);
-                        IntervalHint from = getIntervalHint(fromValue);
-
                         to.setLocationHint(from);
                         if (Debug.isLogEnabled()) {
                             Debug.log("operation at opId %d: added hint from interval %s to %s", op.id(), from, to);