Mercurial > hg > truffle
comparison graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryArithmeticNode.java @ 19170:3b2e98f9e47c
Initial prototype for loop explosion during graph building.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 06 Feb 2015 03:24:50 +0100 |
parents | f57d86eb036f |
children | e7451826b8c0 |
comparison
equal
deleted
inserted
replaced
19151:f41186c896cd | 19170:3b2e98f9e47c |
---|---|
59 return getOp(getX(), getY()).isAssociative(); | 59 return getOp(getX(), getY()).isAssociative(); |
60 } | 60 } |
61 | 61 |
62 @Override | 62 @Override |
63 public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { | 63 public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { |
64 ValueNode result = tryConstantFold(getOp(forX, forY), forX, forY, stamp()); | |
65 if (result != null) { | |
66 return result; | |
67 } | |
68 return this; | |
69 } | |
70 | |
71 public static <OP> ConstantNode tryConstantFold(BinaryOp<OP> op, ValueNode forX, ValueNode forY, Stamp stamp) { | |
64 if (forX.isConstant() && forY.isConstant()) { | 72 if (forX.isConstant() && forY.isConstant()) { |
65 Constant ret = getOp(forX, forY).foldConstant(forX.asConstant(), forY.asConstant()); | 73 Constant ret = op.foldConstant(forX.asConstant(), forY.asConstant()); |
66 return ConstantNode.forPrimitive(stamp(), ret); | 74 return ConstantNode.forPrimitive(stamp, ret); |
67 } | 75 } |
68 return this; | 76 return null; |
69 } | 77 } |
70 | 78 |
71 @Override | 79 @Override |
72 public boolean inferStamp() { | 80 public boolean inferStamp() { |
73 return updateStamp(getOp(getX(), getY()).foldStamp(getX().stamp(), getY().stamp())); | 81 return updateStamp(getOp(getX(), getY()).foldStamp(getX().stamp(), getY().stamp())); |