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.ia32;
009
010import org.jikesrvm.Configuration;
011import org.jikesrvm.compilers.opt.ir.operand.ia32.IA32ConditionOperand;
012import org.jikesrvm.compilers.opt.ir.operand.*;
013import org.jikesrvm.compilers.opt.ir.Instruction;
014import org.jikesrvm.compilers.opt.ir.Operator;
015
016/**
017 * The MIR_Divide InstructionFormat class.
018 *
019 * The header comment for {@link Instruction} contains
020 * an explanation of the role of InstructionFormats in the
021 * opt compiler's IR.
022 */
023@SuppressWarnings("unused")  // Machine generated code is never 100% clean
024public final class MIR_Divide extends ArchInstructionFormat {
025  /**
026   * InstructionFormat identification method for MIR_Divide.
027   * @param i an instruction
028   * @return <code>true</code> if the InstructionFormat of the argument
029   *         instruction is MIR_Divide or <code>false</code>
030   *         if it is not.
031   */
032  public static boolean conforms(Instruction i) {
033    return conforms(i.operator());
034  }
035  /**
036   * InstructionFormat identification method for MIR_Divide.
037   * @param o an instruction
038   * @return <code>true</code> if the InstructionFormat of the argument
039   *         operator is MIR_Divide or <code>false</code>
040   *         if it is not.
041   */
042  public static boolean conforms(Operator o) {
043    return o.format == MIR_Divide_format;
044  }
045
046  /**
047   * Get the operand called Result1 from the
048   * argument instruction. Note that the returned operand
049   * will still point to its containing instruction.
050   * @param i the instruction to fetch the operand from
051   * @return the operand called Result1
052   */
053  public static Operand getResult1(Instruction i) {
054    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
055    return (Operand) i.getOperand(0);
056  }
057  /**
058   * Get the operand called Result1 from the argument
059   * instruction clearing its instruction pointer. The returned
060   * operand will not point to any containing instruction.
061   * @param i the instruction to fetch the operand from
062   * @return the operand called Result1
063   */
064  public static Operand getClearResult1(Instruction i) {
065    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
066    return (Operand) i.getClearOperand(0);
067  }
068  /**
069   * Set the operand called Result1 in the argument
070   * instruction to the argument operand. The operand will
071   * now point to the argument instruction as its containing
072   * instruction.
073   * @param i the instruction in which to store the operand
074   * @param Result1 the operand to store
075   */
076  public static void setResult1(Instruction i, Operand Result1) {
077    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
078    i.putOperand(0, Result1);
079  }
080  /**
081   * Return the index of the operand called Result1
082   * in the argument instruction.
083   * @param i the instruction to access.
084   * @return the index of the operand called Result1
085   *         in the argument instruction
086   */
087  public static int indexOfResult1(Instruction i) {
088    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
089    return 0;
090  }
091  /**
092   * Does the argument instruction have a non-null
093   * operand named Result1?
094   * @param i the instruction to access.
095   * @return <code>true</code> if the instruction has an non-null
096   *         operand named Result1 or <code>false</code>
097   *         if it does not.
098   */
099  public static boolean hasResult1(Instruction i) {
100    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
101    return i.getOperand(0) != null;
102  }
103
104  /**
105   * Get the operand called Result2 from the
106   * argument instruction. Note that the returned operand
107   * will still point to its containing instruction.
108   * @param i the instruction to fetch the operand from
109   * @return the operand called Result2
110   */
111  public static Operand getResult2(Instruction i) {
112    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
113    return (Operand) i.getOperand(1);
114  }
115  /**
116   * Get the operand called Result2 from the argument
117   * instruction clearing its instruction pointer. The returned
118   * operand will not point to any containing instruction.
119   * @param i the instruction to fetch the operand from
120   * @return the operand called Result2
121   */
122  public static Operand getClearResult2(Instruction i) {
123    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
124    return (Operand) i.getClearOperand(1);
125  }
126  /**
127   * Set the operand called Result2 in the argument
128   * instruction to the argument operand. The operand will
129   * now point to the argument instruction as its containing
130   * instruction.
131   * @param i the instruction in which to store the operand
132   * @param Result2 the operand to store
133   */
134  public static void setResult2(Instruction i, Operand Result2) {
135    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
136    i.putOperand(1, Result2);
137  }
138  /**
139   * Return the index of the operand called Result2
140   * in the argument instruction.
141   * @param i the instruction to access.
142   * @return the index of the operand called Result2
143   *         in the argument instruction
144   */
145  public static int indexOfResult2(Instruction i) {
146    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
147    return 1;
148  }
149  /**
150   * Does the argument instruction have a non-null
151   * operand named Result2?
152   * @param i the instruction to access.
153   * @return <code>true</code> if the instruction has an non-null
154   *         operand named Result2 or <code>false</code>
155   *         if it does not.
156   */
157  public static boolean hasResult2(Instruction i) {
158    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
159    return i.getOperand(1) != null;
160  }
161
162  /**
163   * Get the operand called Value from the
164   * argument instruction. Note that the returned operand
165   * will still point to its containing instruction.
166   * @param i the instruction to fetch the operand from
167   * @return the operand called Value
168   */
169  public static Operand getValue(Instruction i) {
170    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
171    return (Operand) i.getOperand(2);
172  }
173  /**
174   * Get the operand called Value from the argument
175   * instruction clearing its instruction pointer. The returned
176   * operand will not point to any containing instruction.
177   * @param i the instruction to fetch the operand from
178   * @return the operand called Value
179   */
180  public static Operand getClearValue(Instruction i) {
181    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
182    return (Operand) i.getClearOperand(2);
183  }
184  /**
185   * Set the operand called Value in the argument
186   * instruction to the argument operand. The operand will
187   * now point to the argument instruction as its containing
188   * instruction.
189   * @param i the instruction in which to store the operand
190   * @param Value the operand to store
191   */
192  public static void setValue(Instruction i, Operand Value) {
193    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
194    i.putOperand(2, Value);
195  }
196  /**
197   * Return the index of the operand called Value
198   * in the argument instruction.
199   * @param i the instruction to access.
200   * @return the index of the operand called Value
201   *         in the argument instruction
202   */
203  public static int indexOfValue(Instruction i) {
204    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
205    return 2;
206  }
207  /**
208   * Does the argument instruction have a non-null
209   * operand named Value?
210   * @param i the instruction to access.
211   * @return <code>true</code> if the instruction has an non-null
212   *         operand named Value or <code>false</code>
213   *         if it does not.
214   */
215  public static boolean hasValue(Instruction i) {
216    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
217    return i.getOperand(2) != null;
218  }
219
220  /**
221   * Get the operand called Guard from the
222   * argument instruction. Note that the returned operand
223   * will still point to its containing instruction.
224   * @param i the instruction to fetch the operand from
225   * @return the operand called Guard
226   */
227  public static Operand getGuard(Instruction i) {
228    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
229    return (Operand) i.getOperand(3);
230  }
231  /**
232   * Get the operand called Guard from the argument
233   * instruction clearing its instruction pointer. The returned
234   * operand will not point to any containing instruction.
235   * @param i the instruction to fetch the operand from
236   * @return the operand called Guard
237   */
238  public static Operand getClearGuard(Instruction i) {
239    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
240    return (Operand) i.getClearOperand(3);
241  }
242  /**
243   * Set the operand called Guard in the argument
244   * instruction to the argument operand. The operand will
245   * now point to the argument instruction as its containing
246   * instruction.
247   * @param i the instruction in which to store the operand
248   * @param Guard the operand to store
249   */
250  public static void setGuard(Instruction i, Operand Guard) {
251    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
252    i.putOperand(3, Guard);
253  }
254  /**
255   * Return the index of the operand called Guard
256   * in the argument instruction.
257   * @param i the instruction to access.
258   * @return the index of the operand called Guard
259   *         in the argument instruction
260   */
261  public static int indexOfGuard(Instruction i) {
262    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
263    return 3;
264  }
265  /**
266   * Does the argument instruction have a non-null
267   * operand named Guard?
268   * @param i the instruction to access.
269   * @return <code>true</code> if the instruction has an non-null
270   *         operand named Guard or <code>false</code>
271   *         if it does not.
272   */
273  public static boolean hasGuard(Instruction i) {
274    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide");
275    return i.getOperand(3) != null;
276  }
277
278
279  /**
280   * Create an instruction of the MIR_Divide instruction format.
281   * @param o the instruction's operator
282   * @param Result1 the instruction's Result1 operand
283   * @param Result2 the instruction's Result2 operand
284   * @param Value the instruction's Value operand
285   * @param Guard the instruction's Guard operand
286   * @return the newly created MIR_Divide instruction
287   */
288  public static Instruction create(Operator o
289                   , Operand Result1
290                   , Operand Result2
291                   , Operand Value
292                   , Operand Guard
293                )
294  {
295    if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "MIR_Divide");
296    Instruction i = Instruction.create(o, 5);
297    i.putOperand(0, Result1);
298    i.putOperand(1, Result2);
299    i.putOperand(2, Value);
300    i.putOperand(3, Guard);
301    return i;
302  }
303
304  /**
305   * Mutate the argument instruction into an instruction of the
306   * MIR_Divide instruction format having the specified
307   * operator and operands.
308   * @param i the instruction to mutate
309   * @param o the instruction's operator
310   * @param Result1 the instruction's Result1 operand
311   * @param Result2 the instruction's Result2 operand
312   * @param Value the instruction's Value operand
313   * @param Guard the instruction's Guard operand
314   * @return the mutated instruction
315   */
316  public static Instruction mutate(Instruction i, Operator o
317                   , Operand Result1
318                   , Operand Result2
319                   , Operand Value
320                   , Operand Guard
321                )
322  {
323    if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "MIR_Divide");
324    i.changeOperatorTo(o);
325    i.putOperand(0, Result1);
326    i.putOperand(1, Result2);
327    i.putOperand(2, Value);
328    i.putOperand(3, Guard);
329    return i;
330  }
331}
332