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_RDTSC 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_RDTSC extends InstructionFormat {
023 /**
024 * InstructionFormat identification method for MIR_RDTSC.
025 * @param i an instruction
026 * @return <code>true</code> if the InstructionFormat of the argument
027 * instruction is MIR_RDTSC 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_RDTSC.
035 * @param o an instruction
036 * @return <code>true</code> if the InstructionFormat of the argument
037 * operator is MIR_RDTSC or <code>false</code>
038 * if it is not.
039 */
040 public static boolean conforms(Operator o) {
041 return o.format == MIR_RDTSC_format;
042 }
043
044 /**
045 * Get the operand called Dest1 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 Dest1
050 */
051 public static RegisterOperand getDest1(Instruction i) {
052 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RDTSC");
053 return (RegisterOperand) i.getOperand(0);
054 }
055 /**
056 * Get the operand called Dest1 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 Dest1
061 */
062 public static RegisterOperand getClearDest1(Instruction i) {
063 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RDTSC");
064 return (RegisterOperand) i.getClearOperand(0);
065 }
066 /**
067 * Set the operand called Dest1 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 Dest1 the operand to store
073 */
074 public static void setDest1(Instruction i, RegisterOperand Dest1) {
075 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RDTSC");
076 i.putOperand(0, Dest1);
077 }
078 /**
079 * Return the index of the operand called Dest1
080 * in the argument instruction.
081 * @param i the instruction to access.
082 * @return the index of the operand called Dest1
083 * in the argument instruction
084 */
085 public static int indexOfDest1(Instruction i) {
086 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RDTSC");
087 return 0;
088 }
089 /**
090 * Does the argument instruction have a non-null
091 * operand named Dest1?
092 * @param i the instruction to access.
093 * @return <code>true</code> if the instruction has an non-null
094 * operand named Dest1 or <code>false</code>
095 * if it does not.
096 */
097 public static boolean hasDest1(Instruction i) {
098 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RDTSC");
099 return i.getOperand(0) != null;
100 }
101
102 /**
103 * Get the operand called Dest2 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 Dest2
108 */
109 public static RegisterOperand getDest2(Instruction i) {
110 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RDTSC");
111 return (RegisterOperand) i.getOperand(1);
112 }
113 /**
114 * Get the operand called Dest2 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 Dest2
119 */
120 public static RegisterOperand getClearDest2(Instruction i) {
121 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RDTSC");
122 return (RegisterOperand) i.getClearOperand(1);
123 }
124 /**
125 * Set the operand called Dest2 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 Dest2 the operand to store
131 */
132 public static void setDest2(Instruction i, RegisterOperand Dest2) {
133 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RDTSC");
134 i.putOperand(1, Dest2);
135 }
136 /**
137 * Return the index of the operand called Dest2
138 * in the argument instruction.
139 * @param i the instruction to access.
140 * @return the index of the operand called Dest2
141 * in the argument instruction
142 */
143 public static int indexOfDest2(Instruction i) {
144 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RDTSC");
145 return 1;
146 }
147 /**
148 * Does the argument instruction have a non-null
149 * operand named Dest2?
150 * @param i the instruction to access.
151 * @return <code>true</code> if the instruction has an non-null
152 * operand named Dest2 or <code>false</code>
153 * if it does not.
154 */
155 public static boolean hasDest2(Instruction i) {
156 if (Configuration.ExtremeAssertions && !conforms(i)) fail(i, "MIR_RDTSC");
157 return i.getOperand(1) != null;
158 }
159
160
161 /**
162 * Create an instruction of the MIR_RDTSC instruction format.
163 * @param o the instruction's operator
164 * @param Dest1 the instruction's Dest1 operand
165 * @param Dest2 the instruction's Dest2 operand
166 * @return the newly created MIR_RDTSC instruction
167 */
168 public static Instruction create(Operator o
169 , RegisterOperand Dest1
170 , RegisterOperand Dest2
171 )
172 {
173 if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "MIR_RDTSC");
174 Instruction i = new Instruction(o, 5);
175 i.putOperand(0, Dest1);
176 i.putOperand(1, Dest2);
177 return i;
178 }
179
180 /**
181 * Mutate the argument instruction into an instruction of the
182 * MIR_RDTSC instruction format having the specified
183 * operator and operands.
184 * @param i the instruction to mutate
185 * @param o the instruction's operator
186 * @param Dest1 the instruction's Dest1 operand
187 * @param Dest2 the instruction's Dest2 operand
188 * @return the mutated instruction
189 */
190 public static Instruction mutate(Instruction i, Operator o
191 , RegisterOperand Dest1
192 , RegisterOperand Dest2
193 )
194 {
195 if (Configuration.ExtremeAssertions && !conforms(o)) fail(o, "MIR_RDTSC");
196 i.operator = o;
197 i.putOperand(0, Dest1);
198 i.putOperand(1, Dest2);
199 return i;
200 }
201 }
202