changeset 8143:569b7d482918

Use MoveOp marker interface in AllocatorTest.
author Roland Schatz <roland.schatz@oracle.com>
date Thu, 07 Mar 2013 09:43:30 +0100
parents d413770c6dd0
children a016a19f3792
files graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java
diffstat 1 files changed, 18 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java	Thu Mar 07 09:43:25 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java	Thu Mar 07 09:43:30 2013 +0100
@@ -34,6 +34,7 @@
 import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.ValueProcedure;
+import com.oracle.graal.lir.StandardOp.MoveOp;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.phases.*;
@@ -108,32 +109,30 @@
         }
 
         private void collectStats(final LIRInstruction instr) {
-            final boolean move = instr.name().equals("MOVE");
             instr.forEachOutput(new ValueProcedure() {
 
                 @Override
-                public Value doValue(Value defValue) {
-                    if (ValueUtil.isRegister(defValue)) {
-                        final Register reg = ValueUtil.asRegister(defValue);
+                public Value doValue(Value value) {
+                    if (ValueUtil.isRegister(value)) {
+                        final Register reg = ValueUtil.asRegister(value);
                         registers.add(reg);
-                        if (move) {
-                            instr.forEachInput(new ValueProcedure() {
-
-                                @Override
-                                public Value doValue(Value useValue) {
-                                    if (ValueUtil.isRegister(useValue) && ValueUtil.asRegister(useValue) != reg) {
-                                        regRegMoves++;
-                                    }
-                                    return useValue;
-                                }
-                            });
-                        }
-                    } else if (move && ValueUtil.isStackSlot(defValue)) {
-                        spillMoves++;
                     }
-                    return defValue;
+                    return value;
                 }
             });
+
+            if (instr instanceof MoveOp) {
+                MoveOp move = (MoveOp) instr;
+                Value def = move.getResult();
+                Value use = move.getInput();
+                if (ValueUtil.isRegister(def)) {
+                    if (ValueUtil.isRegister(use) && ValueUtil.asRegister(def) != ValueUtil.asRegister(use)) {
+                        regRegMoves++;
+                    }
+                } else if (ValueUtil.isStackSlot(def)) {
+                    spillMoves++;
+                }
+            }
         }
     }