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 CondMove 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 CondMove extends InstructionFormat { 023 /** 024 * InstructionFormat identification method for CondMove. 025 * @param i an instruction 026 * @return <code>true</code> if the InstructionFormat of the argument 027 * instruction is CondMove 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 CondMove. 035 * @param o an instruction 036 * @return <code>true</code> if the InstructionFormat of the argument 037 * operator is CondMove or <code>false</code> 038 * if it is not. 039 */ 040 public static boolean conforms(Operator o) { 041 return o.format == CondMove_format; 042 } 043 044 /** 045 * Get the operand called Result 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 Result 050 */ 051 public static RegisterOperand getResult(Instruction i) { 052 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 053 return (RegisterOperand) i.getOperand(0); 054 } 055 /** 056 * Get the operand called Result 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 Result 061 */ 062 public static RegisterOperand getClearResult(Instruction i) { 063 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 064 return (RegisterOperand) i.getClearOperand(0); 065 } 066 /** 067 * Set the operand called Result 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 Result the operand to store 073 */ 074 public static void setResult(Instruction i, RegisterOperand Result) { 075 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 076 i.putOperand(0, Result); 077 } 078 /** 079 * Return the index of the operand called Result 080 * in the argument instruction. 081 * @param i the instruction to access. 082 * @return the index of the operand called Result 083 * in the argument instruction 084 */ 085 public static int indexOfResult(Instruction i) { 086 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 087 return 0; 088 } 089 /** 090 * Does the argument instruction have a non-null 091 * operand named Result? 092 * @param i the instruction to access. 093 * @return <code>true</code> if the instruction has an non-null 094 * operand named Result or <code>false</code> 095 * if it does not. 096 */ 097 public static boolean hasResult(Instruction i) { 098 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 099 return i.getOperand(0) != null; 100 } 101 102 /** 103 * Get the operand called Val1 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 Val1 108 */ 109 public static Operand getVal1(Instruction i) { 110 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 111 return (Operand) i.getOperand(1); 112 } 113 /** 114 * Get the operand called Val1 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 Val1 119 */ 120 public static Operand getClearVal1(Instruction i) { 121 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 122 return (Operand) i.getClearOperand(1); 123 } 124 /** 125 * Set the operand called Val1 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 Val1 the operand to store 131 */ 132 public static void setVal1(Instruction i, Operand Val1) { 133 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 134 i.putOperand(1, Val1); 135 } 136 /** 137 * Return the index of the operand called Val1 138 * in the argument instruction. 139 * @param i the instruction to access. 140 * @return the index of the operand called Val1 141 * in the argument instruction 142 */ 143 public static int indexOfVal1(Instruction i) { 144 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 145 return 1; 146 } 147 /** 148 * Does the argument instruction have a non-null 149 * operand named Val1? 150 * @param i the instruction to access. 151 * @return <code>true</code> if the instruction has an non-null 152 * operand named Val1 or <code>false</code> 153 * if it does not. 154 */ 155 public static boolean hasVal1(Instruction i) { 156 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 157 return i.getOperand(1) != null; 158 } 159 160 /** 161 * Get the operand called Val2 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 Val2 166 */ 167 public static Operand getVal2(Instruction i) { 168 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 169 return (Operand) i.getOperand(2); 170 } 171 /** 172 * Get the operand called Val2 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 Val2 177 */ 178 public static Operand getClearVal2(Instruction i) { 179 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 180 return (Operand) i.getClearOperand(2); 181 } 182 /** 183 * Set the operand called Val2 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 Val2 the operand to store 189 */ 190 public static void setVal2(Instruction i, Operand Val2) { 191 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 192 i.putOperand(2, Val2); 193 } 194 /** 195 * Return the index of the operand called Val2 196 * in the argument instruction. 197 * @param i the instruction to access. 198 * @return the index of the operand called Val2 199 * in the argument instruction 200 */ 201 public static int indexOfVal2(Instruction i) { 202 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 203 return 2; 204 } 205 /** 206 * Does the argument instruction have a non-null 207 * operand named Val2? 208 * @param i the instruction to access. 209 * @return <code>true</code> if the instruction has an non-null 210 * operand named Val2 or <code>false</code> 211 * if it does not. 212 */ 213 public static boolean hasVal2(Instruction i) { 214 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 215 return i.getOperand(2) != null; 216 } 217 218 /** 219 * Get the operand called Cond 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 Cond 224 */ 225 public static ConditionOperand getCond(Instruction i) { 226 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 227 return (ConditionOperand) i.getOperand(3); 228 } 229 /** 230 * Get the operand called Cond 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 Cond 235 */ 236 public static ConditionOperand getClearCond(Instruction i) { 237 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 238 return (ConditionOperand) i.getClearOperand(3); 239 } 240 /** 241 * Set the operand called Cond 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 Cond the operand to store 247 */ 248 public static void setCond(Instruction i, ConditionOperand Cond) { 249 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 250 i.putOperand(3, Cond); 251 } 252 /** 253 * Return the index of the operand called Cond 254 * in the argument instruction. 255 * @param i the instruction to access. 256 * @return the index of the operand called Cond 257 * in the argument instruction 258 */ 259 public static int indexOfCond(Instruction i) { 260 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 261 return 3; 262 } 263 /** 264 * Does the argument instruction have a non-null 265 * operand named Cond? 266 * @param i the instruction to access. 267 * @return <code>true</code> if the instruction has an non-null 268 * operand named Cond or <code>false</code> 269 * if it does not. 270 */ 271 public static boolean hasCond(Instruction i) { 272 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 273 return i.getOperand(3) != null; 274 } 275 276 /** 277 * Get the operand called TrueValue from the 278 * argument instruction. Note that the returned operand 279 * will still point to its containing instruction. 280 * @param i the instruction to fetch the operand from 281 * @return the operand called TrueValue 282 */ 283 public static Operand getTrueValue(Instruction i) { 284 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 285 return (Operand) i.getOperand(4); 286 } 287 /** 288 * Get the operand called TrueValue from the argument 289 * instruction clearing its instruction pointer. The returned 290 * operand will not point to any containing instruction. 291 * @param i the instruction to fetch the operand from 292 * @return the operand called TrueValue 293 */ 294 public static Operand getClearTrueValue(Instruction i) { 295 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 296 return (Operand) i.getClearOperand(4); 297 } 298 /** 299 * Set the operand called TrueValue in the argument 300 * instruction to the argument operand. The operand will 301 * now point to the argument instruction as its containing 302 * instruction. 303 * @param i the instruction in which to store the operand 304 * @param TrueValue the operand to store 305 */ 306 public static void setTrueValue(Instruction i, Operand TrueValue) { 307 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 308 i.putOperand(4, TrueValue); 309 } 310 /** 311 * Return the index of the operand called TrueValue 312 * in the argument instruction. 313 * @param i the instruction to access. 314 * @return the index of the operand called TrueValue 315 * in the argument instruction 316 */ 317 public static int indexOfTrueValue(Instruction i) { 318 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 319 return 4; 320 } 321 /** 322 * Does the argument instruction have a non-null 323 * operand named TrueValue? 324 * @param i the instruction to access. 325 * @return <code>true</code> if the instruction has an non-null 326 * operand named TrueValue or <code>false</code> 327 * if it does not. 328 */ 329 public static boolean hasTrueValue(Instruction i) { 330 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 331 return i.getOperand(4) != null; 332 } 333 334 /** 335 * Get the operand called FalseValue from the 336 * argument instruction. Note that the returned operand 337 * will still point to its containing instruction. 338 * @param i the instruction to fetch the operand from 339 * @return the operand called FalseValue 340 */ 341 public static Operand getFalseValue(Instruction i) { 342 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 343 return (Operand) i.getOperand(5); 344 } 345 /** 346 * Get the operand called FalseValue from the argument 347 * instruction clearing its instruction pointer. The returned 348 * operand will not point to any containing instruction. 349 * @param i the instruction to fetch the operand from 350 * @return the operand called FalseValue 351 */ 352 public static Operand getClearFalseValue(Instruction i) { 353 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 354 return (Operand) i.getClearOperand(5); 355 } 356 /** 357 * Set the operand called FalseValue in the argument 358 * instruction to the argument operand. The operand will 359 * now point to the argument instruction as its containing 360 * instruction. 361 * @param i the instruction in which to store the operand 362 * @param FalseValue the operand to store 363 */ 364 public static void setFalseValue(Instruction i, Operand FalseValue) { 365 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 366 i.putOperand(5, FalseValue); 367 } 368 /** 369 * Return the index of the operand called FalseValue 370 * in the argument instruction. 371 * @param i the instruction to access. 372 * @return the index of the operand called FalseValue 373 * in the argument instruction 374 */ 375 public static int indexOfFalseValue(Instruction i) { 376 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 377 return 5; 378 } 379 /** 380 * Does the argument instruction have a non-null 381 * operand named FalseValue? 382 * @param i the instruction to access. 383 * @return <code>true</code> if the instruction has an non-null 384 * operand named FalseValue or <code>false</code> 385 * if it does not. 386 */ 387 public static boolean hasFalseValue(Instruction i) { 388 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "CondMove"); 389 return i.getOperand(5) != null; 390 } 391 392 393 /** 394 * Create an instruction of the CondMove instruction format. 395 * @param o the instruction's operator 396 * @param Result the instruction's Result operand 397 * @param Val1 the instruction's Val1 operand 398 * @param Val2 the instruction's Val2 operand 399 * @param Cond the instruction's Cond operand 400 * @param TrueValue the instruction's TrueValue operand 401 * @param FalseValue the instruction's FalseValue operand 402 * @return the newly created CondMove instruction 403 */ 404 public static Instruction create(Operator o 405 , RegisterOperand Result 406 , Operand Val1 407 , Operand Val2 408 , ConditionOperand Cond 409 , Operand TrueValue 410 , Operand FalseValue 411 ) 412 { 413 if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "CondMove"); 414 Instruction i = new Instruction(o, 6); 415 i.putOperand(0, Result); 416 i.putOperand(1, Val1); 417 i.putOperand(2, Val2); 418 i.putOperand(3, Cond); 419 i.putOperand(4, TrueValue); 420 i.putOperand(5, FalseValue); 421 return i; 422 } 423 424 /** 425 * Mutate the argument instruction into an instruction of the 426 * CondMove instruction format having the specified 427 * operator and operands. 428 * @param i the instruction to mutate 429 * @param o the instruction's operator 430 * @param Result the instruction's Result operand 431 * @param Val1 the instruction's Val1 operand 432 * @param Val2 the instruction's Val2 operand 433 * @param Cond the instruction's Cond operand 434 * @param TrueValue the instruction's TrueValue operand 435 * @param FalseValue the instruction's FalseValue operand 436 * @return the mutated instruction 437 */ 438 public static Instruction mutate(Instruction i, Operator o 439 , RegisterOperand Result 440 , Operand Val1 441 , Operand Val2 442 , ConditionOperand Cond 443 , Operand TrueValue 444 , Operand FalseValue 445 ) 446 { 447 if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "CondMove"); 448 i.resizeNumberOfOperands(6); 449 450 i.operator = o; 451 i.putOperand(0, Result); 452 i.putOperand(1, Val1); 453 i.putOperand(2, Val2); 454 i.putOperand(3, Cond); 455 i.putOperand(4, TrueValue); 456 i.putOperand(5, FalseValue); 457 return i; 458 } 459 } 460