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_CondBranch 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_CondBranch extends InstructionFormat { 023 /** 024 * InstructionFormat identification method for MIR_CondBranch. 025 * @param i an instruction 026 * @return <code>true</code> if the InstructionFormat of the argument 027 * instruction is MIR_CondBranch 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_CondBranch. 035 * @param o an instruction 036 * @return <code>true</code> if the InstructionFormat of the argument 037 * operator is MIR_CondBranch or <code>false</code> 038 * if it is not. 039 */ 040 public static boolean conforms(Operator o) { 041 return o.format == MIR_CondBranch_format; 042 } 043 044 /** 045 * Get the operand called Cond 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 Cond 050 */ 051 public static IA32ConditionOperand getCond(Instruction i) { 052 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CondBranch"); 053 return (IA32ConditionOperand) i.getOperand(0); 054 } 055 /** 056 * Get the operand called Cond 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 Cond 061 */ 062 public static IA32ConditionOperand getClearCond(Instruction i) { 063 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CondBranch"); 064 return (IA32ConditionOperand) i.getClearOperand(0); 065 } 066 /** 067 * Set the operand called Cond 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 Cond the operand to store 073 */ 074 public static void setCond(Instruction i, IA32ConditionOperand Cond) { 075 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CondBranch"); 076 i.putOperand(0, Cond); 077 } 078 /** 079 * Return the index of the operand called Cond 080 * in the argument instruction. 081 * @param i the instruction to access. 082 * @return the index of the operand called Cond 083 * in the argument instruction 084 */ 085 public static int indexOfCond(Instruction i) { 086 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CondBranch"); 087 return 0; 088 } 089 /** 090 * Does the argument instruction have a non-null 091 * operand named Cond? 092 * @param i the instruction to access. 093 * @return <code>true</code> if the instruction has an non-null 094 * operand named Cond or <code>false</code> 095 * if it does not. 096 */ 097 public static boolean hasCond(Instruction i) { 098 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CondBranch"); 099 return i.getOperand(0) != null; 100 } 101 102 /** 103 * Get the operand called Target 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 Target 108 */ 109 public static BranchOperand getTarget(Instruction i) { 110 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CondBranch"); 111 return (BranchOperand) i.getOperand(1); 112 } 113 /** 114 * Get the operand called Target 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 Target 119 */ 120 public static BranchOperand getClearTarget(Instruction i) { 121 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CondBranch"); 122 return (BranchOperand) i.getClearOperand(1); 123 } 124 /** 125 * Set the operand called Target 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 Target the operand to store 131 */ 132 public static void setTarget(Instruction i, BranchOperand Target) { 133 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CondBranch"); 134 i.putOperand(1, Target); 135 } 136 /** 137 * Return the index of the operand called Target 138 * in the argument instruction. 139 * @param i the instruction to access. 140 * @return the index of the operand called Target 141 * in the argument instruction 142 */ 143 public static int indexOfTarget(Instruction i) { 144 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CondBranch"); 145 return 1; 146 } 147 /** 148 * Does the argument instruction have a non-null 149 * operand named Target? 150 * @param i the instruction to access. 151 * @return <code>true</code> if the instruction has an non-null 152 * operand named Target or <code>false</code> 153 * if it does not. 154 */ 155 public static boolean hasTarget(Instruction i) { 156 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CondBranch"); 157 return i.getOperand(1) != null; 158 } 159 160 /** 161 * Get the operand called BranchProfile 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 BranchProfile 166 */ 167 public static BranchProfileOperand getBranchProfile(Instruction i) { 168 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CondBranch"); 169 return (BranchProfileOperand) i.getOperand(2); 170 } 171 /** 172 * Get the operand called BranchProfile 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 BranchProfile 177 */ 178 public static BranchProfileOperand getClearBranchProfile(Instruction i) { 179 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CondBranch"); 180 return (BranchProfileOperand) i.getClearOperand(2); 181 } 182 /** 183 * Set the operand called BranchProfile 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 BranchProfile the operand to store 189 */ 190 public static void setBranchProfile(Instruction i, BranchProfileOperand BranchProfile) { 191 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CondBranch"); 192 i.putOperand(2, BranchProfile); 193 } 194 /** 195 * Return the index of the operand called BranchProfile 196 * in the argument instruction. 197 * @param i the instruction to access. 198 * @return the index of the operand called BranchProfile 199 * in the argument instruction 200 */ 201 public static int indexOfBranchProfile(Instruction i) { 202 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CondBranch"); 203 return 2; 204 } 205 /** 206 * Does the argument instruction have a non-null 207 * operand named BranchProfile? 208 * @param i the instruction to access. 209 * @return <code>true</code> if the instruction has an non-null 210 * operand named BranchProfile or <code>false</code> 211 * if it does not. 212 */ 213 public static boolean hasBranchProfile(Instruction i) { 214 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_CondBranch"); 215 return i.getOperand(2) != null; 216 } 217 218 219 /** 220 * Create an instruction of the MIR_CondBranch instruction format. 221 * @param o the instruction's operator 222 * @param Cond the instruction's Cond operand 223 * @param Target the instruction's Target operand 224 * @param BranchProfile the instruction's BranchProfile operand 225 * @return the newly created MIR_CondBranch instruction 226 */ 227 public static Instruction create(Operator o 228 , IA32ConditionOperand Cond 229 , BranchOperand Target 230 , BranchProfileOperand BranchProfile 231 ) 232 { 233 if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "MIR_CondBranch"); 234 Instruction i = new Instruction(o, 5); 235 i.putOperand(0, Cond); 236 i.putOperand(1, Target); 237 i.putOperand(2, BranchProfile); 238 return i; 239 } 240 241 /** 242 * Mutate the argument instruction into an instruction of the 243 * MIR_CondBranch instruction format having the specified 244 * operator and operands. 245 * @param i the instruction to mutate 246 * @param o the instruction's operator 247 * @param Cond the instruction's Cond operand 248 * @param Target the instruction's Target operand 249 * @param BranchProfile the instruction's BranchProfile operand 250 * @return the mutated instruction 251 */ 252 public static Instruction mutate(Instruction i, Operator o 253 , IA32ConditionOperand Cond 254 , BranchOperand Target 255 , BranchProfileOperand BranchProfile 256 ) 257 { 258 if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "MIR_CondBranch"); 259 i.operator = o; 260 i.putOperand(0, Cond); 261 i.putOperand(1, Target); 262 i.putOperand(2, BranchProfile); 263 return i; 264 } 265 /** 266 * Create an instruction of the MIR_CondBranch instruction format. 267 * @param o the instruction's operator 268 * @param Cond the instruction's Cond operand 269 * @param BranchProfile the instruction's BranchProfile operand 270 * @return the newly created MIR_CondBranch instruction 271 */ 272 public static Instruction create(Operator o 273 , IA32ConditionOperand Cond 274 , BranchProfileOperand BranchProfile 275 ) 276 { 277 if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "MIR_CondBranch"); 278 Instruction i = new Instruction(o, 5); 279 i.putOperand(0, Cond); 280 i.putOperand(2, BranchProfile); 281 return i; 282 } 283 284 /** 285 * Mutate the argument instruction into an instruction of the 286 * MIR_CondBranch instruction format having the specified 287 * operator and operands. 288 * @param i the instruction to mutate 289 * @param o the instruction's operator 290 * @param Cond the instruction's Cond operand 291 * @param BranchProfile the instruction's BranchProfile operand 292 * @return the mutated instruction 293 */ 294 public static Instruction mutate(Instruction i, Operator o 295 , IA32ConditionOperand Cond 296 , BranchProfileOperand BranchProfile 297 ) 298 { 299 if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "MIR_CondBranch"); 300 i.operator = o; 301 i.putOperand(0, Cond); 302 i.putOperand(1, null); 303 i.putOperand(2, BranchProfile); 304 return i; 305 } 306 } 307