001    
002    /*
003     * THIS FILE IS MACHINE_GENERATED. DO NOT EDIT.
004     * See InstructionFormats.template, CommonOperands.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.*;
012    
013    /**
014     * InstructionFormats that have a GuardResult (which is RegisterOperand)
015     */
016    public final class GuardResultCarrier extends InstructionFormat {
017      private static final int[] _index = {
018               -1    // Unassigned
019               , -1    // Move
020               , -1    // Return
021               , -1    // Prologue
022               , -1    // InstrumentedCounter
023               , -1    // Empty
024               , -1    // Nullary
025               , -1    // New
026               , -1    // NewArray
027               , -1    // Multianewarray
028               , -1    // Athrow
029               , -1    // MonitorOp
030               , -1    // CacheOp
031               , 0    // NullCheck
032               , 0    // ZeroCheck
033               , 0    // BoundsCheck
034               , 0    // StoreCheck
035               , -1    // TypeCheck
036               , -1    // InstanceOf
037               , 0    // Trap
038               , 0    // TrapIf
039               , 0    // IfCmp
040               , 0    // IfCmp2
041               , -1    // InlineGuard
042               , -1    // BooleanCmp
043               , -1    // CondMove
044               , -1    // Goto
045               , -1    // Label
046               , -1    // BBend
047               , -1    // Unary
048               , -1    // GuardedUnary
049               , -1    // Binary
050               , -1    // GuardedBinary
051               , -1    // GuardedSet
052               , -1    // ALoad
053               , -1    // GetField
054               , -1    // GetStatic
055               , -1    // Load
056               , -1    // AStore
057               , -1    // PutField
058               , -1    // PutStatic
059               , -1    // Store
060               , -1    // Prepare
061               , -1    // Attempt
062               , -1    // Call
063               , -1    // TableSwitch
064               , -1    // LookupSwitch
065               , -1    // LowTableSwitch
066               , -1    // Phi
067               , -1    // OsrBarrier
068               , -1    // OsrPoint
069               , -1    // MIR_LowTableSwitch
070               , -1    // MIR_Move
071               , -1    // MIR_CondMove
072               , -1    // MIR_Lea
073               , -1    // MIR_BinaryAcc
074               , -1    // MIR_Divide
075               , -1    // MIR_Multiply
076               , -1    // MIR_ConvertDW2QW
077               , -1    // MIR_UnaryAcc
078               , -1    // MIR_Compare
079               , -1    // MIR_CompareExchange
080               , -1    // MIR_CompareExchange8B
081               , 0    // MIR_Trap
082               , 0    // MIR_TrapIf
083               , -1    // MIR_Branch
084               , -1    // MIR_CondBranch
085               , -1    // MIR_CondBranch2
086               , -1    // MIR_Call
087               , -1    // MIR_Empty
088               , -1    // MIR_Return
089               , -1    // MIR_Set
090               , -1    // MIR_Test
091               , -1    // MIR_Nullary
092               , -1    // MIR_UnaryNoRes
093               , -1    // MIR_Unary
094               , -1    // MIR_XChng
095               , -1    // MIR_DoubleShift
096               , -1    // MIR_CaseLabel
097               , -1    // MIR_FSave
098               , -1    // MIR_RDTSC
099               , -1    // MIR_CacheOp
100            };
101    
102      /**
103       * Does the instruction belong to an instruction format that
104       * has an operand called GuardResult?
105       * @param i the instruction to test
106       * @return <code>true</code> if the instruction's instruction
107       *         format has an operand called GuardResult and
108       *         <code>false</code> if it does not.
109       */
110      public static boolean conforms(Instruction i) {
111        return conforms(i.operator);
112      }
113      /**
114       * Does the operator belong to an instruction format that
115       * has an operand called GuardResult?
116       * @param o the operator to test
117       * @return <code>true</code> if the instruction's instruction
118       *         format has an operand called GuardResult and
119       *         <code>false</code> if it does not.
120       */
121      public static boolean conforms(Operator o) {
122        return _index[o.format] != -1;
123      }
124    
125      /**
126       * Get the operand called GuardResult from the
127       * argument instruction. Note that the returned operand
128       * will still point to its containing instruction.
129       * @param i the instruction to fetch the operand from
130       * @return the operand called GuardResult
131       */
132      public static RegisterOperand getGuardResult(Instruction i) {
133        if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "GuardResultCarrier");
134        int index = _index[i.operator.format];
135        return (RegisterOperand) i.getOperand(index);
136      }
137      /**
138       * Get the operand called GuardResult from the argument
139       * instruction clearing its instruction pointer. The returned
140       * operand will not point to any containing instruction.
141       * @param i the instruction to fetch the operand from
142       * @return the operand called GuardResult
143       */
144      public static RegisterOperand getClearGuardResult(Instruction i) {
145        if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "GuardResultCarrier");
146        int index = _index[i.operator.format];
147        return (RegisterOperand) i.getClearOperand(index);
148      }
149      /**
150       * Set the operand called GuardResult in the argument
151       * instruction to the argument operand. The operand will
152       * now point to the argument instruction as its containing
153       * instruction.
154       * @param i the instruction in which to store the operand
155       * @param op the operand to store
156       */
157      public static void setGuardResult(Instruction i, RegisterOperand op) {
158        if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "GuardResultCarrier");
159        int index = _index[i.operator.format];
160        i.putOperand(index, op);
161      }
162      /**
163       * Return the index of the operand called GuardResult
164       * in the argument instruction.
165       * @param i the instruction to access.
166       * @return the index of the operand called GuardResult
167       *         in the argument instruction
168       */
169      public static int indexOfGuardResult(Instruction i) {
170        if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "GuardResultCarrier");
171        return _index[i.operator.format];
172      }
173      /**
174       * Does the argument instruction have a non-null
175       * operand named GuardResult?
176       * @param i the instruction to access.
177       * @return <code>true</code> if the instruction has an non-null
178       *         operand named GuardResult or <code>false</code>
179       *         if it does not.
180       */
181      public static boolean hasGuardResult(Instruction i) {
182        if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "GuardResultCarrier");
183        int index = _index[i.operator.format];
184        return i.getOperand(index) != null;
185      }
186    }
187