comparison graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiAddress.java @ 4206:430b5db3e6f8

Remove CiVariable from the CRI
author Christian Wimmer <Christian.Wimmer@Oracle.com>
date Tue, 03 Jan 2012 12:10:27 -0800
parents aaac4894175c
children 9ce8594bedaf
comparison
equal deleted inserted replaced
4205:2af849af1723 4206:430b5db3e6f8
105 } 105 }
106 this.displacement = (int) longDisp; 106 this.displacement = (int) longDisp;
107 this.index = IllegalValue; 107 this.index = IllegalValue;
108 this.scale = Scale.Times1; 108 this.scale = Scale.Times1;
109 } else { 109 } else {
110 assert isIllegal(base) || isVariable(base) || isRegister(base);
111 assert isIllegal(index) || isVariable(index) || isRegister(index);
112
113 this.index = index; 110 this.index = index;
114 this.scale = scale; 111 this.scale = scale;
115 this.displacement = displacement; 112 this.displacement = displacement;
116 } 113 }
117 } 114 }
190 return Format.BASE; 187 return Format.BASE;
191 } 188 }
192 } 189 }
193 } 190 }
194 191
195 private static String s(CiValue location) {
196 if (isRegister(location)) {
197 return asRegister(location).name;
198 }
199 assert isVariable(location);
200 return "v" + ((CiVariable) location).index;
201 }
202
203 private static String signed(int i) { 192 private static String signed(int i) {
204 if (i >= 0) { 193 if (i >= 0) {
205 return "+" + i; 194 return "+" + i;
206 } 195 }
207 return String.valueOf(i); 196 return String.valueOf(i);
209 198
210 @Override 199 @Override
211 public String toString() { 200 public String toString() {
212 // Checkstyle: stop 201 // Checkstyle: stop
213 switch (format()) { 202 switch (format()) {
214 case BASE : return "[" + s(base) + kindSuffix() + "]"; 203 case BASE : return "[" + base + kindSuffix() + "]";
215 case BASE_DISP : return "[" + s(base) + signed(displacement) + kindSuffix() + "]"; 204 case BASE_DISP : return "[" + base + signed(displacement) + kindSuffix() + "]";
216 case BASE_INDEX : return "[" + s(base) + "+" + s(index) + kindSuffix() + "]"; 205 case BASE_INDEX : return "[" + base + "+" + index + kindSuffix() + "]";
217 case BASE_INDEX_DISP : return "[" + s(base) + "+(" + s(index) + "*" + scale.value + ")" + signed(displacement) + kindSuffix() + "]"; 206 case BASE_INDEX_DISP : return "[" + base + "+(" + index + "*" + scale.value + ")" + signed(displacement) + kindSuffix() + "]";
218 case PLACEHOLDER : return "[<placeholder>]"; 207 case PLACEHOLDER : return "[<placeholder>]";
219 default : throw new IllegalArgumentException("unknown format: " + format()); 208 default : throw new IllegalArgumentException("unknown format: " + format());
220 } 209 }
221 // Checkstyle: resume 210 // Checkstyle: resume
222 } 211 }