Mercurial > hg > truffle
diff graal/com.oracle.graal.loop/src/com/oracle/graal/loop/BasicInductionVariable.java @ 17197:ec35bb4eccb8
Add support for other data types to integer arithmetic nodes.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Wed, 24 Sep 2014 13:46:37 +0200 |
parents | 06c15e88d383 |
children | 83c3dd41ca64 |
line wrap: on
line diff
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/BasicInductionVariable.java Fri Sep 19 11:00:46 2014 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/BasicInductionVariable.java Wed Sep 24 13:46:37 2014 +0200 @@ -32,9 +32,9 @@ private ValuePhiNode phi; private ValueNode init; private ValueNode rawStride; - private IntegerArithmeticNode op; + private BinaryArithmeticNode op; - public BasicInductionVariable(LoopEx loop, ValuePhiNode phi, ValueNode init, ValueNode rawStride, IntegerArithmeticNode op) { + public BasicInductionVariable(LoopEx loop, ValuePhiNode phi, ValueNode init, ValueNode rawStride, BinaryArithmeticNode op) { super(loop); this.phi = phi; this.init = init; @@ -59,10 +59,10 @@ dir = Direction.Down; } if (dir != null) { - if (op instanceof IntegerAddNode) { + if (op instanceof AddNode) { return dir; } else { - assert op instanceof IntegerSubNode; + assert op instanceof SubNode; return dir.opposite(); } } @@ -82,10 +82,10 @@ @Override public ValueNode strideNode() { - if (op instanceof IntegerAddNode) { + if (op instanceof AddNode) { return rawStride; } - if (op instanceof IntegerSubNode) { + if (op instanceof SubNode) { return graph().unique(NegateNode.create(rawStride)); } throw GraalInternalError.shouldNotReachHere(); @@ -108,10 +108,10 @@ @Override public long constantStride() { - if (op instanceof IntegerAddNode) { + if (op instanceof AddNode) { return rawStride.asConstant().asLong(); } - if (op instanceof IntegerSubNode) { + if (op instanceof SubNode) { return -rawStride.asConstant().asLong(); } throw GraalInternalError.shouldNotReachHere(); @@ -131,7 +131,7 @@ if (!maxTripCount.stamp().isCompatible(stamp)) { maxTripCount = IntegerConvertNode.convert(maxTripCount, stamp, graph()); } - return IntegerArithmeticNode.add(graph, IntegerArithmeticNode.mul(graph, stride, IntegerArithmeticNode.sub(graph, maxTripCount, ConstantNode.forIntegerStamp(stamp, 1, graph))), initNode); + return BinaryArithmeticNode.add(graph, BinaryArithmeticNode.mul(graph, stride, BinaryArithmeticNode.sub(graph, maxTripCount, ConstantNode.forIntegerStamp(stamp, 1, graph))), initNode); } @Override @@ -141,7 +141,7 @@ if (!maxTripCount.stamp().isCompatible(stamp)) { maxTripCount = IntegerConvertNode.convert(maxTripCount, stamp, graph()); } - return IntegerArithmeticNode.add(graph(), IntegerArithmeticNode.mul(graph(), strideNode(), maxTripCount), initNode()); + return BinaryArithmeticNode.add(graph(), BinaryArithmeticNode.mul(graph(), strideNode(), maxTripCount), initNode()); } @Override