Mercurial > hg > graal-jvmci-8
changeset 5607:168a00aa1e9e
Add static sub & div to IntegerArithmeticNode
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Wed, 13 Jun 2012 13:41:02 +0200 |
parents | 5ad40c8ba3ed |
children | 3bc48971a1bf |
files | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerArithmeticNode.java |
diffstat | 1 files changed, 26 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerArithmeticNode.java Wed Jun 13 13:40:39 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerArithmeticNode.java Wed Jun 13 13:41:02 2012 +0200 @@ -59,4 +59,30 @@ throw ValueNodeUtil.shouldNotReachHere(); } } + + public static IntegerSubNode sub(ValueNode v1, ValueNode v2) { + assert v1.kind() == v2.kind() && v1.graph() == v2.graph(); + Graph graph = v1.graph(); + switch(v1.kind()) { + case Int: + return graph.unique(new IntegerSubNode(Kind.Int, v1, v2)); + case Long: + return graph.unique(new IntegerSubNode(Kind.Long, v1, v2)); + default: + throw ValueNodeUtil.shouldNotReachHere(); + } + } + + public static IntegerDivNode div(ValueNode v1, ValueNode v2) { + assert v1.kind() == v2.kind() && v1.graph() == v2.graph(); + Graph graph = v1.graph(); + switch(v1.kind()) { + case Int: + return graph.unique(new IntegerDivNode(Kind.Int, v1, v2)); + case Long: + return graph.unique(new IntegerDivNode(Kind.Long, v1, v2)); + default: + throw ValueNodeUtil.shouldNotReachHere(); + } + } }