Mercurial > hg > graal-compiler
comparison graal/GraalCompiler/src/com/sun/c1x/ir/Op2.java @ 2587:51ebe5f0516f
changed NegateOp, more Op2 changes (generic inputValuesDo impl)
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Thu, 05 May 2011 15:01:34 +0200 |
parents | 421da5f53b5e |
children | fec99fc30af1 |
comparison
equal
deleted
inserted
replaced
2586:421da5f53b5e | 2587:51ebe5f0516f |
---|---|
82 * @param kind the result type of this instruction | 82 * @param kind the result type of this instruction |
83 * @param opcode the bytecode opcode | 83 * @param opcode the bytecode opcode |
84 * @param x the first input instruction | 84 * @param x the first input instruction |
85 * @param y the second input instruction | 85 * @param y the second input instruction |
86 */ | 86 */ |
87 public Op2(CiKind kind, int opcode, Value x, Value y, Graph graph) { | 87 public Op2(CiKind kind, int opcode, Value x, Value y, int inputCount, int successorCount, Graph graph) { |
88 super(kind, INPUT_COUNT, SUCCESSOR_COUNT, graph); | 88 super(kind, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph); |
89 this.opcode = opcode; | 89 this.opcode = opcode; |
90 setX(x); | 90 setX(x); |
91 setY(y); | 91 setY(y); |
92 } | 92 } |
93 | 93 |
97 public void swapOperands() { | 97 public void swapOperands() { |
98 assert Bytecodes.isCommutative(opcode); | 98 assert Bytecodes.isCommutative(opcode); |
99 Value t = x(); | 99 Value t = x(); |
100 setX(y()); | 100 setX(y()); |
101 setY(t); | 101 setY(t); |
102 } | |
103 | |
104 /** | |
105 * Iterates over the inputs to this instruction. | |
106 * @param closure the closure to apply to each input value | |
107 */ | |
108 @Override | |
109 public void inputValuesDo(ValueClosure closure) { | |
110 setX(closure.apply(x())); | |
111 setY(closure.apply(y())); | |
112 } | 102 } |
113 | 103 |
114 @Override | 104 @Override |
115 public int valueNumber() { | 105 public int valueNumber() { |
116 return Util.hash2(opcode, x(), y()); | 106 return Util.hash2(opcode, x(), y()); |