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_CompareExchange8B 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_CompareExchange8B extends ArchInstructionFormat {
025  /**
026   * InstructionFormat identification method for MIR_CompareExchange8B.
027   * @param i an instruction
028   * @return <code>true</code> if the InstructionFormat of the argument
029   *         instruction is MIR_CompareExchange8B 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_CompareExchange8B.
037   * @param o an instruction
038   * @return <code>true</code> if the InstructionFormat of the argument
039   *         operator is MIR_CompareExchange8B or <code>false</code>
040   *         if it is not.
041   */
042  public static boolean conforms(Operator o) {
043    return o.format == MIR_CompareExchange8B_format;
044  }
045
046  /**
047   * Get the operand called OldValueHigh 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 OldValueHigh
052   */
053  public static RegisterOperand getOldValueHigh(Instruction i) {
054    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
055    return (RegisterOperand) i.getOperand(0);
056  }
057  /**
058   * Get the operand called OldValueHigh 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 OldValueHigh
063   */
064  public static RegisterOperand getClearOldValueHigh(Instruction i) {
065    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
066    return (RegisterOperand) i.getClearOperand(0);
067  }
068  /**
069   * Set the operand called OldValueHigh 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 OldValueHigh the operand to store
075   */
076  public static void setOldValueHigh(Instruction i, RegisterOperand OldValueHigh) {
077    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
078    i.putOperand(0, OldValueHigh);
079  }
080  /**
081   * Return the index of the operand called OldValueHigh
082   * in the argument instruction.
083   * @param i the instruction to access.
084   * @return the index of the operand called OldValueHigh
085   *         in the argument instruction
086   */
087  public static int indexOfOldValueHigh(Instruction i) {
088    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
089    return 0;
090  }
091  /**
092   * Does the argument instruction have a non-null
093   * operand named OldValueHigh?
094   * @param i the instruction to access.
095   * @return <code>true</code> if the instruction has an non-null
096   *         operand named OldValueHigh or <code>false</code>
097   *         if it does not.
098   */
099  public static boolean hasOldValueHigh(Instruction i) {
100    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
101    return i.getOperand(0) != null;
102  }
103
104  /**
105   * Get the operand called OldValueLow 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 OldValueLow
110   */
111  public static RegisterOperand getOldValueLow(Instruction i) {
112    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
113    return (RegisterOperand) i.getOperand(1);
114  }
115  /**
116   * Get the operand called OldValueLow 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 OldValueLow
121   */
122  public static RegisterOperand getClearOldValueLow(Instruction i) {
123    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
124    return (RegisterOperand) i.getClearOperand(1);
125  }
126  /**
127   * Set the operand called OldValueLow 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 OldValueLow the operand to store
133   */
134  public static void setOldValueLow(Instruction i, RegisterOperand OldValueLow) {
135    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
136    i.putOperand(1, OldValueLow);
137  }
138  /**
139   * Return the index of the operand called OldValueLow
140   * in the argument instruction.
141   * @param i the instruction to access.
142   * @return the index of the operand called OldValueLow
143   *         in the argument instruction
144   */
145  public static int indexOfOldValueLow(Instruction i) {
146    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
147    return 1;
148  }
149  /**
150   * Does the argument instruction have a non-null
151   * operand named OldValueLow?
152   * @param i the instruction to access.
153   * @return <code>true</code> if the instruction has an non-null
154   *         operand named OldValueLow or <code>false</code>
155   *         if it does not.
156   */
157  public static boolean hasOldValueLow(Instruction i) {
158    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
159    return i.getOperand(1) != null;
160  }
161
162  /**
163   * Get the operand called MemAddr 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 MemAddr
168   */
169  public static MemoryOperand getMemAddr(Instruction i) {
170    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
171    return (MemoryOperand) i.getOperand(2);
172  }
173  /**
174   * Get the operand called MemAddr 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 MemAddr
179   */
180  public static MemoryOperand getClearMemAddr(Instruction i) {
181    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
182    return (MemoryOperand) i.getClearOperand(2);
183  }
184  /**
185   * Set the operand called MemAddr 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 MemAddr the operand to store
191   */
192  public static void setMemAddr(Instruction i, MemoryOperand MemAddr) {
193    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
194    i.putOperand(2, MemAddr);
195  }
196  /**
197   * Return the index of the operand called MemAddr
198   * in the argument instruction.
199   * @param i the instruction to access.
200   * @return the index of the operand called MemAddr
201   *         in the argument instruction
202   */
203  public static int indexOfMemAddr(Instruction i) {
204    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
205    return 2;
206  }
207  /**
208   * Does the argument instruction have a non-null
209   * operand named MemAddr?
210   * @param i the instruction to access.
211   * @return <code>true</code> if the instruction has an non-null
212   *         operand named MemAddr or <code>false</code>
213   *         if it does not.
214   */
215  public static boolean hasMemAddr(Instruction i) {
216    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
217    return i.getOperand(2) != null;
218  }
219
220  /**
221   * Get the operand called NewValueHigh 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 NewValueHigh
226   */
227  public static RegisterOperand getNewValueHigh(Instruction i) {
228    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
229    return (RegisterOperand) i.getOperand(3);
230  }
231  /**
232   * Get the operand called NewValueHigh 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 NewValueHigh
237   */
238  public static RegisterOperand getClearNewValueHigh(Instruction i) {
239    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
240    return (RegisterOperand) i.getClearOperand(3);
241  }
242  /**
243   * Set the operand called NewValueHigh 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 NewValueHigh the operand to store
249   */
250  public static void setNewValueHigh(Instruction i, RegisterOperand NewValueHigh) {
251    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
252    i.putOperand(3, NewValueHigh);
253  }
254  /**
255   * Return the index of the operand called NewValueHigh
256   * in the argument instruction.
257   * @param i the instruction to access.
258   * @return the index of the operand called NewValueHigh
259   *         in the argument instruction
260   */
261  public static int indexOfNewValueHigh(Instruction i) {
262    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
263    return 3;
264  }
265  /**
266   * Does the argument instruction have a non-null
267   * operand named NewValueHigh?
268   * @param i the instruction to access.
269   * @return <code>true</code> if the instruction has an non-null
270   *         operand named NewValueHigh or <code>false</code>
271   *         if it does not.
272   */
273  public static boolean hasNewValueHigh(Instruction i) {
274    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
275    return i.getOperand(3) != null;
276  }
277
278  /**
279   * Get the operand called NewValueLow from the
280   * argument instruction. Note that the returned operand
281   * will still point to its containing instruction.
282   * @param i the instruction to fetch the operand from
283   * @return the operand called NewValueLow
284   */
285  public static RegisterOperand getNewValueLow(Instruction i) {
286    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
287    return (RegisterOperand) i.getOperand(4);
288  }
289  /**
290   * Get the operand called NewValueLow from the argument
291   * instruction clearing its instruction pointer. The returned
292   * operand will not point to any containing instruction.
293   * @param i the instruction to fetch the operand from
294   * @return the operand called NewValueLow
295   */
296  public static RegisterOperand getClearNewValueLow(Instruction i) {
297    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
298    return (RegisterOperand) i.getClearOperand(4);
299  }
300  /**
301   * Set the operand called NewValueLow in the argument
302   * instruction to the argument operand. The operand will
303   * now point to the argument instruction as its containing
304   * instruction.
305   * @param i the instruction in which to store the operand
306   * @param NewValueLow the operand to store
307   */
308  public static void setNewValueLow(Instruction i, RegisterOperand NewValueLow) {
309    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
310    i.putOperand(4, NewValueLow);
311  }
312  /**
313   * Return the index of the operand called NewValueLow
314   * in the argument instruction.
315   * @param i the instruction to access.
316   * @return the index of the operand called NewValueLow
317   *         in the argument instruction
318   */
319  public static int indexOfNewValueLow(Instruction i) {
320    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
321    return 4;
322  }
323  /**
324   * Does the argument instruction have a non-null
325   * operand named NewValueLow?
326   * @param i the instruction to access.
327   * @return <code>true</code> if the instruction has an non-null
328   *         operand named NewValueLow or <code>false</code>
329   *         if it does not.
330   */
331  public static boolean hasNewValueLow(Instruction i) {
332    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CompareExchange8B");
333    return i.getOperand(4) != null;
334  }
335
336
337  /**
338   * Create an instruction of the MIR_CompareExchange8B instruction format.
339   * @param o the instruction's operator
340   * @param OldValueHigh the instruction's OldValueHigh operand
341   * @param OldValueLow the instruction's OldValueLow operand
342   * @param MemAddr the instruction's MemAddr operand
343   * @param NewValueHigh the instruction's NewValueHigh operand
344   * @param NewValueLow the instruction's NewValueLow operand
345   * @return the newly created MIR_CompareExchange8B instruction
346   */
347  public static Instruction create(Operator o
348                   , RegisterOperand OldValueHigh
349                   , RegisterOperand OldValueLow
350                   , MemoryOperand MemAddr
351                   , RegisterOperand NewValueHigh
352                   , RegisterOperand NewValueLow
353                )
354  {
355    if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "MIR_CompareExchange8B");
356    Instruction i = Instruction.create(o, 5);
357    i.putOperand(0, OldValueHigh);
358    i.putOperand(1, OldValueLow);
359    i.putOperand(2, MemAddr);
360    i.putOperand(3, NewValueHigh);
361    i.putOperand(4, NewValueLow);
362    return i;
363  }
364
365  /**
366   * Mutate the argument instruction into an instruction of the
367   * MIR_CompareExchange8B instruction format having the specified
368   * operator and operands.
369   * @param i the instruction to mutate
370   * @param o the instruction's operator
371   * @param OldValueHigh the instruction's OldValueHigh operand
372   * @param OldValueLow the instruction's OldValueLow operand
373   * @param MemAddr the instruction's MemAddr operand
374   * @param NewValueHigh the instruction's NewValueHigh operand
375   * @param NewValueLow the instruction's NewValueLow operand
376   * @return the mutated instruction
377   */
378  public static Instruction mutate(Instruction i, Operator o
379                   , RegisterOperand OldValueHigh
380                   , RegisterOperand OldValueLow
381                   , MemoryOperand MemAddr
382                   , RegisterOperand NewValueHigh
383                   , RegisterOperand NewValueLow
384                )
385  {
386    if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "MIR_CompareExchange8B");
387    i.changeOperatorTo(o);
388    i.putOperand(0, OldValueHigh);
389    i.putOperand(1, OldValueLow);
390    i.putOperand(2, MemAddr);
391    i.putOperand(3, NewValueHigh);
392    i.putOperand(4, NewValueLow);
393    return i;
394  }
395}
396