Support for FixedArrayNode with local mem
package uk.ac.manchester.tornado.drivers.opencl.graal.nodes;
import org.graalvm.compiler.core.common.LIRKind;
-
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.core.common.type.TypeReference;
import org.graalvm.compiler.graph.NodeClass;
@@ -49,7 +48,8 @@ public class FixedArrayNode extends FloatingNode implements LIRLowerable {
public static final NodeClass<FixedArrayNode> TYPE = NodeClass.create(FixedArrayNode.class);
- @Input protected ConstantNode length;
+ @Input
+ protected ConstantNode length;
protected OCLKind elementKind;
protected OCLMemoryBase memoryRegister;
@@ -65,6 +65,15 @@ public class FixedArrayNode extends FloatingNode implements LIRLowerable {
this.arrayTemplate = OCLBinaryTemplate.NEW_ARRAY;
}
+ public FixedArrayNode(OCLMemoryBase memoryRegister, ResolvedJavaType elementType, ConstantNode length, boolean local) {
+ super(TYPE, StampFactory.objectNonNull(TypeReference.createTrustedWithoutAssumptions(elementType.getArrayClass())));
+ this.memoryRegister = memoryRegister;
+ this.length = length;
+ this.elemenType = elementType;
+ this.elementKind = OCLKind.fromResolvedJavaType(elementType);
+ this.arrayTemplate = OCLBinaryTemplate.NEW_LOCAL_FLOAT_ARRAY;
+ }
+
public FixedArrayNode(ResolvedJavaType elementType, ConstantNode length) {
this(OCLArchitecture.hp, elementType, length);
}
@@ -88,8 +97,8 @@ public class FixedArrayNode extends FloatingNode implements LIRLowerable {
@Override
public void generate(NodeLIRBuilderTool gen) {
/*
- * using as_T reinterprets the data as type T - consider: float x =
- * (float) 1; and int value = 1, float x = &(value);
+ * using as_T reinterprets the data as type T - consider: float x = (float) 1;
+ * and int value = 1, float x = &(value);
*/
final Value lengthValue = gen.operand(length);
