comparison graal/GraalCompiler/src/com/sun/c1x/ir/Logic.java @ 2853:0635ba16afe4

Reintroduce Logic subclasses, creating some Canonicalization related classes
author Gilles Duboscq <gilles.duboscq@oracle.com>
date Tue, 07 Jun 2011 15:52:55 +0200
parents c6bdec623ef9
children
comparison
equal deleted inserted replaced
2852:c6bdec623ef9 2853:0635ba16afe4
22 */ 22 */
23 package com.sun.c1x.ir; 23 package com.sun.c1x.ir;
24 24
25 import com.oracle.graal.graph.*; 25 import com.oracle.graal.graph.*;
26 import com.sun.c1x.debug.*; 26 import com.sun.c1x.debug.*;
27 import com.sun.cri.bytecode.*;
28 import com.sun.cri.ci.*; 27 import com.sun.cri.ci.*;
29 28
30 /** 29 /**
31 * The {@code LogicOp} class definition. 30 * The {@code LogicOp} class definition.
32 */ 31 */
33 public final class Logic extends Binary { 32 public abstract class Logic extends Binary {
34 33
35 private static final int INPUT_COUNT = 0; 34 private static final int INPUT_COUNT = 0;
36 private static final int SUCCESSOR_COUNT = 0; 35 private static final int SUCCESSOR_COUNT = 0;
37 36
38 /** 37 /**
39 * Constructs a new logic operation instruction. 38 * Constructs a new logic operation instruction.
40 * @param opcode the opcode of the logic operation 39 * @param opcode the opcode of the logic operation
41 * @param x the first input into this instruction 40 * @param x the first input into this instruction
42 * @param y the second input into this instruction 41 * @param y the second input into this instruction
43 */ 42 */
44 public Logic(int opcode, Value x, Value y, Graph graph) { 43 public Logic(CiKind kind, int opcode, Value x, Value y, Graph graph) {
45 super(x.kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); 44 super(kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph);
46 }
47
48 // for copying
49 private Logic(CiKind kind, int opcode, Graph graph) {
50 super(kind, opcode, null, null, INPUT_COUNT, SUCCESSOR_COUNT, graph);
51 } 45 }
52 46
53 @Override 47 @Override
54 public void accept(ValueVisitor v) { 48 public void accept(ValueVisitor v) {
55 v.visitLogic(this); 49 v.visitLogic(this);
56 } 50 }
57 51
58 @Override 52 @Override
59 public void print(LogStream out) { 53 public void print(LogStream out) {
60 out.print(x()).print(' ').print(Bytecodes.operator(opcode)).print(' ').print(y()); 54 out.print(x()).print(' ').print(this.shortName()).print(' ').print(y());
61 } 55 }
62 56
63 @Override 57 @Override
64 public Node copy(Graph into) { 58 public abstract String shortName();
65 Logic x = new Logic(kind, opcode, into);
66 return x;
67 }
68 } 59 }