use of org.graalvm.compiler.nodes.calc.LeftShiftNode in project graal by oracle.
the class DefaultJavaLoweringProvider method createArrayAddress.
public AddressNode createArrayAddress(StructuredGraph graph, ValueNode array, JavaKind elementKind, ValueNode index) {
ValueNode wordIndex;
if (target.wordSize > 4) {
wordIndex = graph.unique(new SignExtendNode(index, target.wordSize * 8));
} else {
assert target.wordSize == 4 : "unsupported word size";
wordIndex = index;
}
int shift = CodeUtil.log2(arrayScalingFactor(elementKind));
ValueNode scaledIndex = graph.unique(new LeftShiftNode(wordIndex, ConstantNode.forInt(shift, graph)));
int base = arrayBaseOffset(elementKind);
ValueNode offset = graph.unique(new AddNode(scaledIndex, ConstantNode.forIntegerKind(target.wordJavaKind, base, graph)));
return graph.unique(new OffsetAddressNode(array, offset));
}
Aggregations