comparison graal/GraalCompiler/src/com/sun/c1x/ir/Constant.java @ 2594:092e628ddd5d

changed Constant and Convert, more StoreIndexed changes
author Lukas Stadler <lukas.stadler@jku.at>
date Thu, 05 May 2011 15:43:23 +0200
parents 16b9a8b5ad39
children 3558ca7088c0
comparison
equal deleted inserted replaced
2593:25c278ab287c 2594:092e628ddd5d
22 */ 22 */
23 package com.sun.c1x.ir; 23 package com.sun.c1x.ir;
24 24
25 import static com.sun.c1x.C1XCompilation.*; 25 import static com.sun.c1x.C1XCompilation.*;
26 26
27 import com.oracle.graal.graph.*;
27 import com.sun.c1x.debug.*; 28 import com.sun.c1x.debug.*;
28 import com.sun.cri.ci.*; 29 import com.sun.cri.ci.*;
29 import com.sun.cri.ri.*; 30 import com.sun.cri.ri.*;
30 31
31 /** 32 /**
34 * 35 *
35 * @author Ben L. Titzer 36 * @author Ben L. Titzer
36 */ 37 */
37 public final class Constant extends Instruction { 38 public final class Constant extends Instruction {
38 39
40 private static final int INPUT_COUNT = 0;
41 private static final int SUCCESSOR_COUNT = 0;
42
39 public final CiConstant value; 43 public final CiConstant value;
40 44
41 /** 45 /**
42 * Constructs a new instruction representing the specified constant. 46 * Constructs a new instruction representing the specified constant.
43 * @param value the constant 47 * @param value the constant
48 * @param graph
44 */ 49 */
45 public Constant(CiConstant value) { 50 public Constant(CiConstant value, Graph graph) {
46 super(value.kind.stackKind()); 51 super(value.kind.stackKind(), INPUT_COUNT, SUCCESSOR_COUNT, graph);
47 this.value = value; 52 this.value = value;
48 initFlag(Value.Flag.NonNull, value.isNonNull()); 53 initFlag(Value.Flag.NonNull, value.isNonNull());
49 } 54 }
50 55
51 @Override 56 @Override
54 } 59 }
55 60
56 /** 61 /**
57 * Creates an instruction for a double constant. 62 * Creates an instruction for a double constant.
58 * @param d the double value for which to create the instruction 63 * @param d the double value for which to create the instruction
64 * @param graph
59 * @return an instruction representing the double 65 * @return an instruction representing the double
60 */ 66 */
61 public static Constant forDouble(double d) { 67 public static Constant forDouble(double d, Graph graph) {
62 return new Constant(CiConstant.forDouble(d)); 68 return new Constant(CiConstant.forDouble(d), graph);
63 } 69 }
64 70
65 /** 71 /**
66 * Creates an instruction for a float constant. 72 * Creates an instruction for a float constant.
67 * @param f the float value for which to create the instruction 73 * @param f the float value for which to create the instruction
68 * @return an instruction representing the float 74 * @return an instruction representing the float
69 */ 75 */
70 public static Constant forFloat(float f) { 76 public static Constant forFloat(float f, Graph graph) {
71 return new Constant(CiConstant.forFloat(f)); 77 return new Constant(CiConstant.forFloat(f), graph);
72 } 78 }
73 79
74 /** 80 /**
75 * Creates an instruction for an long constant. 81 * Creates an instruction for an long constant.
76 * @param i the long value for which to create the instruction 82 * @param i the long value for which to create the instruction
77 * @return an instruction representing the long 83 * @return an instruction representing the long
78 */ 84 */
79 public static Constant forLong(long i) { 85 public static Constant forLong(long i, Graph graph) {
80 return new Constant(CiConstant.forLong(i)); 86 return new Constant(CiConstant.forLong(i), graph);
81 } 87 }
82 88
83 /** 89 /**
84 * Creates an instruction for an integer constant. 90 * Creates an instruction for an integer constant.
85 * @param i the integer value for which to create the instruction 91 * @param i the integer value for which to create the instruction
86 * @return an instruction representing the integer 92 * @return an instruction representing the integer
87 */ 93 */
88 public static Constant forInt(int i) { 94 public static Constant forInt(int i, Graph graph) {
89 return new Constant(CiConstant.forInt(i)); 95 return new Constant(CiConstant.forInt(i), graph);
90 } 96 }
91 97
92 /** 98 /**
93 * Creates an instruction for a boolean constant. 99 * Creates an instruction for a boolean constant.
94 * @param i the boolean value for which to create the instruction 100 * @param i the boolean value for which to create the instruction
95 * @return an instruction representing the boolean 101 * @return an instruction representing the boolean
96 */ 102 */
97 public static Constant forBoolean(boolean i) { 103 public static Constant forBoolean(boolean i, Graph graph) {
98 return new Constant(CiConstant.forBoolean(i)); 104 return new Constant(CiConstant.forBoolean(i), graph);
99 } 105 }
100 106
101 /** 107 /**
102 * Creates an instruction for an address (jsr/ret address) constant. 108 * Creates an instruction for an address (jsr/ret address) constant.
103 * @param i the address value for which to create the instruction 109 * @param i the address value for which to create the instruction
104 * @return an instruction representing the address 110 * @return an instruction representing the address
105 */ 111 */
106 public static Constant forJsr(int i) { 112 public static Constant forJsr(int i, Graph graph) {
107 return new Constant(CiConstant.forJsr(i)); 113 return new Constant(CiConstant.forJsr(i), graph);
108 } 114 }
109 115
110 /** 116 /**
111 * Creates an instruction for an object constant. 117 * Creates an instruction for an object constant.
112 * @param o the object value for which to create the instruction 118 * @param o the object value for which to create the instruction
113 * @return an instruction representing the object 119 * @return an instruction representing the object
114 */ 120 */
115 public static Constant forObject(Object o) { 121 public static Constant forObject(Object o, Graph graph) {
116 return new Constant(CiConstant.forObject(o)); 122 return new Constant(CiConstant.forObject(o), graph);
117 } 123 }
118 124
119 /** 125 /**
120 * Creates an instruction for a word constant. 126 * Creates an instruction for a word constant.
121 * @param val the word value for which to create the instruction 127 * @param val the word value for which to create the instruction
122 * @return an instruction representing the word 128 * @return an instruction representing the word
123 */ 129 */
124 public static Constant forWord(long val) { 130 public static Constant forWord(long val, Graph graph) {
125 return new Constant(CiConstant.forWord(val)); 131 return new Constant(CiConstant.forWord(val), graph);
126 } 132 }
127 133
128 @Override 134 @Override
129 public String toString() { 135 public String toString() {
130 return super.toString() + "(" + value + ")"; 136 return super.toString() + "(" + value + ")";