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 BBend 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 BBend extends InstructionFormat {
022  /**
023   * InstructionFormat identification method for BBend.
024   * @param i an instruction
025   * @return <code>true</code> if the InstructionFormat of the argument
026   *         instruction is BBend 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 BBend.
034   * @param o an instruction
035   * @return <code>true</code> if the InstructionFormat of the argument
036   *         operator is BBend or <code>false</code>
037   *         if it is not.
038   */
039  public static boolean conforms(Operator o) {
040    return o.format == BBend_format;
041  }
042
043  /**
044   * Get the operand called Block 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 Block
049   */
050  public static BasicBlockOperand getBlock(Instruction i) {
051    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "BBend");
052    return (BasicBlockOperand) i.getOperand(0);
053  }
054  /**
055   * Get the operand called Block 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 Block
060   */
061  public static BasicBlockOperand getClearBlock(Instruction i) {
062    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "BBend");
063    return (BasicBlockOperand) i.getClearOperand(0);
064  }
065  /**
066   * Set the operand called Block 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 Block the operand to store
072   */
073  public static void setBlock(Instruction i, BasicBlockOperand Block) {
074    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "BBend");
075    i.putOperand(0, Block);
076  }
077  /**
078   * Return the index of the operand called Block
079   * in the argument instruction.
080   * @param i the instruction to access.
081   * @return the index of the operand called Block
082   *         in the argument instruction
083   */
084  public static int indexOfBlock(Instruction i) {
085    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "BBend");
086    return 0;
087  }
088  /**
089   * Does the argument instruction have a non-null
090   * operand named Block?
091   * @param i the instruction to access.
092   * @return <code>true</code> if the instruction has an non-null
093   *         operand named Block or <code>false</code>
094   *         if it does not.
095   */
096  public static boolean hasBlock(Instruction i) {
097    if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "BBend");
098    return i.getOperand(0) != null;
099  }
100
101
102  /**
103   * Create an instruction of the BBend instruction format.
104   * @param o the instruction's operator
105   * @param Block the instruction's Block operand
106   * @return the newly created BBend instruction
107   */
108  public static Instruction create(Operator o
109                   , BasicBlockOperand Block
110                )
111  {
112    if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "BBend");
113    Instruction i = Instruction.create(o, 5);
114    i.putOperand(0, Block);
115    return i;
116  }
117
118  /**
119   * Mutate the argument instruction into an instruction of the
120   * BBend instruction format having the specified
121   * operator and operands.
122   * @param i the instruction to mutate
123   * @param o the instruction's operator
124   * @param Block the instruction's Block operand
125   * @return the mutated instruction
126   */
127  public static Instruction mutate(Instruction i, Operator o
128                   , BasicBlockOperand Block
129                )
130  {
131    if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "BBend");
132    i.changeOperatorTo(o);
133    i.putOperand(0, Block);
134    return i;
135  }
136}
137