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