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 OsrBarrier 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 OsrBarrier extends InstructionFormat { 023 /** 024 * InstructionFormat identification method for OsrBarrier. 025 * @param i an instruction 026 * @return <code>true</code> if the InstructionFormat of the argument 027 * instruction is OsrBarrier 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 OsrBarrier. 035 * @param o an instruction 036 * @return <code>true</code> if the InstructionFormat of the argument 037 * operator is OsrBarrier or <code>false</code> 038 * if it is not. 039 */ 040 public static boolean conforms(Operator o) { 041 return o.format == OsrBarrier_format; 042 } 043 044 /** 045 * Get the operand called TypeInfo 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 TypeInfo 050 */ 051 public static OsrTypeInfoOperand getTypeInfo(Instruction i) { 052 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "OsrBarrier"); 053 return (OsrTypeInfoOperand) i.getOperand(0); 054 } 055 /** 056 * Get the operand called TypeInfo 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 TypeInfo 061 */ 062 public static OsrTypeInfoOperand getClearTypeInfo(Instruction i) { 063 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "OsrBarrier"); 064 return (OsrTypeInfoOperand) i.getClearOperand(0); 065 } 066 /** 067 * Set the operand called TypeInfo 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 TypeInfo the operand to store 073 */ 074 public static void setTypeInfo(Instruction i, OsrTypeInfoOperand TypeInfo) { 075 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "OsrBarrier"); 076 i.putOperand(0, TypeInfo); 077 } 078 /** 079 * Return the index of the operand called TypeInfo 080 * in the argument instruction. 081 * @param i the instruction to access. 082 * @return the index of the operand called TypeInfo 083 * in the argument instruction 084 */ 085 public static int indexOfTypeInfo(Instruction i) { 086 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "OsrBarrier"); 087 return 0; 088 } 089 /** 090 * Does the argument instruction have a non-null 091 * operand named TypeInfo? 092 * @param i the instruction to access. 093 * @return <code>true</code> if the instruction has an non-null 094 * operand named TypeInfo or <code>false</code> 095 * if it does not. 096 */ 097 public static boolean hasTypeInfo(Instruction i) { 098 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "OsrBarrier"); 099 return i.getOperand(0) != null; 100 } 101 102 /** 103 * Get the k'th operand called Element from the 104 * argument instruction. Note that the returned operand 105 * will still point to its containing instruction. 106 * @param i the instruction to fetch the operand from 107 * @param k the index of the operand 108 * @return the k'th operand called Element 109 */ 110 public static Operand getElement(Instruction i, int k) { 111 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "OsrBarrier"); 112 return (Operand) i.getOperand(1+k); 113 } 114 /** 115 * Get the k'th operand called Element from the argument 116 * instruction clearing its instruction pointer. The returned 117 * operand will not point to any containing instruction. 118 * @param i the instruction to fetch the operand from 119 * @param k the index of the operand 120 * @return the k'th operand called Element 121 */ 122 public static Operand getClearElement(Instruction i, int k) { 123 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "OsrBarrier"); 124 return (Operand) i.getClearOperand(1+k); 125 } 126 /** 127 * Set the k'th operand called Element 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 k the index of the operand 133 * @param o the operand to store 134 */ 135 public static void setElement(Instruction i, int k, Operand o) { 136 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "OsrBarrier"); 137 i.putOperand(1+k, o); 138 } 139 /** 140 * Return the index of the k'th operand called Element 141 * in the argument instruction. 142 * @param i the instruction to access. 143 * @param k the index of the operand. 144 * @return the index of the k'th operand called Element 145 * in the argument instruction 146 */ 147 public static int indexOfElement(Instruction i, int k) { 148 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "OsrBarrier"); 149 return 1+k; 150 } 151 /** 152 * Does the argument instruction have a non-null 153 * k'th operand named Element? 154 * @param i the instruction to access. 155 * @param k the index of the operand. 156 * @return <code>true</code> if the instruction has an non-null 157 * k'th operand named Element or <code>false</code> 158 * if it does not. 159 */ 160 public static boolean hasElement(Instruction i, int k) { 161 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "OsrBarrier"); 162 return i.getOperand(1+k) != null; 163 } 164 165 /** 166 * Return the index of the first operand called Element 167 * in the argument instruction. 168 * @param i the instruction to access. 169 * @return the index of the first operand called Element 170 * in the argument instruction 171 */ 172 public static int indexOfElements(Instruction i) 173 { 174 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "OsrBarrier"); 175 return 1; 176 } 177 /** 178 * Does the argument instruction have any operands 179 * named Element? 180 * @param i the instruction to access. 181 * @return <code>true</code> if the instruction has operands 182 * named Element or <code>false</code> if it does not. 183 */ 184 public static boolean hasElements(Instruction i) 185 { 186 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "OsrBarrier"); 187 return i.getNumberOfOperands()-1 > 0 && i.getOperand(1) != null; 188 } 189 190 /** 191 * How many variable-length operands called Elements 192 * does the argument instruction have? 193 * @param i the instruction to access 194 * @return the number of operands called Elements the instruction has 195 */ 196 public static int getNumberOfElements(Instruction i) 197 { 198 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "OsrBarrier"); 199 return i.getNumberOfOperands()-1; 200 } 201 202 /** 203 * Change the number of Elements that may be stored in 204 * the argument instruction to numVarOps. 205 * @param i the instruction to access 206 * @param numVarOps the new number of variable operands called Elements 207 * that may be stored in the instruction 208 */ 209 public static void resizeNumberOfElements(Instruction i, int numVarOps) 210 { 211 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "OsrBarrier"); 212 if (1+numVarOps>MIN_OPERAND_ARRAY_LENGTH) 213 i.resizeNumberOfOperands(1+numVarOps); 214 else 215 for (int j = 1+numVarOps; j < MIN_OPERAND_ARRAY_LENGTH; j++) 216 i.putOperand(j, null); 217 } 218 219 /** 220 * Create an instruction of the OsrBarrier instruction format. 221 * @param o the instruction's operator 222 * @param TypeInfo the instruction's TypeInfo operand 223 * @param numVarOps the number of variable length operands that 224 * will be stored in the insruction. 225 * @return the newly created OsrBarrier instruction 226 */ 227 public static Instruction create(Operator o 228 , OsrTypeInfoOperand TypeInfo 229 , int numVarOps 230 ) 231 { 232 if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "OsrBarrier"); 233 Instruction i = new Instruction(o, Math.max(1+numVarOps, MIN_OPERAND_ARRAY_LENGTH)); 234 i.putOperand(0, TypeInfo); 235 return i; 236 } 237 238 /** 239 * Mutate the argument instruction into an instruction of the 240 * OsrBarrier instruction format having the specified 241 * operator and operands. 242 * @param i the instruction to mutate 243 * @param o the instruction's operator 244 * @param TypeInfo the instruction's TypeInfo operand 245 * @param numVarOps the number of variable length operands that 246 * will be stored in the insruction. 247 * @return the mutated instruction 248 */ 249 public static Instruction mutate(Instruction i, Operator o 250 , OsrTypeInfoOperand TypeInfo 251 , int numVarOps 252 ) 253 { 254 if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "OsrBarrier"); 255 if (1+numVarOps>MIN_OPERAND_ARRAY_LENGTH) 256 i.resizeNumberOfOperands(1+numVarOps); 257 258 i.operator = o; 259 i.putOperand(0, TypeInfo); 260 return i; 261 } 262 } 263