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 MIR_Divide 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 MIR_Divide extends InstructionFormat { 023 /** 024 * InstructionFormat identification method for MIR_Divide. 025 * @param i an instruction 026 * @return <code>true</code> if the InstructionFormat of the argument 027 * instruction is MIR_Divide 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 MIR_Divide. 035 * @param o an instruction 036 * @return <code>true</code> if the InstructionFormat of the argument 037 * operator is MIR_Divide or <code>false</code> 038 * if it is not. 039 */ 040 public static boolean conforms(Operator o) { 041 return o.format == MIR_Divide_format; 042 } 043 044 /** 045 * Get the operand called Result1 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 Result1 050 */ 051 public static Operand getResult1(Instruction i) { 052 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 053 return (Operand) i.getOperand(0); 054 } 055 /** 056 * Get the operand called Result1 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 Result1 061 */ 062 public static Operand getClearResult1(Instruction i) { 063 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 064 return (Operand) i.getClearOperand(0); 065 } 066 /** 067 * Set the operand called Result1 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 Result1 the operand to store 073 */ 074 public static void setResult1(Instruction i, Operand Result1) { 075 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 076 i.putOperand(0, Result1); 077 } 078 /** 079 * Return the index of the operand called Result1 080 * in the argument instruction. 081 * @param i the instruction to access. 082 * @return the index of the operand called Result1 083 * in the argument instruction 084 */ 085 public static int indexOfResult1(Instruction i) { 086 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 087 return 0; 088 } 089 /** 090 * Does the argument instruction have a non-null 091 * operand named Result1? 092 * @param i the instruction to access. 093 * @return <code>true</code> if the instruction has an non-null 094 * operand named Result1 or <code>false</code> 095 * if it does not. 096 */ 097 public static boolean hasResult1(Instruction i) { 098 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 099 return i.getOperand(0) != null; 100 } 101 102 /** 103 * Get the operand called Result2 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 * @return the operand called Result2 108 */ 109 public static Operand getResult2(Instruction i) { 110 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 111 return (Operand) i.getOperand(1); 112 } 113 /** 114 * Get the operand called Result2 from the argument 115 * instruction clearing its instruction pointer. The returned 116 * operand will not point to any containing instruction. 117 * @param i the instruction to fetch the operand from 118 * @return the operand called Result2 119 */ 120 public static Operand getClearResult2(Instruction i) { 121 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 122 return (Operand) i.getClearOperand(1); 123 } 124 /** 125 * Set the operand called Result2 in the argument 126 * instruction to the argument operand. The operand will 127 * now point to the argument instruction as its containing 128 * instruction. 129 * @param i the instruction in which to store the operand 130 * @param Result2 the operand to store 131 */ 132 public static void setResult2(Instruction i, Operand Result2) { 133 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 134 i.putOperand(1, Result2); 135 } 136 /** 137 * Return the index of the operand called Result2 138 * in the argument instruction. 139 * @param i the instruction to access. 140 * @return the index of the operand called Result2 141 * in the argument instruction 142 */ 143 public static int indexOfResult2(Instruction i) { 144 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 145 return 1; 146 } 147 /** 148 * Does the argument instruction have a non-null 149 * operand named Result2? 150 * @param i the instruction to access. 151 * @return <code>true</code> if the instruction has an non-null 152 * operand named Result2 or <code>false</code> 153 * if it does not. 154 */ 155 public static boolean hasResult2(Instruction i) { 156 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 157 return i.getOperand(1) != null; 158 } 159 160 /** 161 * Get the operand called Value from the 162 * argument instruction. Note that the returned operand 163 * will still point to its containing instruction. 164 * @param i the instruction to fetch the operand from 165 * @return the operand called Value 166 */ 167 public static Operand getValue(Instruction i) { 168 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 169 return (Operand) i.getOperand(2); 170 } 171 /** 172 * Get the operand called Value from the argument 173 * instruction clearing its instruction pointer. The returned 174 * operand will not point to any containing instruction. 175 * @param i the instruction to fetch the operand from 176 * @return the operand called Value 177 */ 178 public static Operand getClearValue(Instruction i) { 179 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 180 return (Operand) i.getClearOperand(2); 181 } 182 /** 183 * Set the operand called Value in the argument 184 * instruction to the argument operand. The operand will 185 * now point to the argument instruction as its containing 186 * instruction. 187 * @param i the instruction in which to store the operand 188 * @param Value the operand to store 189 */ 190 public static void setValue(Instruction i, Operand Value) { 191 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 192 i.putOperand(2, Value); 193 } 194 /** 195 * Return the index of the operand called Value 196 * in the argument instruction. 197 * @param i the instruction to access. 198 * @return the index of the operand called Value 199 * in the argument instruction 200 */ 201 public static int indexOfValue(Instruction i) { 202 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 203 return 2; 204 } 205 /** 206 * Does the argument instruction have a non-null 207 * operand named Value? 208 * @param i the instruction to access. 209 * @return <code>true</code> if the instruction has an non-null 210 * operand named Value or <code>false</code> 211 * if it does not. 212 */ 213 public static boolean hasValue(Instruction i) { 214 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 215 return i.getOperand(2) != null; 216 } 217 218 /** 219 * Get the operand called Guard from the 220 * argument instruction. Note that the returned operand 221 * will still point to its containing instruction. 222 * @param i the instruction to fetch the operand from 223 * @return the operand called Guard 224 */ 225 public static Operand getGuard(Instruction i) { 226 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 227 return (Operand) i.getOperand(3); 228 } 229 /** 230 * Get the operand called Guard from the argument 231 * instruction clearing its instruction pointer. The returned 232 * operand will not point to any containing instruction. 233 * @param i the instruction to fetch the operand from 234 * @return the operand called Guard 235 */ 236 public static Operand getClearGuard(Instruction i) { 237 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 238 return (Operand) i.getClearOperand(3); 239 } 240 /** 241 * Set the operand called Guard in the argument 242 * instruction to the argument operand. The operand will 243 * now point to the argument instruction as its containing 244 * instruction. 245 * @param i the instruction in which to store the operand 246 * @param Guard the operand to store 247 */ 248 public static void setGuard(Instruction i, Operand Guard) { 249 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 250 i.putOperand(3, Guard); 251 } 252 /** 253 * Return the index of the operand called Guard 254 * in the argument instruction. 255 * @param i the instruction to access. 256 * @return the index of the operand called Guard 257 * in the argument instruction 258 */ 259 public static int indexOfGuard(Instruction i) { 260 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 261 return 3; 262 } 263 /** 264 * Does the argument instruction have a non-null 265 * operand named Guard? 266 * @param i the instruction to access. 267 * @return <code>true</code> if the instruction has an non-null 268 * operand named Guard or <code>false</code> 269 * if it does not. 270 */ 271 public static boolean hasGuard(Instruction i) { 272 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_Divide"); 273 return i.getOperand(3) != null; 274 } 275 276 277 /** 278 * Create an instruction of the MIR_Divide instruction format. 279 * @param o the instruction's operator 280 * @param Result1 the instruction's Result1 operand 281 * @param Result2 the instruction's Result2 operand 282 * @param Value the instruction's Value operand 283 * @param Guard the instruction's Guard operand 284 * @return the newly created MIR_Divide instruction 285 */ 286 public static Instruction create(Operator o 287 , Operand Result1 288 , Operand Result2 289 , Operand Value 290 , Operand Guard 291 ) 292 { 293 if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "MIR_Divide"); 294 Instruction i = new Instruction(o, 5); 295 i.putOperand(0, Result1); 296 i.putOperand(1, Result2); 297 i.putOperand(2, Value); 298 i.putOperand(3, Guard); 299 return i; 300 } 301 302 /** 303 * Mutate the argument instruction into an instruction of the 304 * MIR_Divide instruction format having the specified 305 * operator and operands. 306 * @param i the instruction to mutate 307 * @param o the instruction's operator 308 * @param Result1 the instruction's Result1 operand 309 * @param Result2 the instruction's Result2 operand 310 * @param Value the instruction's Value operand 311 * @param Guard the instruction's Guard operand 312 * @return the mutated instruction 313 */ 314 public static Instruction mutate(Instruction i, Operator o 315 , Operand Result1 316 , Operand Result2 317 , Operand Value 318 , Operand Guard 319 ) 320 { 321 if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "MIR_Divide"); 322 i.operator = o; 323 i.putOperand(0, Result1); 324 i.putOperand(1, Result2); 325 i.putOperand(2, Value); 326 i.putOperand(3, Guard); 327 return i; 328 } 329 } 330