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