001
002 /*
003 * THIS FILE IS MACHINE_GENERATED. DO NOT EDIT.
004 * See InstructionFormats.template, InstructionFormatList.dat,
005 * OperatorList.dat, etc.
006 */
007
008 package org.jikesrvm.compilers.opt.ir;
009
010 import org.jikesrvm.Configuration;
011 import org.jikesrvm.compilers.opt.ir.operand.ia32.IA32ConditionOperand; //NOPMD
012 import org.jikesrvm.compilers.opt.ir.operand.*;
013
014 /**
015 * The Attempt InstructionFormat class.
016 *
017 * The header comment for {@link Instruction} contains
018 * an explanation of the role of InstructionFormats in the
019 * opt compiler's IR.
020 */
021 @SuppressWarnings("unused") // Machine generated code is never 100% clean
022 public final class Attempt extends InstructionFormat {
023 /**
024 * InstructionFormat identification method for Attempt.
025 * @param i an instruction
026 * @return <code>true</code> if the InstructionFormat of the argument
027 * instruction is Attempt or <code>false</code>
028 * if it is not.
029 */
030 public static boolean conforms(Instruction i) {
031 return conforms(i.operator);
032 }
033 /**
034 * InstructionFormat identification method for Attempt.
035 * @param o an instruction
036 * @return <code>true</code> if the InstructionFormat of the argument
037 * operator is Attempt or <code>false</code>
038 * if it is not.
039 */
040 public static boolean conforms(Operator o) {
041 return o.format == Attempt_format;
042 }
043
044 /**
045 * Get the operand called Result from the
046 * argument instruction. Note that the returned operand
047 * will still point to its containing instruction.
048 * @param i the instruction to fetch the operand from
049 * @return the operand called Result
050 */
051 public static RegisterOperand getResult(Instruction i) {
052 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
053 return (RegisterOperand) i.getOperand(0);
054 }
055 /**
056 * Get the operand called Result from the argument
057 * instruction clearing its instruction pointer. The returned
058 * operand will not point to any containing instruction.
059 * @param i the instruction to fetch the operand from
060 * @return the operand called Result
061 */
062 public static RegisterOperand getClearResult(Instruction i) {
063 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
064 return (RegisterOperand) i.getClearOperand(0);
065 }
066 /**
067 * Set the operand called Result in the argument
068 * instruction to the argument operand. The operand will
069 * now point to the argument instruction as its containing
070 * instruction.
071 * @param i the instruction in which to store the operand
072 * @param Result the operand to store
073 */
074 public static void setResult(Instruction i, RegisterOperand Result) {
075 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
076 i.putOperand(0, Result);
077 }
078 /**
079 * Return the index of the operand called Result
080 * in the argument instruction.
081 * @param i the instruction to access.
082 * @return the index of the operand called Result
083 * in the argument instruction
084 */
085 public static int indexOfResult(Instruction i) {
086 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
087 return 0;
088 }
089 /**
090 * Does the argument instruction have a non-null
091 * operand named Result?
092 * @param i the instruction to access.
093 * @return <code>true</code> if the instruction has an non-null
094 * operand named Result or <code>false</code>
095 * if it does not.
096 */
097 public static boolean hasResult(Instruction i) {
098 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
099 return i.getOperand(0) != null;
100 }
101
102 /**
103 * Get the operand called Address from the
104 * argument instruction. Note that the returned operand
105 * will still point to its containing instruction.
106 * @param i the instruction to fetch the operand from
107 * @return the operand called Address
108 */
109 public static Operand getAddress(Instruction i) {
110 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
111 return (Operand) i.getOperand(1);
112 }
113 /**
114 * Get the operand called Address from the argument
115 * instruction clearing its instruction pointer. The returned
116 * operand will not point to any containing instruction.
117 * @param i the instruction to fetch the operand from
118 * @return the operand called Address
119 */
120 public static Operand getClearAddress(Instruction i) {
121 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
122 return (Operand) i.getClearOperand(1);
123 }
124 /**
125 * Set the operand called Address in the argument
126 * instruction to the argument operand. The operand will
127 * now point to the argument instruction as its containing
128 * instruction.
129 * @param i the instruction in which to store the operand
130 * @param Address the operand to store
131 */
132 public static void setAddress(Instruction i, Operand Address) {
133 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
134 i.putOperand(1, Address);
135 }
136 /**
137 * Return the index of the operand called Address
138 * in the argument instruction.
139 * @param i the instruction to access.
140 * @return the index of the operand called Address
141 * in the argument instruction
142 */
143 public static int indexOfAddress(Instruction i) {
144 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
145 return 1;
146 }
147 /**
148 * Does the argument instruction have a non-null
149 * operand named Address?
150 * @param i the instruction to access.
151 * @return <code>true</code> if the instruction has an non-null
152 * operand named Address or <code>false</code>
153 * if it does not.
154 */
155 public static boolean hasAddress(Instruction i) {
156 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
157 return i.getOperand(1) != null;
158 }
159
160 /**
161 * Get the operand called Offset from the
162 * argument instruction. Note that the returned operand
163 * will still point to its containing instruction.
164 * @param i the instruction to fetch the operand from
165 * @return the operand called Offset
166 */
167 public static Operand getOffset(Instruction i) {
168 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
169 return (Operand) i.getOperand(2);
170 }
171 /**
172 * Get the operand called Offset from the argument
173 * instruction clearing its instruction pointer. The returned
174 * operand will not point to any containing instruction.
175 * @param i the instruction to fetch the operand from
176 * @return the operand called Offset
177 */
178 public static Operand getClearOffset(Instruction i) {
179 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
180 return (Operand) i.getClearOperand(2);
181 }
182 /**
183 * Set the operand called Offset in the argument
184 * instruction to the argument operand. The operand will
185 * now point to the argument instruction as its containing
186 * instruction.
187 * @param i the instruction in which to store the operand
188 * @param Offset the operand to store
189 */
190 public static void setOffset(Instruction i, Operand Offset) {
191 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
192 i.putOperand(2, Offset);
193 }
194 /**
195 * Return the index of the operand called Offset
196 * in the argument instruction.
197 * @param i the instruction to access.
198 * @return the index of the operand called Offset
199 * in the argument instruction
200 */
201 public static int indexOfOffset(Instruction i) {
202 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
203 return 2;
204 }
205 /**
206 * Does the argument instruction have a non-null
207 * operand named Offset?
208 * @param i the instruction to access.
209 * @return <code>true</code> if the instruction has an non-null
210 * operand named Offset or <code>false</code>
211 * if it does not.
212 */
213 public static boolean hasOffset(Instruction i) {
214 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
215 return i.getOperand(2) != null;
216 }
217
218 /**
219 * Get the operand called OldValue from the
220 * argument instruction. Note that the returned operand
221 * will still point to its containing instruction.
222 * @param i the instruction to fetch the operand from
223 * @return the operand called OldValue
224 */
225 public static Operand getOldValue(Instruction i) {
226 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
227 return (Operand) i.getOperand(3);
228 }
229 /**
230 * Get the operand called OldValue from the argument
231 * instruction clearing its instruction pointer. The returned
232 * operand will not point to any containing instruction.
233 * @param i the instruction to fetch the operand from
234 * @return the operand called OldValue
235 */
236 public static Operand getClearOldValue(Instruction i) {
237 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
238 return (Operand) i.getClearOperand(3);
239 }
240 /**
241 * Set the operand called OldValue in the argument
242 * instruction to the argument operand. The operand will
243 * now point to the argument instruction as its containing
244 * instruction.
245 * @param i the instruction in which to store the operand
246 * @param OldValue the operand to store
247 */
248 public static void setOldValue(Instruction i, Operand OldValue) {
249 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
250 i.putOperand(3, OldValue);
251 }
252 /**
253 * Return the index of the operand called OldValue
254 * in the argument instruction.
255 * @param i the instruction to access.
256 * @return the index of the operand called OldValue
257 * in the argument instruction
258 */
259 public static int indexOfOldValue(Instruction i) {
260 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
261 return 3;
262 }
263 /**
264 * Does the argument instruction have a non-null
265 * operand named OldValue?
266 * @param i the instruction to access.
267 * @return <code>true</code> if the instruction has an non-null
268 * operand named OldValue or <code>false</code>
269 * if it does not.
270 */
271 public static boolean hasOldValue(Instruction i) {
272 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
273 return i.getOperand(3) != null;
274 }
275
276 /**
277 * Get the operand called NewValue from the
278 * argument instruction. Note that the returned operand
279 * will still point to its containing instruction.
280 * @param i the instruction to fetch the operand from
281 * @return the operand called NewValue
282 */
283 public static Operand getNewValue(Instruction i) {
284 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
285 return (Operand) i.getOperand(4);
286 }
287 /**
288 * Get the operand called NewValue from the argument
289 * instruction clearing its instruction pointer. The returned
290 * operand will not point to any containing instruction.
291 * @param i the instruction to fetch the operand from
292 * @return the operand called NewValue
293 */
294 public static Operand getClearNewValue(Instruction i) {
295 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
296 return (Operand) i.getClearOperand(4);
297 }
298 /**
299 * Set the operand called NewValue in the argument
300 * instruction to the argument operand. The operand will
301 * now point to the argument instruction as its containing
302 * instruction.
303 * @param i the instruction in which to store the operand
304 * @param NewValue the operand to store
305 */
306 public static void setNewValue(Instruction i, Operand NewValue) {
307 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
308 i.putOperand(4, NewValue);
309 }
310 /**
311 * Return the index of the operand called NewValue
312 * in the argument instruction.
313 * @param i the instruction to access.
314 * @return the index of the operand called NewValue
315 * in the argument instruction
316 */
317 public static int indexOfNewValue(Instruction i) {
318 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
319 return 4;
320 }
321 /**
322 * Does the argument instruction have a non-null
323 * operand named NewValue?
324 * @param i the instruction to access.
325 * @return <code>true</code> if the instruction has an non-null
326 * operand named NewValue or <code>false</code>
327 * if it does not.
328 */
329 public static boolean hasNewValue(Instruction i) {
330 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
331 return i.getOperand(4) != null;
332 }
333
334 /**
335 * Get the operand called Location from the
336 * argument instruction. Note that the returned operand
337 * will still point to its containing instruction.
338 * @param i the instruction to fetch the operand from
339 * @return the operand called Location
340 */
341 public static LocationOperand getLocation(Instruction i) {
342 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
343 return (LocationOperand) i.getOperand(5);
344 }
345 /**
346 * Get the operand called Location from the argument
347 * instruction clearing its instruction pointer. The returned
348 * operand will not point to any containing instruction.
349 * @param i the instruction to fetch the operand from
350 * @return the operand called Location
351 */
352 public static LocationOperand getClearLocation(Instruction i) {
353 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
354 return (LocationOperand) i.getClearOperand(5);
355 }
356 /**
357 * Set the operand called Location in the argument
358 * instruction to the argument operand. The operand will
359 * now point to the argument instruction as its containing
360 * instruction.
361 * @param i the instruction in which to store the operand
362 * @param Location the operand to store
363 */
364 public static void setLocation(Instruction i, LocationOperand Location) {
365 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
366 i.putOperand(5, Location);
367 }
368 /**
369 * Return the index of the operand called Location
370 * in the argument instruction.
371 * @param i the instruction to access.
372 * @return the index of the operand called Location
373 * in the argument instruction
374 */
375 public static int indexOfLocation(Instruction i) {
376 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
377 return 5;
378 }
379 /**
380 * Does the argument instruction have a non-null
381 * operand named Location?
382 * @param i the instruction to access.
383 * @return <code>true</code> if the instruction has an non-null
384 * operand named Location or <code>false</code>
385 * if it does not.
386 */
387 public static boolean hasLocation(Instruction i) {
388 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
389 return i.getOperand(5) != null;
390 }
391
392 /**
393 * Get the operand called Guard from the
394 * argument instruction. Note that the returned operand
395 * will still point to its containing instruction.
396 * @param i the instruction to fetch the operand from
397 * @return the operand called Guard
398 */
399 public static Operand getGuard(Instruction i) {
400 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
401 return (Operand) i.getOperand(6);
402 }
403 /**
404 * Get the operand called Guard from the argument
405 * instruction clearing its instruction pointer. The returned
406 * operand will not point to any containing instruction.
407 * @param i the instruction to fetch the operand from
408 * @return the operand called Guard
409 */
410 public static Operand getClearGuard(Instruction i) {
411 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
412 return (Operand) i.getClearOperand(6);
413 }
414 /**
415 * Set the operand called Guard in the argument
416 * instruction to the argument operand. The operand will
417 * now point to the argument instruction as its containing
418 * instruction.
419 * @param i the instruction in which to store the operand
420 * @param Guard the operand to store
421 */
422 public static void setGuard(Instruction i, Operand Guard) {
423 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
424 i.putOperand(6, Guard);
425 }
426 /**
427 * Return the index of the operand called Guard
428 * in the argument instruction.
429 * @param i the instruction to access.
430 * @return the index of the operand called Guard
431 * in the argument instruction
432 */
433 public static int indexOfGuard(Instruction i) {
434 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
435 return 6;
436 }
437 /**
438 * Does the argument instruction have a non-null
439 * operand named Guard?
440 * @param i the instruction to access.
441 * @return <code>true</code> if the instruction has an non-null
442 * operand named Guard or <code>false</code>
443 * if it does not.
444 */
445 public static boolean hasGuard(Instruction i) {
446 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Attempt");
447 return i.getOperand(6) != null;
448 }
449
450
451 /**
452 * Create an instruction of the Attempt instruction format.
453 * @param o the instruction's operator
454 * @param Result the instruction's Result operand
455 * @param Address the instruction's Address operand
456 * @param Offset the instruction's Offset operand
457 * @param OldValue the instruction's OldValue operand
458 * @param NewValue the instruction's NewValue operand
459 * @param Location the instruction's Location operand
460 * @param Guard the instruction's Guard operand
461 * @return the newly created Attempt instruction
462 */
463 public static Instruction create(Operator o
464 , RegisterOperand Result
465 , Operand Address
466 , Operand Offset
467 , Operand OldValue
468 , Operand NewValue
469 , LocationOperand Location
470 , Operand Guard
471 )
472 {
473 if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "Attempt");
474 Instruction i = new Instruction(o, 7);
475 i.putOperand(0, Result);
476 i.putOperand(1, Address);
477 i.putOperand(2, Offset);
478 i.putOperand(3, OldValue);
479 i.putOperand(4, NewValue);
480 i.putOperand(5, Location);
481 i.putOperand(6, Guard);
482 return i;
483 }
484
485 /**
486 * Mutate the argument instruction into an instruction of the
487 * Attempt instruction format having the specified
488 * operator and operands.
489 * @param i the instruction to mutate
490 * @param o the instruction's operator
491 * @param Result the instruction's Result operand
492 * @param Address the instruction's Address operand
493 * @param Offset the instruction's Offset operand
494 * @param OldValue the instruction's OldValue operand
495 * @param NewValue the instruction's NewValue operand
496 * @param Location the instruction's Location operand
497 * @param Guard the instruction's Guard operand
498 * @return the mutated instruction
499 */
500 public static Instruction mutate(Instruction i, Operator o
501 , RegisterOperand Result
502 , Operand Address
503 , Operand Offset
504 , Operand OldValue
505 , Operand NewValue
506 , LocationOperand Location
507 , Operand Guard
508 )
509 {
510 if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "Attempt");
511 i.resizeNumberOfOperands(7);
512
513 i.operator = o;
514 i.putOperand(0, Result);
515 i.putOperand(1, Address);
516 i.putOperand(2, Offset);
517 i.putOperand(3, OldValue);
518 i.putOperand(4, NewValue);
519 i.putOperand(5, Location);
520 i.putOperand(6, Guard);
521 return i;
522 }
523 /**
524 * Create an instruction of the Attempt instruction format.
525 * @param o the instruction's operator
526 * @param Result the instruction's Result operand
527 * @param Address the instruction's Address operand
528 * @param Offset the instruction's Offset operand
529 * @param OldValue the instruction's OldValue operand
530 * @param NewValue the instruction's NewValue operand
531 * @param Location the instruction's Location operand
532 * @return the newly created Attempt instruction
533 */
534 public static Instruction create(Operator o
535 , RegisterOperand Result
536 , Operand Address
537 , Operand Offset
538 , Operand OldValue
539 , Operand NewValue
540 , LocationOperand Location
541 )
542 {
543 if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "Attempt");
544 Instruction i = new Instruction(o, 7);
545 i.putOperand(0, Result);
546 i.putOperand(1, Address);
547 i.putOperand(2, Offset);
548 i.putOperand(3, OldValue);
549 i.putOperand(4, NewValue);
550 i.putOperand(5, Location);
551 return i;
552 }
553
554 /**
555 * Mutate the argument instruction into an instruction of the
556 * Attempt instruction format having the specified
557 * operator and operands.
558 * @param i the instruction to mutate
559 * @param o the instruction's operator
560 * @param Result the instruction's Result operand
561 * @param Address the instruction's Address operand
562 * @param Offset the instruction's Offset operand
563 * @param OldValue the instruction's OldValue operand
564 * @param NewValue the instruction's NewValue operand
565 * @param Location the instruction's Location operand
566 * @return the mutated instruction
567 */
568 public static Instruction mutate(Instruction i, Operator o
569 , RegisterOperand Result
570 , Operand Address
571 , Operand Offset
572 , Operand OldValue
573 , Operand NewValue
574 , LocationOperand Location
575 )
576 {
577 if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "Attempt");
578 i.resizeNumberOfOperands(7);
579
580 i.operator = o;
581 i.putOperand(0, Result);
582 i.putOperand(1, Address);
583 i.putOperand(2, Offset);
584 i.putOperand(3, OldValue);
585 i.putOperand(4, NewValue);
586 i.putOperand(5, Location);
587 i.putOperand(6, null);
588 return i;
589 }
590 }
591