Mercurial > hg > truffle
comparison graal/GraalCompiler/src/com/sun/c1x/ir/Arithmetic.java @ 2876:7d7cf33f8466
Subclasses for arithmetic
author | Gilles Duboscq <gilles.duboscq@oracle.com> |
---|---|
date | Tue, 07 Jun 2011 22:51:22 +0200 |
parents | c6bdec623ef9 |
children |
comparison
equal
deleted
inserted
replaced
2865:7a4e6e11877f | 2876:7d7cf33f8466 |
---|---|
28 import com.sun.cri.ci.*; | 28 import com.sun.cri.ci.*; |
29 | 29 |
30 /** | 30 /** |
31 * The {@code ArithmeticOp} class represents arithmetic operations such as addition, subtraction, etc. | 31 * The {@code ArithmeticOp} class represents arithmetic operations such as addition, subtraction, etc. |
32 */ | 32 */ |
33 public final class Arithmetic extends Binary { | 33 public abstract class Arithmetic extends Binary { |
34 | 34 |
35 private static final int INPUT_COUNT = 0; | 35 private static final int INPUT_COUNT = 0; |
36 private static final int SUCCESSOR_COUNT = 0; | 36 private static final int SUCCESSOR_COUNT = 0; |
37 | 37 |
38 private final boolean canTrap; | |
39 private final boolean isStrictFP; | 38 private final boolean isStrictFP; |
40 | 39 |
41 /** | 40 /** |
42 * Creates a new arithmetic operation. | 41 * Creates a new arithmetic operation. |
43 * @param opcode the bytecode opcode | 42 * @param opcode the bytecode opcode |
45 * @param x the first input instruction | 44 * @param x the first input instruction |
46 * @param y the second input instruction | 45 * @param y the second input instruction |
47 * @param isStrictFP indicates this operation has strict rounding semantics | 46 * @param isStrictFP indicates this operation has strict rounding semantics |
48 * @param stateBefore the state for instructions that may trap | 47 * @param stateBefore the state for instructions that may trap |
49 */ | 48 */ |
50 public Arithmetic(int opcode, CiKind kind, Value x, Value y, boolean isStrictFP, boolean canTrap, Graph graph) { | 49 public Arithmetic(CiKind kind, int opcode, Value x, Value y, boolean isStrictFP, Graph graph) { |
51 super(kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); | 50 super(kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); |
52 this.isStrictFP = isStrictFP; | 51 this.isStrictFP = isStrictFP; |
53 this.canTrap = canTrap; | |
54 } | 52 } |
55 | 53 |
56 /** | 54 /** |
57 * Checks whether this instruction has strict fp semantics. | 55 * Checks whether this instruction has strict fp semantics. |
58 * @return {@code true} if this instruction has strict fp semantics | 56 * @return {@code true} if this instruction has strict fp semantics |
70 return Bytecodes.isCommutative(opcode); | 68 return Bytecodes.isCommutative(opcode); |
71 } | 69 } |
72 | 70 |
73 @Override | 71 @Override |
74 public void print(LogStream out) { | 72 public void print(LogStream out) { |
75 out.print(x()).print(' ').print(Bytecodes.operator(opcode)).print(' ').print(y()); | 73 out.print(x()).print(' ').print(this.shortName()).print(' ').print(y()); |
76 } | 74 } |
77 | 75 |
78 @Override | 76 @Override |
79 public String shortName() { | 77 public abstract String shortName(); |
80 return Bytecodes.operator(opcode); | |
81 } | |
82 | |
83 @Override | |
84 public Node copy(Graph into) { | |
85 Arithmetic x = new Arithmetic(opcode, kind, null, null, isStrictFP, canTrap, into); | |
86 return x; | |
87 } | |
88 } | 78 } |