changeset 13251:3a8a4042229f

Refactor emission of compare op.
author Roland Schatz <roland.schatz@oracle.com>
date Thu, 05 Dec 2013 12:08:27 +0100
parents ca061aaeddaf
children 5d2bc83e9d22
files graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java
diffstat 1 files changed, 23 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java	Wed Dec 04 17:22:41 2013 -0800
+++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java	Thu Dec 05 12:08:27 2013 +0100
@@ -298,6 +298,28 @@
         }
     }
 
+    protected void emitCompareOp(Variable left, Value right) {
+        switch (left.getKind().getStackKind()) {
+            case Int:
+                append(new CompareOp(ICMP, left, right));
+                break;
+            case Long:
+                append(new CompareOp(LCMP, left, right));
+                break;
+            case Object:
+                append(new CompareOp(ACMP, left, right));
+                break;
+            case Float:
+                append(new CompareOp(FCMP, left, right));
+                break;
+            case Double:
+                append(new CompareOp(DCMP, left, right));
+                break;
+            default:
+                throw GraalInternalError.shouldNotReachHere();
+        }
+    }
+
     /**
      * This method emits the compare instruction, and may reorder the operands. It returns true if
      * it did so.
@@ -319,25 +341,7 @@
             right = loadNonConst(b);
             mirrored = false;
         }
-        switch (left.getKind().getStackKind()) {
-            case Int:
-                append(new CompareOp(ICMP, left, right));
-                break;
-            case Long:
-                append(new CompareOp(LCMP, left, right));
-                break;
-            case Object:
-                append(new CompareOp(ACMP, left, right));
-                break;
-            case Float:
-                append(new CompareOp(FCMP, left, right));
-                break;
-            case Double:
-                append(new CompareOp(DCMP, left, right));
-                break;
-            default:
-                throw GraalInternalError.shouldNotReachHere();
-        }
+        emitCompareOp(left, right);
         return mirrored;
     }