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;
009
010import org.jikesrvm.Configuration;
011import org.jikesrvm.compilers.opt.ir.operand.*;
012
013/**
014 * The Store InstructionFormat class.
015 *
016 * The header comment for {@link Instruction} contains
017 * an explanation of the role of InstructionFormats in the
018 * opt compiler's IR.
019 */
020@SuppressWarnings("unused")  // Machine generated code is never 100% clean
021public final class Store extends InstructionFormat {
022  /**
023   * InstructionFormat identification method for Store.
024   * @param i an instruction
025   * @return <code>true</code> if the InstructionFormat of the argument
026   *         instruction is Store or <code>false</code>
027   *         if it is not.
028   */
029  public static boolean conforms(Instruction i) {
030    return conforms(i.operator());
031  }
032  /**
033   * InstructionFormat identification method for Store.
034   * @param o an instruction
035   * @return <code>true</code> if the InstructionFormat of the argument
036   *         operator is Store or <code>false</code>
037   *         if it is not.
038   */
039  public static boolean conforms(Operator o) {
040    return o.format == Store_format;
041  }
042
043  /**
044   * Get the operand called Value from the
045   * argument instruction. Note that the returned operand
046   * will still point to its containing instruction.
047   * @param i the instruction to fetch the operand from
048   * @return the operand called Value
049   */
050  public static Operand getValue(Instruction i) {
051    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
052    return (Operand) i.getOperand(0);
053  }
054  /**
055   * Get the operand called Value from the argument
056   * instruction clearing its instruction pointer. The returned
057   * operand will not point to any containing instruction.
058   * @param i the instruction to fetch the operand from
059   * @return the operand called Value
060   */
061  public static Operand getClearValue(Instruction i) {
062    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
063    return (Operand) i.getClearOperand(0);
064  }
065  /**
066   * Set the operand called Value in the argument
067   * instruction to the argument operand. The operand will
068   * now point to the argument instruction as its containing
069   * instruction.
070   * @param i the instruction in which to store the operand
071   * @param Value the operand to store
072   */
073  public static void setValue(Instruction i, Operand Value) {
074    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
075    i.putOperand(0, Value);
076  }
077  /**
078   * Return the index of the operand called Value
079   * in the argument instruction.
080   * @param i the instruction to access.
081   * @return the index of the operand called Value
082   *         in the argument instruction
083   */
084  public static int indexOfValue(Instruction i) {
085    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
086    return 0;
087  }
088  /**
089   * Does the argument instruction have a non-null
090   * operand named Value?
091   * @param i the instruction to access.
092   * @return <code>true</code> if the instruction has an non-null
093   *         operand named Value or <code>false</code>
094   *         if it does not.
095   */
096  public static boolean hasValue(Instruction i) {
097    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
098    return i.getOperand(0) != null;
099  }
100
101  /**
102   * Get the operand called Address from the
103   * argument instruction. Note that the returned operand
104   * will still point to its containing instruction.
105   * @param i the instruction to fetch the operand from
106   * @return the operand called Address
107   */
108  public static Operand getAddress(Instruction i) {
109    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
110    return (Operand) i.getOperand(1);
111  }
112  /**
113   * Get the operand called Address from the argument
114   * instruction clearing its instruction pointer. The returned
115   * operand will not point to any containing instruction.
116   * @param i the instruction to fetch the operand from
117   * @return the operand called Address
118   */
119  public static Operand getClearAddress(Instruction i) {
120    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
121    return (Operand) i.getClearOperand(1);
122  }
123  /**
124   * Set the operand called Address in the argument
125   * instruction to the argument operand. The operand will
126   * now point to the argument instruction as its containing
127   * instruction.
128   * @param i the instruction in which to store the operand
129   * @param Address the operand to store
130   */
131  public static void setAddress(Instruction i, Operand Address) {
132    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
133    i.putOperand(1, Address);
134  }
135  /**
136   * Return the index of the operand called Address
137   * in the argument instruction.
138   * @param i the instruction to access.
139   * @return the index of the operand called Address
140   *         in the argument instruction
141   */
142  public static int indexOfAddress(Instruction i) {
143    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
144    return 1;
145  }
146  /**
147   * Does the argument instruction have a non-null
148   * operand named Address?
149   * @param i the instruction to access.
150   * @return <code>true</code> if the instruction has an non-null
151   *         operand named Address or <code>false</code>
152   *         if it does not.
153   */
154  public static boolean hasAddress(Instruction i) {
155    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
156    return i.getOperand(1) != null;
157  }
158
159  /**
160   * Get the operand called Offset from the
161   * argument instruction. Note that the returned operand
162   * will still point to its containing instruction.
163   * @param i the instruction to fetch the operand from
164   * @return the operand called Offset
165   */
166  public static Operand getOffset(Instruction i) {
167    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
168    return (Operand) i.getOperand(2);
169  }
170  /**
171   * Get the operand called Offset from the argument
172   * instruction clearing its instruction pointer. The returned
173   * operand will not point to any containing instruction.
174   * @param i the instruction to fetch the operand from
175   * @return the operand called Offset
176   */
177  public static Operand getClearOffset(Instruction i) {
178    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
179    return (Operand) i.getClearOperand(2);
180  }
181  /**
182   * Set the operand called Offset in the argument
183   * instruction to the argument operand. The operand will
184   * now point to the argument instruction as its containing
185   * instruction.
186   * @param i the instruction in which to store the operand
187   * @param Offset the operand to store
188   */
189  public static void setOffset(Instruction i, Operand Offset) {
190    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
191    i.putOperand(2, Offset);
192  }
193  /**
194   * Return the index of the operand called Offset
195   * in the argument instruction.
196   * @param i the instruction to access.
197   * @return the index of the operand called Offset
198   *         in the argument instruction
199   */
200  public static int indexOfOffset(Instruction i) {
201    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
202    return 2;
203  }
204  /**
205   * Does the argument instruction have a non-null
206   * operand named Offset?
207   * @param i the instruction to access.
208   * @return <code>true</code> if the instruction has an non-null
209   *         operand named Offset or <code>false</code>
210   *         if it does not.
211   */
212  public static boolean hasOffset(Instruction i) {
213    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
214    return i.getOperand(2) != null;
215  }
216
217  /**
218   * Get the operand called Location from the
219   * argument instruction. Note that the returned operand
220   * will still point to its containing instruction.
221   * @param i the instruction to fetch the operand from
222   * @return the operand called Location
223   */
224  public static LocationOperand getLocation(Instruction i) {
225    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
226    return (LocationOperand) i.getOperand(3);
227  }
228  /**
229   * Get the operand called Location from the argument
230   * instruction clearing its instruction pointer. The returned
231   * operand will not point to any containing instruction.
232   * @param i the instruction to fetch the operand from
233   * @return the operand called Location
234   */
235  public static LocationOperand getClearLocation(Instruction i) {
236    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
237    return (LocationOperand) i.getClearOperand(3);
238  }
239  /**
240   * Set the operand called Location in the argument
241   * instruction to the argument operand. The operand will
242   * now point to the argument instruction as its containing
243   * instruction.
244   * @param i the instruction in which to store the operand
245   * @param Location the operand to store
246   */
247  public static void setLocation(Instruction i, LocationOperand Location) {
248    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
249    i.putOperand(3, Location);
250  }
251  /**
252   * Return the index of the operand called Location
253   * in the argument instruction.
254   * @param i the instruction to access.
255   * @return the index of the operand called Location
256   *         in the argument instruction
257   */
258  public static int indexOfLocation(Instruction i) {
259    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
260    return 3;
261  }
262  /**
263   * Does the argument instruction have a non-null
264   * operand named Location?
265   * @param i the instruction to access.
266   * @return <code>true</code> if the instruction has an non-null
267   *         operand named Location or <code>false</code>
268   *         if it does not.
269   */
270  public static boolean hasLocation(Instruction i) {
271    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
272    return i.getOperand(3) != null;
273  }
274
275  /**
276   * Get the operand called Guard from the
277   * argument instruction. Note that the returned operand
278   * will still point to its containing instruction.
279   * @param i the instruction to fetch the operand from
280   * @return the operand called Guard
281   */
282  public static Operand getGuard(Instruction i) {
283    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
284    return (Operand) i.getOperand(4);
285  }
286  /**
287   * Get the operand called Guard from the argument
288   * instruction clearing its instruction pointer. The returned
289   * operand will not point to any containing instruction.
290   * @param i the instruction to fetch the operand from
291   * @return the operand called Guard
292   */
293  public static Operand getClearGuard(Instruction i) {
294    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
295    return (Operand) i.getClearOperand(4);
296  }
297  /**
298   * Set the operand called Guard in the argument
299   * instruction to the argument operand. The operand will
300   * now point to the argument instruction as its containing
301   * instruction.
302   * @param i the instruction in which to store the operand
303   * @param Guard the operand to store
304   */
305  public static void setGuard(Instruction i, Operand Guard) {
306    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
307    i.putOperand(4, Guard);
308  }
309  /**
310   * Return the index of the operand called Guard
311   * in the argument instruction.
312   * @param i the instruction to access.
313   * @return the index of the operand called Guard
314   *         in the argument instruction
315   */
316  public static int indexOfGuard(Instruction i) {
317    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
318    return 4;
319  }
320  /**
321   * Does the argument instruction have a non-null
322   * operand named Guard?
323   * @param i the instruction to access.
324   * @return <code>true</code> if the instruction has an non-null
325   *         operand named Guard or <code>false</code>
326   *         if it does not.
327   */
328  public static boolean hasGuard(Instruction i) {
329    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "Store");
330    return i.getOperand(4) != null;
331  }
332
333
334  /**
335   * Create an instruction of the Store instruction format.
336   * @param o the instruction's operator
337   * @param Value the instruction's Value operand
338   * @param Address the instruction's Address operand
339   * @param Offset the instruction's Offset operand
340   * @param Location the instruction's Location operand
341   * @param Guard the instruction's Guard operand
342   * @return the newly created Store instruction
343   */
344  public static Instruction create(Operator o
345                   , Operand Value
346                   , Operand Address
347                   , Operand Offset
348                   , LocationOperand Location
349                   , Operand Guard
350                )
351  {
352    if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "Store");
353    Instruction i = Instruction.create(o, 5);
354    i.putOperand(0, Value);
355    i.putOperand(1, Address);
356    i.putOperand(2, Offset);
357    i.putOperand(3, Location);
358    i.putOperand(4, Guard);
359    return i;
360  }
361
362  /**
363   * Mutate the argument instruction into an instruction of the
364   * Store instruction format having the specified
365   * operator and operands.
366   * @param i the instruction to mutate
367   * @param o the instruction's operator
368   * @param Value the instruction's Value operand
369   * @param Address the instruction's Address operand
370   * @param Offset the instruction's Offset operand
371   * @param Location the instruction's Location operand
372   * @param Guard the instruction's Guard operand
373   * @return the mutated instruction
374   */
375  public static Instruction mutate(Instruction i, Operator o
376                   , Operand Value
377                   , Operand Address
378                   , Operand Offset
379                   , LocationOperand Location
380                   , Operand Guard
381                )
382  {
383    if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "Store");
384    i.changeOperatorTo(o);
385    i.putOperand(0, Value);
386    i.putOperand(1, Address);
387    i.putOperand(2, Offset);
388    i.putOperand(3, Location);
389    i.putOperand(4, Guard);
390    return i;
391  }
392  /**
393   * Create an instruction of the Store instruction format.
394   * @param o the instruction's operator
395   * @param Value the instruction's Value operand
396   * @param Address the instruction's Address operand
397   * @param Offset the instruction's Offset operand
398   * @param Location the instruction's Location operand
399   * @return the newly created Store instruction
400   */
401  public static Instruction create(Operator o
402                   , Operand Value
403                   , Operand Address
404                   , Operand Offset
405                   , LocationOperand Location
406                )
407  {
408    if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "Store");
409    Instruction i = Instruction.create(o, 5);
410    i.putOperand(0, Value);
411    i.putOperand(1, Address);
412    i.putOperand(2, Offset);
413    i.putOperand(3, Location);
414    return i;
415  }
416
417  /**
418   * Mutate the argument instruction into an instruction of the
419   * Store instruction format having the specified
420   * operator and operands.
421   * @param i the instruction to mutate
422   * @param o the instruction's operator
423   * @param Value the instruction's Value operand
424   * @param Address the instruction's Address operand
425   * @param Offset the instruction's Offset operand
426   * @param Location the instruction's Location operand
427   * @return the mutated instruction
428   */
429  public static Instruction mutate(Instruction i, Operator o
430                   , Operand Value
431                   , Operand Address
432                   , Operand Offset
433                   , LocationOperand Location
434                )
435  {
436    if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "Store");
437    i.changeOperatorTo(o);
438    i.putOperand(0, Value);
439    i.putOperand(1, Address);
440    i.putOperand(2, Offset);
441    i.putOperand(3, Location);
442    i.putOperand(4, null);
443    return i;
444  }
445}
446