# HG changeset patch # User Roland Schatz # Date 1386241707 -3600 # Node ID 3a8a4042229f784d5a8788a49443a2caca103e26 # Parent ca061aaeddaf197c01306774756cc2d328c4e07d Refactor emission of compare op. diff -r ca061aaeddaf -r 3a8a4042229f graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java --- 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; }