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