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_RotateAndMask 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_RotateAndMask extends ArchInstructionFormat {
026  /**
027   * InstructionFormat identification method for MIR_RotateAndMask.
028   * @param i an instruction
029   * @return <code>true</code> if the InstructionFormat of the argument
030   *         instruction is MIR_RotateAndMask 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_RotateAndMask.
038   * @param o an instruction
039   * @return <code>true</code> if the InstructionFormat of the argument
040   *         operator is MIR_RotateAndMask or <code>false</code>
041   *         if it is not.
042   */
043  public static boolean conforms(Operator o) {
044    return o.format == MIR_RotateAndMask_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_RotateAndMask");
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_RotateAndMask");
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_RotateAndMask");
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_RotateAndMask");
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_RotateAndMask");
102    return i.getOperand(0) != null;
103  }
104
105  /**
106   * Get the operand called Source 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 Source
111   */
112  public static RegisterOperand getSource(Instruction i) {
113    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
114    return (RegisterOperand) i.getOperand(1);
115  }
116  /**
117   * Get the operand called Source 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 Source
122   */
123  public static RegisterOperand getClearSource(Instruction i) {
124    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
125    return (RegisterOperand) i.getClearOperand(1);
126  }
127  /**
128   * Set the operand called Source 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 Source the operand to store
134   */
135  public static void setSource(Instruction i, RegisterOperand Source) {
136    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
137    i.putOperand(1, Source);
138  }
139  /**
140   * Return the index of the operand called Source
141   * in the argument instruction.
142   * @param i the instruction to access.
143   * @return the index of the operand called Source
144   *         in the argument instruction
145   */
146  public static int indexOfSource(Instruction i) {
147    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
148    return 1;
149  }
150  /**
151   * Does the argument instruction have a non-null
152   * operand named Source?
153   * @param i the instruction to access.
154   * @return <code>true</code> if the instruction has an non-null
155   *         operand named Source or <code>false</code>
156   *         if it does not.
157   */
158  public static boolean hasSource(Instruction i) {
159    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
160    return i.getOperand(1) != null;
161  }
162
163  /**
164   * Get the operand called Value 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 Value
169   */
170  public static RegisterOperand getValue(Instruction i) {
171    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
172    return (RegisterOperand) i.getOperand(2);
173  }
174  /**
175   * Get the operand called Value 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 Value
180   */
181  public static RegisterOperand getClearValue(Instruction i) {
182    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
183    return (RegisterOperand) i.getClearOperand(2);
184  }
185  /**
186   * Set the operand called Value 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 Value the operand to store
192   */
193  public static void setValue(Instruction i, RegisterOperand Value) {
194    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
195    i.putOperand(2, Value);
196  }
197  /**
198   * Return the index of the operand called Value
199   * in the argument instruction.
200   * @param i the instruction to access.
201   * @return the index of the operand called Value
202   *         in the argument instruction
203   */
204  public static int indexOfValue(Instruction i) {
205    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
206    return 2;
207  }
208  /**
209   * Does the argument instruction have a non-null
210   * operand named Value?
211   * @param i the instruction to access.
212   * @return <code>true</code> if the instruction has an non-null
213   *         operand named Value or <code>false</code>
214   *         if it does not.
215   */
216  public static boolean hasValue(Instruction i) {
217    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
218    return i.getOperand(2) != null;
219  }
220
221  /**
222   * Get the operand called Shift 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 Shift
227   */
228  public static Operand getShift(Instruction i) {
229    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
230    return (Operand) i.getOperand(3);
231  }
232  /**
233   * Get the operand called Shift 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 Shift
238   */
239  public static Operand getClearShift(Instruction i) {
240    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
241    return (Operand) i.getClearOperand(3);
242  }
243  /**
244   * Set the operand called Shift 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 Shift the operand to store
250   */
251  public static void setShift(Instruction i, Operand Shift) {
252    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
253    i.putOperand(3, Shift);
254  }
255  /**
256   * Return the index of the operand called Shift
257   * in the argument instruction.
258   * @param i the instruction to access.
259   * @return the index of the operand called Shift
260   *         in the argument instruction
261   */
262  public static int indexOfShift(Instruction i) {
263    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
264    return 3;
265  }
266  /**
267   * Does the argument instruction have a non-null
268   * operand named Shift?
269   * @param i the instruction to access.
270   * @return <code>true</code> if the instruction has an non-null
271   *         operand named Shift or <code>false</code>
272   *         if it does not.
273   */
274  public static boolean hasShift(Instruction i) {
275    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
276    return i.getOperand(3) != null;
277  }
278
279  /**
280   * Get the operand called MaskBegin 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 MaskBegin
285   */
286  public static IntConstantOperand getMaskBegin(Instruction i) {
287    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
288    return (IntConstantOperand) i.getOperand(4);
289  }
290  /**
291   * Get the operand called MaskBegin 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 MaskBegin
296   */
297  public static IntConstantOperand getClearMaskBegin(Instruction i) {
298    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
299    return (IntConstantOperand) i.getClearOperand(4);
300  }
301  /**
302   * Set the operand called MaskBegin 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 MaskBegin the operand to store
308   */
309  public static void setMaskBegin(Instruction i, IntConstantOperand MaskBegin) {
310    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
311    i.putOperand(4, MaskBegin);
312  }
313  /**
314   * Return the index of the operand called MaskBegin
315   * in the argument instruction.
316   * @param i the instruction to access.
317   * @return the index of the operand called MaskBegin
318   *         in the argument instruction
319   */
320  public static int indexOfMaskBegin(Instruction i) {
321    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
322    return 4;
323  }
324  /**
325   * Does the argument instruction have a non-null
326   * operand named MaskBegin?
327   * @param i the instruction to access.
328   * @return <code>true</code> if the instruction has an non-null
329   *         operand named MaskBegin or <code>false</code>
330   *         if it does not.
331   */
332  public static boolean hasMaskBegin(Instruction i) {
333    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
334    return i.getOperand(4) != null;
335  }
336
337  /**
338   * Get the operand called MaskEnd from the
339   * argument instruction. Note that the returned operand
340   * will still point to its containing instruction.
341   * @param i the instruction to fetch the operand from
342   * @return the operand called MaskEnd
343   */
344  public static IntConstantOperand getMaskEnd(Instruction i) {
345    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
346    return (IntConstantOperand) i.getOperand(5);
347  }
348  /**
349   * Get the operand called MaskEnd from the argument
350   * instruction clearing its instruction pointer. The returned
351   * operand will not point to any containing instruction.
352   * @param i the instruction to fetch the operand from
353   * @return the operand called MaskEnd
354   */
355  public static IntConstantOperand getClearMaskEnd(Instruction i) {
356    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
357    return (IntConstantOperand) i.getClearOperand(5);
358  }
359  /**
360   * Set the operand called MaskEnd in the argument
361   * instruction to the argument operand. The operand will
362   * now point to the argument instruction as its containing
363   * instruction.
364   * @param i the instruction in which to store the operand
365   * @param MaskEnd the operand to store
366   */
367  public static void setMaskEnd(Instruction i, IntConstantOperand MaskEnd) {
368    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
369    i.putOperand(5, MaskEnd);
370  }
371  /**
372   * Return the index of the operand called MaskEnd
373   * in the argument instruction.
374   * @param i the instruction to access.
375   * @return the index of the operand called MaskEnd
376   *         in the argument instruction
377   */
378  public static int indexOfMaskEnd(Instruction i) {
379    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
380    return 5;
381  }
382  /**
383   * Does the argument instruction have a non-null
384   * operand named MaskEnd?
385   * @param i the instruction to access.
386   * @return <code>true</code> if the instruction has an non-null
387   *         operand named MaskEnd or <code>false</code>
388   *         if it does not.
389   */
390  public static boolean hasMaskEnd(Instruction i) {
391    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RotateAndMask");
392    return i.getOperand(5) != null;
393  }
394
395
396  /**
397   * Create an instruction of the MIR_RotateAndMask instruction format.
398   * @param o the instruction's operator
399   * @param Result the instruction's Result operand
400   * @param Source the instruction's Source operand
401   * @param Value the instruction's Value operand
402   * @param Shift the instruction's Shift operand
403   * @param MaskBegin the instruction's MaskBegin operand
404   * @param MaskEnd the instruction's MaskEnd operand
405   * @return the newly created MIR_RotateAndMask instruction
406   */
407  public static Instruction create(Operator o
408                   , RegisterOperand Result
409                   , RegisterOperand Source
410                   , RegisterOperand Value
411                   , Operand Shift
412                   , IntConstantOperand MaskBegin
413                   , IntConstantOperand MaskEnd
414                )
415  {
416    if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "MIR_RotateAndMask");
417    Instruction i = Instruction.create(o, 6);
418    i.putOperand(0, Result);
419    i.putOperand(1, Source);
420    i.putOperand(2, Value);
421    i.putOperand(3, Shift);
422    i.putOperand(4, MaskBegin);
423    i.putOperand(5, MaskEnd);
424    return i;
425  }
426
427  /**
428   * Mutate the argument instruction into an instruction of the
429   * MIR_RotateAndMask instruction format having the specified
430   * operator and operands.
431   * @param i the instruction to mutate
432   * @param o the instruction's operator
433   * @param Result the instruction's Result operand
434   * @param Source the instruction's Source operand
435   * @param Value the instruction's Value operand
436   * @param Shift the instruction's Shift operand
437   * @param MaskBegin the instruction's MaskBegin operand
438   * @param MaskEnd the instruction's MaskEnd operand
439   * @return the mutated instruction
440   */
441  public static Instruction mutate(Instruction i, Operator o
442                   , RegisterOperand Result
443                   , RegisterOperand Source
444                   , RegisterOperand Value
445                   , Operand Shift
446                   , IntConstantOperand MaskBegin
447                   , IntConstantOperand MaskEnd
448                )
449  {
450    if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "MIR_RotateAndMask");
451    i.resizeNumberOfOperands(6);
452
453    i.changeOperatorTo(o);
454    i.putOperand(0, Result);
455    i.putOperand(1, Source);
456    i.putOperand(2, Value);
457    i.putOperand(3, Shift);
458    i.putOperand(4, MaskBegin);
459    i.putOperand(5, MaskEnd);
460    return i;
461  }
462  /**
463   * Create an instruction of the MIR_RotateAndMask instruction format.
464   * @param o the instruction's operator
465   * @param Result the instruction's Result operand
466   * @param Value the instruction's Value operand
467   * @param Shift the instruction's Shift operand
468   * @param MaskBegin the instruction's MaskBegin operand
469   * @param MaskEnd the instruction's MaskEnd operand
470   * @return the newly created MIR_RotateAndMask instruction
471   */
472  public static Instruction create(Operator o
473                   , RegisterOperand Result
474                   , RegisterOperand Value
475                   , Operand Shift
476                   , IntConstantOperand MaskBegin
477                   , IntConstantOperand MaskEnd
478                )
479  {
480    if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "MIR_RotateAndMask");
481    Instruction i = Instruction.create(o, 6);
482    i.putOperand(0, Result);
483    i.putOperand(2, Value);
484    i.putOperand(3, Shift);
485    i.putOperand(4, MaskBegin);
486    i.putOperand(5, MaskEnd);
487    return i;
488  }
489
490  /**
491   * Mutate the argument instruction into an instruction of the
492   * MIR_RotateAndMask instruction format having the specified
493   * operator and operands.
494   * @param i the instruction to mutate
495   * @param o the instruction's operator
496   * @param Result the instruction's Result operand
497   * @param Value the instruction's Value operand
498   * @param Shift the instruction's Shift operand
499   * @param MaskBegin the instruction's MaskBegin operand
500   * @param MaskEnd the instruction's MaskEnd operand
501   * @return the mutated instruction
502   */
503  public static Instruction mutate(Instruction i, Operator o
504                   , RegisterOperand Result
505                   , RegisterOperand Value
506                   , Operand Shift
507                   , IntConstantOperand MaskBegin
508                   , IntConstantOperand MaskEnd
509                )
510  {
511    if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "MIR_RotateAndMask");
512    i.resizeNumberOfOperands(6);
513
514    i.changeOperatorTo(o);
515    i.putOperand(0, Result);
516    i.putOperand(1, null);
517    i.putOperand(2, Value);
518    i.putOperand(3, Shift);
519    i.putOperand(4, MaskBegin);
520    i.putOperand(5, MaskEnd);
521    return i;
522  }
523}
524
525
526