changeset 10820:f8fe0f7ee22a

added createLabelName override in AbstractHSAILAssembler; create a common label name in AbstractAssembler
author twisti
date Fri, 19 Jul 2013 12:01:15 -0700
parents 02222bffbe43
children d5a8a7054005
files graal/com.oracle.graal.asm.hsail/src/com/oracle/graal/asm/hsail/AbstractHSAILAssembler.java graal/com.oracle.graal.asm.hsail/src/com/oracle/graal/asm/hsail/HSAILAssembler.java graal/com.oracle.graal.asm/src/com/oracle/graal/asm/AbstractAssembler.java
diffstat 3 files changed, 16 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.asm.hsail/src/com/oracle/graal/asm/hsail/AbstractHSAILAssembler.java	Fri Jul 19 09:30:49 2013 -0700
+++ b/graal/com.oracle.graal.asm.hsail/src/com/oracle/graal/asm/hsail/AbstractHSAILAssembler.java	Fri Jul 19 12:01:15 2013 -0700
@@ -54,4 +54,9 @@
     protected void patchJumpTarget(int branch, int jumpTarget) {
         // Nothing to do
     }
+
+    @Override
+    protected String createLabelName(Label l, int id) {
+        return "@L" + id;
+    }
 }
--- a/graal/com.oracle.graal.asm.hsail/src/com/oracle/graal/asm/hsail/HSAILAssembler.java	Fri Jul 19 09:30:49 2013 -0700
+++ b/graal/com.oracle.graal.asm.hsail/src/com/oracle/graal/asm/hsail/HSAILAssembler.java	Fri Jul 19 12:01:15 2013 -0700
@@ -26,6 +26,7 @@
 import com.oracle.graal.api.code.*;
 
 import static com.oracle.graal.api.code.ValueUtil.*;
+
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hsail.*;
 import com.oracle.graal.graph.GraalInternalError;
@@ -144,12 +145,10 @@
     }
 
     /**
-     * The mapping to stack slots is always relative to the beginning
-     * of the spillseg.  HSAIL.getStackOffset returns the positive
-     * version of the originally negative offset.  Then we back up
-     * from that by the argSize in bytes.  This ensures that slots of
-     * different size do not overlap, even though we have converted
-     * from negative to positive offsets.
+     * The mapping to stack slots is always relative to the beginning of the spillseg.
+     * HSAIL.getStackOffset returns the positive version of the originally negative offset. Then we
+     * back up from that by the argSize in bytes. This ensures that slots of different size do not
+     * overlap, even though we have converted from negative to positive offsets.
      */
     public static String mapStackSlot(Value reg, int argSize) {
         long offset = HSAIL.getStackOffset(reg);
@@ -213,8 +212,7 @@
 
     public void emitCompare(Value src0, Value src1, String condition, boolean unordered, boolean isUnsignedCompare) {
         String prefix = "cmp_" + condition + (unordered ? "u" : "") + "_b1_" + (isUnsignedCompare ? getArgTypeForceUnsigned(src1) : getArgType(src1));
-        String comment = (isConstant(src1) && (src1.getKind() == Kind.Object)
-                          && (asConstant(src1).asObject() == null) ? " // null test " : "");
+        String comment = (isConstant(src1) && (src1.getKind() == Kind.Object) && (asConstant(src1).asObject() == null) ? " // null test " : "");
         emitString(prefix + " $c0, " + mapRegOrConstToString(src0) + ", " + mapRegOrConstToString(src1) + ";" + comment);
     }
 
@@ -269,7 +267,6 @@
         emit(mnemonic + "_" + prefix, dest, "", src0, src1);
     }
 
-
     private void emit(String instr, Value dest, String controlRegString, Value src0, Value src1) {
         assert (!isConstant(dest));
         emitString(String.format("%s %s, %s%s, %s;", instr, HSAIL.mapRegister(dest), controlRegString, mapRegOrConstToString(src0), mapRegOrConstToString(src1)));
@@ -277,17 +274,14 @@
 
     private void emit(String instr, Value dest, Value src0, Value src1, Value src2) {
         assert (!isConstant(dest));
-        emitString(String.format("%s %s, %s, %s, %s;", instr, HSAIL.mapRegister(dest), mapRegOrConstToString(src0),
-                                 mapRegOrConstToString(src1), mapRegOrConstToString(src2)));
+        emitString(String.format("%s %s, %s, %s, %s;", instr, HSAIL.mapRegister(dest), mapRegOrConstToString(src0), mapRegOrConstToString(src1), mapRegOrConstToString(src2)));
     }
 
-
     public final void cmovCommon(Value dest, Value trueReg, Value falseReg, int width) {
         String instr = (width == 32 ? "cmov_b32" : "cmov_b64");
         emit(instr, dest, "$c0, ", trueReg, falseReg);
     }
 
-
     /**
      * Emit code to build a 64-bit pointer from a compressed-oop and the associated base and shift.
      * We only emit this if base and shift are not both zero.
@@ -309,9 +303,8 @@
     }
 
     /**
-     * Emit code to build a 32-bit compressed pointer from a full
-     * 64-bit pointer using the associated base and shift.  We only
-     * emit this if base and shift are not both zero.
+     * Emit code to build a 32-bit compressed pointer from a full 64-bit pointer using the
+     * associated base and shift. We only emit this if base and shift are not both zero.
      */
     public void emitCompressedOopEncode(Value result, long narrowOopBase, int narrowOopShift) {
         if (narrowOopBase != 0) {
--- a/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/AbstractAssembler.java	Fri Jul 19 09:30:49 2013 -0700
+++ b/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/AbstractAssembler.java	Fri Jul 19 12:01:15 2013 -0700
@@ -64,9 +64,10 @@
      * 
      * @param l the label for which a name is being created
      * @param id a label identifier that is unique with the scope of this assembler
+     * @return a label name in the form of "L123"
      */
     protected String createLabelName(Label l, int id) {
-        return "@L" + id;
+        return "L" + id;
     }
 
     /**