< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.aarch64/src/org/graalvm/compiler/lir/aarch64/AArch64ArrayCompareToOp.java

Print this page
rev 52509 : [mq]: graal2


  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 
  25 package org.graalvm.compiler.lir.aarch64;
  26 
  27 import static jdk.vm.ci.aarch64.AArch64.zr;
  28 import static jdk.vm.ci.code.ValueUtil.asRegister;
  29 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.REG;
  30 
  31 import org.graalvm.compiler.asm.Label;
  32 import org.graalvm.compiler.asm.aarch64.AArch64Address;
  33 import org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler;
  34 import org.graalvm.compiler.asm.aarch64.AArch64Assembler.ConditionFlag;

  35 import org.graalvm.compiler.core.common.LIRKind;
  36 import org.graalvm.compiler.lir.LIRInstructionClass;
  37 import org.graalvm.compiler.lir.Opcode;
  38 import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
  39 import org.graalvm.compiler.lir.gen.LIRGeneratorTool;
  40 
  41 import jdk.vm.ci.code.Register;
  42 import jdk.vm.ci.meta.JavaKind;
  43 import jdk.vm.ci.meta.Value;
  44 
  45 /**
  46  * Emits code which compares two arrays lexicographically. If the CPU supports any vector
  47  * instructions specialized code is emitted to leverage these instructions.
  48  */
  49 @Opcode("ARRAY_COMPARE_TO")
  50 public final class AArch64ArrayCompareToOp extends AArch64LIRInstruction {
  51     public static final LIRInstructionClass<AArch64ArrayCompareToOp> TYPE = LIRInstructionClass.create(AArch64ArrayCompareToOp.class);
  52 
  53     private final JavaKind kind1;
  54     private final JavaKind kind2;


  61     @Alive({REG}) protected Value array1Value;
  62     @Alive({REG}) protected Value array2Value;
  63     @Use({REG}) protected Value length1Value;
  64     @Use({REG}) protected Value length2Value;
  65     @Temp({REG}) protected Value length1ValueTemp;
  66     @Temp({REG}) protected Value length2ValueTemp;
  67 
  68     @Temp({REG}) protected Value temp1;
  69     @Temp({REG}) protected Value temp2;
  70     @Temp({REG}) protected Value temp3;
  71     @Temp({REG}) protected Value temp4;
  72     @Temp({REG}) protected Value temp5;
  73     @Temp({REG}) protected Value temp6;
  74 
  75     public AArch64ArrayCompareToOp(LIRGeneratorTool tool, JavaKind kind1, JavaKind kind2, Value result, Value array1, Value array2, Value length1, Value length2) {
  76         super(TYPE);
  77         this.kind1 = kind1;
  78         this.kind2 = kind2;
  79 
  80         // Both offsets should be the same but better be safe than sorry.
  81         this.array1BaseOffset = tool.getProviders().getArrayOffsetProvider().arrayBaseOffset(kind1);
  82         this.array2BaseOffset = tool.getProviders().getArrayOffsetProvider().arrayBaseOffset(kind2);
  83 
  84         this.resultValue = result;
  85 
  86         this.array1Value = array1;
  87         this.array2Value = array2;
  88 
  89         /*
  90          * The length values are inputs but are also killed like temporaries so need both Use and
  91          * Temp annotations, which will only work with fixed registers.
  92          */
  93 
  94         this.length1Value = length1;
  95         this.length2Value = length2;
  96         this.length1ValueTemp = length1;
  97         this.length2ValueTemp = length2;
  98 
  99         // Allocate some temporaries.
 100         this.temp1 = tool.newVariable(LIRKind.unknownReference(tool.target().arch.getWordKind()));
 101         this.temp2 = tool.newVariable(LIRKind.unknownReference(tool.target().arch.getWordKind()));
 102         this.temp3 = tool.newVariable(LIRKind.unknownReference(tool.target().arch.getWordKind()));




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 
  25 package org.graalvm.compiler.lir.aarch64;
  26 
  27 import static jdk.vm.ci.aarch64.AArch64.zr;
  28 import static jdk.vm.ci.code.ValueUtil.asRegister;
  29 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.REG;
  30 
  31 import org.graalvm.compiler.asm.Label;
  32 import org.graalvm.compiler.asm.aarch64.AArch64Address;

  33 import org.graalvm.compiler.asm.aarch64.AArch64Assembler.ConditionFlag;
  34 import org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler;
  35 import org.graalvm.compiler.core.common.LIRKind;
  36 import org.graalvm.compiler.lir.LIRInstructionClass;
  37 import org.graalvm.compiler.lir.Opcode;
  38 import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
  39 import org.graalvm.compiler.lir.gen.LIRGeneratorTool;
  40 
  41 import jdk.vm.ci.code.Register;
  42 import jdk.vm.ci.meta.JavaKind;
  43 import jdk.vm.ci.meta.Value;
  44 
  45 /**
  46  * Emits code which compares two arrays lexicographically. If the CPU supports any vector
  47  * instructions specialized code is emitted to leverage these instructions.
  48  */
  49 @Opcode("ARRAY_COMPARE_TO")
  50 public final class AArch64ArrayCompareToOp extends AArch64LIRInstruction {
  51     public static final LIRInstructionClass<AArch64ArrayCompareToOp> TYPE = LIRInstructionClass.create(AArch64ArrayCompareToOp.class);
  52 
  53     private final JavaKind kind1;
  54     private final JavaKind kind2;


  61     @Alive({REG}) protected Value array1Value;
  62     @Alive({REG}) protected Value array2Value;
  63     @Use({REG}) protected Value length1Value;
  64     @Use({REG}) protected Value length2Value;
  65     @Temp({REG}) protected Value length1ValueTemp;
  66     @Temp({REG}) protected Value length2ValueTemp;
  67 
  68     @Temp({REG}) protected Value temp1;
  69     @Temp({REG}) protected Value temp2;
  70     @Temp({REG}) protected Value temp3;
  71     @Temp({REG}) protected Value temp4;
  72     @Temp({REG}) protected Value temp5;
  73     @Temp({REG}) protected Value temp6;
  74 
  75     public AArch64ArrayCompareToOp(LIRGeneratorTool tool, JavaKind kind1, JavaKind kind2, Value result, Value array1, Value array2, Value length1, Value length2) {
  76         super(TYPE);
  77         this.kind1 = kind1;
  78         this.kind2 = kind2;
  79 
  80         // Both offsets should be the same but better be safe than sorry.
  81         this.array1BaseOffset = tool.getProviders().getMetaAccess().getArrayBaseOffset(kind1);
  82         this.array2BaseOffset = tool.getProviders().getMetaAccess().getArrayBaseOffset(kind2);
  83 
  84         this.resultValue = result;
  85 
  86         this.array1Value = array1;
  87         this.array2Value = array2;
  88 
  89         /*
  90          * The length values are inputs but are also killed like temporaries so need both Use and
  91          * Temp annotations, which will only work with fixed registers.
  92          */
  93 
  94         this.length1Value = length1;
  95         this.length2Value = length2;
  96         this.length1ValueTemp = length1;
  97         this.length2ValueTemp = length2;
  98 
  99         // Allocate some temporaries.
 100         this.temp1 = tool.newVariable(LIRKind.unknownReference(tool.target().arch.getWordKind()));
 101         this.temp2 = tool.newVariable(LIRKind.unknownReference(tool.target().arch.getWordKind()));
 102         this.temp3 = tool.newVariable(LIRKind.unknownReference(tool.target().arch.getWordKind()));


< prev index next >