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_CacheOp 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_CacheOp extends ArchInstructionFormat {
026  /**
027   * InstructionFormat identification method for MIR_CacheOp.
028   * @param i an instruction
029   * @return <code>true</code> if the InstructionFormat of the argument
030   *         instruction is MIR_CacheOp 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_CacheOp.
038   * @param o an instruction
039   * @return <code>true</code> if the InstructionFormat of the argument
040   *         operator is MIR_CacheOp or <code>false</code>
041   *         if it is not.
042   */
043  public static boolean conforms(Operator o) {
044    return o.format == MIR_CacheOp_format;
045  }
046
047  /**
048   * Get the operand called Address 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 Address
053   */
054  public static RegisterOperand getAddress(Instruction i) {
055    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CacheOp");
056    return (RegisterOperand) i.getOperand(0);
057  }
058  /**
059   * Get the operand called Address 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 Address
064   */
065  public static RegisterOperand getClearAddress(Instruction i) {
066    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CacheOp");
067    return (RegisterOperand) i.getClearOperand(0);
068  }
069  /**
070   * Set the operand called Address 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 Address the operand to store
076   */
077  public static void setAddress(Instruction i, RegisterOperand Address) {
078    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CacheOp");
079    i.putOperand(0, Address);
080  }
081  /**
082   * Return the index of the operand called Address
083   * in the argument instruction.
084   * @param i the instruction to access.
085   * @return the index of the operand called Address
086   *         in the argument instruction
087   */
088  public static int indexOfAddress(Instruction i) {
089    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CacheOp");
090    return 0;
091  }
092  /**
093   * Does the argument instruction have a non-null
094   * operand named Address?
095   * @param i the instruction to access.
096   * @return <code>true</code> if the instruction has an non-null
097   *         operand named Address or <code>false</code>
098   *         if it does not.
099   */
100  public static boolean hasAddress(Instruction i) {
101    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CacheOp");
102    return i.getOperand(0) != null;
103  }
104
105  /**
106   * Get the operand called Offset 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 Offset
111   */
112  public static RegisterOperand getOffset(Instruction i) {
113    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CacheOp");
114    return (RegisterOperand) i.getOperand(1);
115  }
116  /**
117   * Get the operand called Offset 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 Offset
122   */
123  public static RegisterOperand getClearOffset(Instruction i) {
124    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CacheOp");
125    return (RegisterOperand) i.getClearOperand(1);
126  }
127  /**
128   * Set the operand called Offset 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 Offset the operand to store
134   */
135  public static void setOffset(Instruction i, RegisterOperand Offset) {
136    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CacheOp");
137    i.putOperand(1, Offset);
138  }
139  /**
140   * Return the index of the operand called Offset
141   * in the argument instruction.
142   * @param i the instruction to access.
143   * @return the index of the operand called Offset
144   *         in the argument instruction
145   */
146  public static int indexOfOffset(Instruction i) {
147    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CacheOp");
148    return 1;
149  }
150  /**
151   * Does the argument instruction have a non-null
152   * operand named Offset?
153   * @param i the instruction to access.
154   * @return <code>true</code> if the instruction has an non-null
155   *         operand named Offset or <code>false</code>
156   *         if it does not.
157   */
158  public static boolean hasOffset(Instruction i) {
159    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CacheOp");
160    return i.getOperand(1) != null;
161  }
162
163
164  /**
165   * Create an instruction of the MIR_CacheOp instruction format.
166   * @param o the instruction's operator
167   * @param Address the instruction's Address operand
168   * @param Offset the instruction's Offset operand
169   * @return the newly created MIR_CacheOp instruction
170   */
171  public static Instruction create(Operator o
172                   , RegisterOperand Address
173                   , RegisterOperand Offset
174                )
175  {
176    if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "MIR_CacheOp");
177    Instruction i = Instruction.create(o, 5);
178    i.putOperand(0, Address);
179    i.putOperand(1, Offset);
180    return i;
181  }
182
183  /**
184   * Mutate the argument instruction into an instruction of the
185   * MIR_CacheOp instruction format having the specified
186   * operator and operands.
187   * @param i the instruction to mutate
188   * @param o the instruction's operator
189   * @param Address the instruction's Address operand
190   * @param Offset the instruction's Offset operand
191   * @return the mutated instruction
192   */
193  public static Instruction mutate(Instruction i, Operator o
194                   , RegisterOperand Address
195                   , RegisterOperand Offset
196                )
197  {
198    if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "MIR_CacheOp");
199    i.changeOperatorTo(o);
200    i.putOperand(0, Address);
201    i.putOperand(1, Offset);
202    return i;
203  }
204}
205