001 002/* 003 * THIS FILE IS MACHINE_GENERATED. DO NOT EDIT. 004 * See InstructionFormats.template, InstructionFormatList.dat, 005 * OperatorList.dat, etc. 006 */ 007 008package org.jikesrvm.compilers.opt.ir; 009 010import org.jikesrvm.Configuration; 011import org.jikesrvm.compilers.opt.ir.operand.*; 012 013/** 014 * The InstrumentedCounter InstructionFormat class. 015 * 016 * The header comment for {@link Instruction} contains 017 * an explanation of the role of InstructionFormats in the 018 * opt compiler's IR. 019 */ 020@SuppressWarnings("unused") // Machine generated code is never 100% clean 021public final class InstrumentedCounter extends InstructionFormat { 022 /** 023 * InstructionFormat identification method for InstrumentedCounter. 024 * @param i an instruction 025 * @return <code>true</code> if the InstructionFormat of the argument 026 * instruction is InstrumentedCounter or <code>false</code> 027 * if it is not. 028 */ 029 public static boolean conforms(Instruction i) { 030 return conforms(i.operator()); 031 } 032 /** 033 * InstructionFormat identification method for InstrumentedCounter. 034 * @param o an instruction 035 * @return <code>true</code> if the InstructionFormat of the argument 036 * operator is InstrumentedCounter or <code>false</code> 037 * if it is not. 038 */ 039 public static boolean conforms(Operator o) { 040 return o.format == InstrumentedCounter_format; 041 } 042 043 /** 044 * Get the operand called Data from the 045 * argument instruction. Note that the returned operand 046 * will still point to its containing instruction. 047 * @param i the instruction to fetch the operand from 048 * @return the operand called Data 049 */ 050 public static IntConstantOperand getData(Instruction i) { 051 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "InstrumentedCounter"); 052 return (IntConstantOperand) i.getOperand(0); 053 } 054 /** 055 * Get the operand called Data from the argument 056 * instruction clearing its instruction pointer. The returned 057 * operand will not point to any containing instruction. 058 * @param i the instruction to fetch the operand from 059 * @return the operand called Data 060 */ 061 public static IntConstantOperand getClearData(Instruction i) { 062 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "InstrumentedCounter"); 063 return (IntConstantOperand) i.getClearOperand(0); 064 } 065 /** 066 * Set the operand called Data in the argument 067 * instruction to the argument operand. The operand will 068 * now point to the argument instruction as its containing 069 * instruction. 070 * @param i the instruction in which to store the operand 071 * @param Data the operand to store 072 */ 073 public static void setData(Instruction i, IntConstantOperand Data) { 074 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "InstrumentedCounter"); 075 i.putOperand(0, Data); 076 } 077 /** 078 * Return the index of the operand called Data 079 * in the argument instruction. 080 * @param i the instruction to access. 081 * @return the index of the operand called Data 082 * in the argument instruction 083 */ 084 public static int indexOfData(Instruction i) { 085 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "InstrumentedCounter"); 086 return 0; 087 } 088 /** 089 * Does the argument instruction have a non-null 090 * operand named Data? 091 * @param i the instruction to access. 092 * @return <code>true</code> if the instruction has an non-null 093 * operand named Data or <code>false</code> 094 * if it does not. 095 */ 096 public static boolean hasData(Instruction i) { 097 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "InstrumentedCounter"); 098 return i.getOperand(0) != null; 099 } 100 101 /** 102 * Get the operand called Index from the 103 * argument instruction. Note that the returned operand 104 * will still point to its containing instruction. 105 * @param i the instruction to fetch the operand from 106 * @return the operand called Index 107 */ 108 public static IntConstantOperand getIndex(Instruction i) { 109 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "InstrumentedCounter"); 110 return (IntConstantOperand) i.getOperand(1); 111 } 112 /** 113 * Get the operand called Index from the argument 114 * instruction clearing its instruction pointer. The returned 115 * operand will not point to any containing instruction. 116 * @param i the instruction to fetch the operand from 117 * @return the operand called Index 118 */ 119 public static IntConstantOperand getClearIndex(Instruction i) { 120 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "InstrumentedCounter"); 121 return (IntConstantOperand) i.getClearOperand(1); 122 } 123 /** 124 * Set the operand called Index in the argument 125 * instruction to the argument operand. The operand will 126 * now point to the argument instruction as its containing 127 * instruction. 128 * @param i the instruction in which to store the operand 129 * @param Index the operand to store 130 */ 131 public static void setIndex(Instruction i, IntConstantOperand Index) { 132 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "InstrumentedCounter"); 133 i.putOperand(1, Index); 134 } 135 /** 136 * Return the index of the operand called Index 137 * in the argument instruction. 138 * @param i the instruction to access. 139 * @return the index of the operand called Index 140 * in the argument instruction 141 */ 142 public static int indexOfIndex(Instruction i) { 143 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "InstrumentedCounter"); 144 return 1; 145 } 146 /** 147 * Does the argument instruction have a non-null 148 * operand named Index? 149 * @param i the instruction to access. 150 * @return <code>true</code> if the instruction has an non-null 151 * operand named Index or <code>false</code> 152 * if it does not. 153 */ 154 public static boolean hasIndex(Instruction i) { 155 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "InstrumentedCounter"); 156 return i.getOperand(1) != null; 157 } 158 159 /** 160 * Get the operand called Increment from the 161 * argument instruction. Note that the returned operand 162 * will still point to its containing instruction. 163 * @param i the instruction to fetch the operand from 164 * @return the operand called Increment 165 */ 166 public static Operand getIncrement(Instruction i) { 167 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "InstrumentedCounter"); 168 return (Operand) i.getOperand(2); 169 } 170 /** 171 * Get the operand called Increment from the argument 172 * instruction clearing its instruction pointer. The returned 173 * operand will not point to any containing instruction. 174 * @param i the instruction to fetch the operand from 175 * @return the operand called Increment 176 */ 177 public static Operand getClearIncrement(Instruction i) { 178 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "InstrumentedCounter"); 179 return (Operand) i.getClearOperand(2); 180 } 181 /** 182 * Set the operand called Increment in the argument 183 * instruction to the argument operand. The operand will 184 * now point to the argument instruction as its containing 185 * instruction. 186 * @param i the instruction in which to store the operand 187 * @param Increment the operand to store 188 */ 189 public static void setIncrement(Instruction i, Operand Increment) { 190 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "InstrumentedCounter"); 191 i.putOperand(2, Increment); 192 } 193 /** 194 * Return the index of the operand called Increment 195 * in the argument instruction. 196 * @param i the instruction to access. 197 * @return the index of the operand called Increment 198 * in the argument instruction 199 */ 200 public static int indexOfIncrement(Instruction i) { 201 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "InstrumentedCounter"); 202 return 2; 203 } 204 /** 205 * Does the argument instruction have a non-null 206 * operand named Increment? 207 * @param i the instruction to access. 208 * @return <code>true</code> if the instruction has an non-null 209 * operand named Increment or <code>false</code> 210 * if it does not. 211 */ 212 public static boolean hasIncrement(Instruction i) { 213 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "InstrumentedCounter"); 214 return i.getOperand(2) != null; 215 } 216 217 218 /** 219 * Create an instruction of the InstrumentedCounter instruction format. 220 * @param o the instruction's operator 221 * @param Data the instruction's Data operand 222 * @param Index the instruction's Index operand 223 * @param Increment the instruction's Increment operand 224 * @return the newly created InstrumentedCounter instruction 225 */ 226 public static Instruction create(Operator o 227 , IntConstantOperand Data 228 , IntConstantOperand Index 229 , Operand Increment 230 ) 231 { 232 if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "InstrumentedCounter"); 233 Instruction i = Instruction.create(o, 5); 234 i.putOperand(0, Data); 235 i.putOperand(1, Index); 236 i.putOperand(2, Increment); 237 return i; 238 } 239 240 /** 241 * Mutate the argument instruction into an instruction of the 242 * InstrumentedCounter instruction format having the specified 243 * operator and operands. 244 * @param i the instruction to mutate 245 * @param o the instruction's operator 246 * @param Data the instruction's Data operand 247 * @param Index the instruction's Index operand 248 * @param Increment the instruction's Increment operand 249 * @return the mutated instruction 250 */ 251 public static Instruction mutate(Instruction i, Operator o 252 , IntConstantOperand Data 253 , IntConstantOperand Index 254 , Operand Increment 255 ) 256 { 257 if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "InstrumentedCounter"); 258 i.changeOperatorTo(o); 259 i.putOperand(0, Data); 260 i.putOperand(1, Index); 261 i.putOperand(2, Increment); 262 return i; 263 } 264} 265