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