use of org.graalvm.compiler.nodes.calc.AddNode in project graal by oracle.
the class BasicInductionVariable method direction.
@Override
public Direction direction() {
Stamp stamp = rawStride.stamp(NodeView.DEFAULT);
if (stamp instanceof IntegerStamp) {
IntegerStamp integerStamp = (IntegerStamp) stamp;
Direction dir = null;
if (integerStamp.isStrictlyPositive()) {
dir = Direction.Up;
} else if (integerStamp.isStrictlyNegative()) {
dir = Direction.Down;
}
if (dir != null) {
if (op instanceof AddNode) {
return dir;
} else {
assert op instanceof SubNode;
return dir.opposite();
}
}
}
return null;
}
use of org.graalvm.compiler.nodes.calc.AddNode 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