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 Result (which is RegisterOperand) 015 */ 016 public final class ResultCarrier extends InstructionFormat { 017 private static final int[] _index = { 018 -1 // Unassigned 019 , 0 // Move 020 , -1 // Return 021 , -1 // Prologue 022 , -1 // InstrumentedCounter 023 , -1 // Empty 024 , 0 // Nullary 025 , 0 // New 026 , 0 // NewArray 027 , 0 // Multianewarray 028 , -1 // Athrow 029 , -1 // MonitorOp 030 , -1 // CacheOp 031 , -1 // NullCheck 032 , -1 // ZeroCheck 033 , -1 // BoundsCheck 034 , -1 // StoreCheck 035 , 0 // TypeCheck 036 , 0 // InstanceOf 037 , -1 // Trap 038 , -1 // TrapIf 039 , -1 // IfCmp 040 , -1 // IfCmp2 041 , -1 // InlineGuard 042 , 0 // BooleanCmp 043 , 0 // CondMove 044 , -1 // Goto 045 , -1 // Label 046 , -1 // BBend 047 , 0 // Unary 048 , 0 // GuardedUnary 049 , 0 // Binary 050 , 0 // GuardedBinary 051 , -1 // GuardedSet 052 , 0 // ALoad 053 , 0 // GetField 054 , 0 // GetStatic 055 , 0 // Load 056 , -1 // AStore 057 , -1 // PutField 058 , -1 // PutStatic 059 , -1 // Store 060 , 0 // Prepare 061 , 0 // Attempt 062 , 0 // 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 , 0 // 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 , -1 // MIR_Trap 082 , -1 // MIR_TrapIf 083 , -1 // MIR_Branch 084 , -1 // MIR_CondBranch 085 , -1 // MIR_CondBranch2 086 , 0 // 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 Result? 105 * @param i the instruction to test 106 * @return <code>true</code> if the instruction's instruction 107 * format has an operand called Result 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 Result? 116 * @param o the operator to test 117 * @return <code>true</code> if the instruction's instruction 118 * format has an operand called Result 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 Result 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 Result 131 */ 132 public static RegisterOperand getResult(Instruction i) { 133 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "ResultCarrier"); 134 int index = _index[i.operator.format]; 135 return (RegisterOperand) i.getOperand(index); 136 } 137 /** 138 * Get the operand called Result 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 Result 143 */ 144 public static RegisterOperand getClearResult(Instruction i) { 145 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "ResultCarrier"); 146 int index = _index[i.operator.format]; 147 return (RegisterOperand) i.getClearOperand(index); 148 } 149 /** 150 * Set the operand called Result 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 setResult(Instruction i, RegisterOperand op) { 158 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "ResultCarrier"); 159 int index = _index[i.operator.format]; 160 i.putOperand(index, op); 161 } 162 /** 163 * Return the index of the operand called Result 164 * in the argument instruction. 165 * @param i the instruction to access. 166 * @return the index of the operand called Result 167 * in the argument instruction 168 */ 169 public static int indexOfResult(Instruction i) { 170 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "ResultCarrier"); 171 return _index[i.operator.format]; 172 } 173 /** 174 * Does the argument instruction have a non-null 175 * operand named Result? 176 * @param i the instruction to access. 177 * @return <code>true</code> if the instruction has an non-null 178 * operand named Result or <code>false</code> 179 * if it does not. 180 */ 181 public static boolean hasResult(Instruction i) { 182 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "ResultCarrier"); 183 int index = _index[i.operator.format]; 184 return i.getOperand(index) != null; 185 } 186 } 187