changeset 23381:e36199b8cdb5

MoveProfiling: outsource MoveType.
author Josef Eisl <josef.eisl@jku.at>
date Wed, 27 Jan 2016 10:10:06 +0100
parents d7e25fa8bc3e
children 4bfb6ce22dd3
files graal/com.oracle.graal.lir/src/com/oracle/graal/lir/profiling/MoveProfiling.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/profiling/MoveType.java
diffstat 2 files changed, 81 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/profiling/MoveProfiling.java	Thu Feb 04 14:14:16 2016 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/profiling/MoveProfiling.java	Wed Jan 27 10:10:06 2016 +0100
@@ -22,16 +22,11 @@
  */
 package com.oracle.graal.lir.profiling;
 
-import static jdk.vm.ci.code.ValueUtil.isRegister;
-import static jdk.vm.ci.code.ValueUtil.isStackSlot;
-
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
 import jdk.vm.ci.code.TargetDescription;
-import jdk.vm.ci.common.JVMCIError;
-import jdk.vm.ci.meta.AllocatableValue;
 import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.Value;
@@ -43,9 +38,7 @@
 import com.oracle.graal.lir.LIRInstruction;
 import com.oracle.graal.lir.StandardOp.BlockEndOp;
 import com.oracle.graal.lir.StandardOp.LabelOp;
-import com.oracle.graal.lir.StandardOp.LoadConstantOp;
 import com.oracle.graal.lir.StandardOp.MoveOp;
-import com.oracle.graal.lir.StandardOp.ValueMoveOp;
 import com.oracle.graal.lir.gen.BenchmarkCounterFactory;
 import com.oracle.graal.lir.gen.LIRGenerationResult;
 import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase;
@@ -59,54 +52,6 @@
         new Analyzer(target, lirGenRes.getLIR(), counterFactory).run();
     }
 
-    private enum MoveType {
-        REG2REG("Reg", "Reg"),
-        STACK2REG("Reg", "Stack"),
-        CONST2REG("Reg", "Const"),
-        REG2STACK("Stack", "Reg"),
-        CONST2STACK("Stack", "Const"),
-        STACK2STACK("Stack", "Stack");
-
-        private final String name;
-
-        MoveType(String dst, String src) {
-            this.name = src + '2' + dst;
-        }
-
-        @Override
-        public String toString() {
-            return name;
-        }
-
-        public static MoveType get(MoveOp move) {
-            AllocatableValue dst = move.getResult();
-            Value src = null;
-            if (move instanceof LoadConstantOp) {
-                if (isRegister(dst)) {
-                    return CONST2REG;
-                } else if (isStackSlot(dst)) {
-                    return CONST2STACK;
-                }
-            } else if (move instanceof ValueMoveOp) {
-                src = ((ValueMoveOp) move).getInput();
-                if (isRegister(dst)) {
-                    if (isRegister(src)) {
-                        return REG2REG;
-                    } else if (isStackSlot(src)) {
-                        return STACK2REG;
-                    }
-                } else if (isStackSlot(dst)) {
-                    if (isRegister(src)) {
-                        return REG2STACK;
-                    } else if (isStackSlot(src)) {
-                        return STACK2STACK;
-                    }
-                }
-            }
-            throw JVMCIError.shouldNotReachHere(String.format("Unrecognized Move: %s dst=%s, src=%s", move, dst, src));
-        }
-    }
-
     private static class Analyzer {
         private final TargetDescription target;
         private final LIR lir;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/profiling/MoveType.java	Wed Jan 27 10:10:06 2016 +0100
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.lir.profiling;
+
+import static jdk.vm.ci.code.ValueUtil.isRegister;
+import static jdk.vm.ci.code.ValueUtil.isStackSlot;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.meta.AllocatableValue;
+import jdk.vm.ci.meta.Value;
+
+import com.oracle.graal.lir.StandardOp.LoadConstantOp;
+import com.oracle.graal.lir.StandardOp.MoveOp;
+import com.oracle.graal.lir.StandardOp.ValueMoveOp;
+
+enum MoveType {
+    REG2REG("Reg", "Reg"),
+    STACK2REG("Reg", "Stack"),
+    CONST2REG("Reg", "Const"),
+    REG2STACK("Stack", "Reg"),
+    CONST2STACK("Stack", "Const"),
+    STACK2STACK("Stack", "Stack");
+
+    private final String name;
+
+    MoveType(String dst, String src) {
+        this.name = src + '2' + dst;
+    }
+
+    @Override
+    public String toString() {
+        return name;
+    }
+
+    public static MoveType get(MoveOp move) {
+        AllocatableValue dst = move.getResult();
+        Value src = null;
+        if (move instanceof LoadConstantOp) {
+            if (isRegister(dst)) {
+                return CONST2REG;
+            } else if (isStackSlot(dst)) {
+                return CONST2STACK;
+            }
+        } else if (move instanceof ValueMoveOp) {
+            src = ((ValueMoveOp) move).getInput();
+            if (isRegister(dst)) {
+                if (isRegister(src)) {
+                    return REG2REG;
+                } else if (isStackSlot(src)) {
+                    return STACK2REG;
+                }
+            } else if (isStackSlot(dst)) {
+                if (isRegister(src)) {
+                    return REG2STACK;
+                } else if (isStackSlot(src)) {
+                    return STACK2STACK;
+                }
+            }
+        }
+        throw JVMCIError.shouldNotReachHere(String.format("Unrecognized Move: %s dst=%s, src=%s", move, dst, src));
+    }
+}