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.VM;
011    import org.jikesrvm.compilers.opt.OptimizingCompilerException;
012    import org.jikesrvm.compilers.opt.ir.operand.*;
013    
014    /**
015     * Abstract parent class of all InstructionFormat classes.
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    public abstract class InstructionFormat {
022    
023      /**
024       * Make all operand arrays created via the InstructionFormat constructors
025       * at least this big to reduce the chance of having to resize the array
026       * if the instruction is mutated.
027       */
028      static final int MIN_OPERAND_ARRAY_LENGTH = 5;
029    
030      /** Typecode for the Unassigned InstructionFormat */
031      public static final byte Unassigned_format = 0;
032      /** Typecode for the Move InstructionFormat */
033      public static final byte Move_format = 1;
034      /** Typecode for the Return InstructionFormat */
035      public static final byte Return_format = 2;
036      /** Typecode for the Prologue InstructionFormat */
037      public static final byte Prologue_format = 3;
038      /** Typecode for the InstrumentedCounter InstructionFormat */
039      public static final byte InstrumentedCounter_format = 4;
040      /** Typecode for the Empty InstructionFormat */
041      public static final byte Empty_format = 5;
042      /** Typecode for the Nullary InstructionFormat */
043      public static final byte Nullary_format = 6;
044      /** Typecode for the New InstructionFormat */
045      public static final byte New_format = 7;
046      /** Typecode for the NewArray InstructionFormat */
047      public static final byte NewArray_format = 8;
048      /** Typecode for the Multianewarray InstructionFormat */
049      public static final byte Multianewarray_format = 9;
050      /** Typecode for the Athrow InstructionFormat */
051      public static final byte Athrow_format = 10;
052      /** Typecode for the MonitorOp InstructionFormat */
053      public static final byte MonitorOp_format = 11;
054      /** Typecode for the CacheOp InstructionFormat */
055      public static final byte CacheOp_format = 12;
056      /** Typecode for the NullCheck InstructionFormat */
057      public static final byte NullCheck_format = 13;
058      /** Typecode for the ZeroCheck InstructionFormat */
059      public static final byte ZeroCheck_format = 14;
060      /** Typecode for the BoundsCheck InstructionFormat */
061      public static final byte BoundsCheck_format = 15;
062      /** Typecode for the StoreCheck InstructionFormat */
063      public static final byte StoreCheck_format = 16;
064      /** Typecode for the TypeCheck InstructionFormat */
065      public static final byte TypeCheck_format = 17;
066      /** Typecode for the InstanceOf InstructionFormat */
067      public static final byte InstanceOf_format = 18;
068      /** Typecode for the Trap InstructionFormat */
069      public static final byte Trap_format = 19;
070      /** Typecode for the TrapIf InstructionFormat */
071      public static final byte TrapIf_format = 20;
072      /** Typecode for the IfCmp InstructionFormat */
073      public static final byte IfCmp_format = 21;
074      /** Typecode for the IfCmp2 InstructionFormat */
075      public static final byte IfCmp2_format = 22;
076      /** Typecode for the InlineGuard InstructionFormat */
077      public static final byte InlineGuard_format = 23;
078      /** Typecode for the BooleanCmp InstructionFormat */
079      public static final byte BooleanCmp_format = 24;
080      /** Typecode for the CondMove InstructionFormat */
081      public static final byte CondMove_format = 25;
082      /** Typecode for the Goto InstructionFormat */
083      public static final byte Goto_format = 26;
084      /** Typecode for the Label InstructionFormat */
085      public static final byte Label_format = 27;
086      /** Typecode for the BBend InstructionFormat */
087      public static final byte BBend_format = 28;
088      /** Typecode for the Unary InstructionFormat */
089      public static final byte Unary_format = 29;
090      /** Typecode for the GuardedUnary InstructionFormat */
091      public static final byte GuardedUnary_format = 30;
092      /** Typecode for the Binary InstructionFormat */
093      public static final byte Binary_format = 31;
094      /** Typecode for the GuardedBinary InstructionFormat */
095      public static final byte GuardedBinary_format = 32;
096      /** Typecode for the GuardedSet InstructionFormat */
097      public static final byte GuardedSet_format = 33;
098      /** Typecode for the ALoad InstructionFormat */
099      public static final byte ALoad_format = 34;
100      /** Typecode for the GetField InstructionFormat */
101      public static final byte GetField_format = 35;
102      /** Typecode for the GetStatic InstructionFormat */
103      public static final byte GetStatic_format = 36;
104      /** Typecode for the Load InstructionFormat */
105      public static final byte Load_format = 37;
106      /** Typecode for the AStore InstructionFormat */
107      public static final byte AStore_format = 38;
108      /** Typecode for the PutField InstructionFormat */
109      public static final byte PutField_format = 39;
110      /** Typecode for the PutStatic InstructionFormat */
111      public static final byte PutStatic_format = 40;
112      /** Typecode for the Store InstructionFormat */
113      public static final byte Store_format = 41;
114      /** Typecode for the Prepare InstructionFormat */
115      public static final byte Prepare_format = 42;
116      /** Typecode for the Attempt InstructionFormat */
117      public static final byte Attempt_format = 43;
118      /** Typecode for the Call InstructionFormat */
119      public static final byte Call_format = 44;
120      /** Typecode for the TableSwitch InstructionFormat */
121      public static final byte TableSwitch_format = 45;
122      /** Typecode for the LookupSwitch InstructionFormat */
123      public static final byte LookupSwitch_format = 46;
124      /** Typecode for the LowTableSwitch InstructionFormat */
125      public static final byte LowTableSwitch_format = 47;
126      /** Typecode for the Phi InstructionFormat */
127      public static final byte Phi_format = 48;
128      /** Typecode for the OsrBarrier InstructionFormat */
129      public static final byte OsrBarrier_format = 49;
130      /** Typecode for the OsrPoint InstructionFormat */
131      public static final byte OsrPoint_format = 50;
132      /** Typecode for the ARCH_INDEPENDENT_INSTR_FORMAT_END InstructionFormat */
133      public static final byte ARCH_INDEPENDENT_INSTR_FORMAT_END_format = 51;
134      /** Typecode for the MIR_LowTableSwitch InstructionFormat */
135      public static final byte MIR_LowTableSwitch_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+0;
136      /** Typecode for the MIR_Move InstructionFormat */
137      public static final byte MIR_Move_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+1;
138      /** Typecode for the MIR_CondMove InstructionFormat */
139      public static final byte MIR_CondMove_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+2;
140      /** Typecode for the MIR_Lea InstructionFormat */
141      public static final byte MIR_Lea_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+3;
142      /** Typecode for the MIR_BinaryAcc InstructionFormat */
143      public static final byte MIR_BinaryAcc_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+4;
144      /** Typecode for the MIR_Divide InstructionFormat */
145      public static final byte MIR_Divide_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+5;
146      /** Typecode for the MIR_Multiply InstructionFormat */
147      public static final byte MIR_Multiply_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+6;
148      /** Typecode for the MIR_ConvertDW2QW InstructionFormat */
149      public static final byte MIR_ConvertDW2QW_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+7;
150      /** Typecode for the MIR_UnaryAcc InstructionFormat */
151      public static final byte MIR_UnaryAcc_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+8;
152      /** Typecode for the MIR_Compare InstructionFormat */
153      public static final byte MIR_Compare_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+9;
154      /** Typecode for the MIR_CompareExchange InstructionFormat */
155      public static final byte MIR_CompareExchange_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+10;
156      /** Typecode for the MIR_CompareExchange8B InstructionFormat */
157      public static final byte MIR_CompareExchange8B_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+11;
158      /** Typecode for the MIR_Trap InstructionFormat */
159      public static final byte MIR_Trap_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+12;
160      /** Typecode for the MIR_TrapIf InstructionFormat */
161      public static final byte MIR_TrapIf_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+13;
162      /** Typecode for the MIR_Branch InstructionFormat */
163      public static final byte MIR_Branch_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+14;
164      /** Typecode for the MIR_CondBranch InstructionFormat */
165      public static final byte MIR_CondBranch_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+15;
166      /** Typecode for the MIR_CondBranch2 InstructionFormat */
167      public static final byte MIR_CondBranch2_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+16;
168      /** Typecode for the MIR_Call InstructionFormat */
169      public static final byte MIR_Call_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+17;
170      /** Typecode for the MIR_Empty InstructionFormat */
171      public static final byte MIR_Empty_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+18;
172      /** Typecode for the MIR_Return InstructionFormat */
173      public static final byte MIR_Return_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+19;
174      /** Typecode for the MIR_Set InstructionFormat */
175      public static final byte MIR_Set_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+20;
176      /** Typecode for the MIR_Test InstructionFormat */
177      public static final byte MIR_Test_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+21;
178      /** Typecode for the MIR_Nullary InstructionFormat */
179      public static final byte MIR_Nullary_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+22;
180      /** Typecode for the MIR_UnaryNoRes InstructionFormat */
181      public static final byte MIR_UnaryNoRes_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+23;
182      /** Typecode for the MIR_Unary InstructionFormat */
183      public static final byte MIR_Unary_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+24;
184      /** Typecode for the MIR_XChng InstructionFormat */
185      public static final byte MIR_XChng_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+25;
186      /** Typecode for the MIR_DoubleShift InstructionFormat */
187      public static final byte MIR_DoubleShift_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+26;
188      /** Typecode for the MIR_CaseLabel InstructionFormat */
189      public static final byte MIR_CaseLabel_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+27;
190      /** Typecode for the MIR_FSave InstructionFormat */
191      public static final byte MIR_FSave_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+28;
192      /** Typecode for the MIR_RDTSC InstructionFormat */
193      public static final byte MIR_RDTSC_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+29;
194      /** Typecode for the MIR_CacheOp InstructionFormat */
195      public static final byte MIR_CacheOp_format = ARCH_INDEPENDENT_INSTR_FORMAT_END_format+30;
196    
197      /** Shared traits for operators of the Move InstructionFormat */
198      public static final int Move_traits = Operator.none;
199      /** Shared traits for operators of the Return InstructionFormat */
200      public static final int Return_traits = Operator.none;
201      /** Shared traits for operators of the Prologue InstructionFormat */
202      public static final int Prologue_traits = Operator.varDefs;
203      /** Shared traits for operators of the InstrumentedCounter InstructionFormat */
204      public static final int InstrumentedCounter_traits = Operator.none;
205      /** Shared traits for operators of the Empty InstructionFormat */
206      public static final int Empty_traits = Operator.none;
207      /** Shared traits for operators of the Nullary InstructionFormat */
208      public static final int Nullary_traits = Operator.none;
209      /** Shared traits for operators of the New InstructionFormat */
210      public static final int New_traits = Operator.none;
211      /** Shared traits for operators of the NewArray InstructionFormat */
212      public static final int NewArray_traits = Operator.none;
213      /** Shared traits for operators of the Multianewarray InstructionFormat */
214      public static final int Multianewarray_traits = Operator.varUses;
215      /** Shared traits for operators of the Athrow InstructionFormat */
216      public static final int Athrow_traits = Operator.none;
217      /** Shared traits for operators of the MonitorOp InstructionFormat */
218      public static final int MonitorOp_traits = Operator.none;
219      /** Shared traits for operators of the CacheOp InstructionFormat */
220      public static final int CacheOp_traits = Operator.none;
221      /** Shared traits for operators of the NullCheck InstructionFormat */
222      public static final int NullCheck_traits = Operator.none;
223      /** Shared traits for operators of the ZeroCheck InstructionFormat */
224      public static final int ZeroCheck_traits = Operator.none;
225      /** Shared traits for operators of the BoundsCheck InstructionFormat */
226      public static final int BoundsCheck_traits = Operator.none;
227      /** Shared traits for operators of the StoreCheck InstructionFormat */
228      public static final int StoreCheck_traits = Operator.none;
229      /** Shared traits for operators of the TypeCheck InstructionFormat */
230      public static final int TypeCheck_traits = Operator.none;
231      /** Shared traits for operators of the InstanceOf InstructionFormat */
232      public static final int InstanceOf_traits = Operator.none;
233      /** Shared traits for operators of the Trap InstructionFormat */
234      public static final int Trap_traits = Operator.none;
235      /** Shared traits for operators of the TrapIf InstructionFormat */
236      public static final int TrapIf_traits = Operator.none;
237      /** Shared traits for operators of the IfCmp InstructionFormat */
238      public static final int IfCmp_traits = Operator.none;
239      /** Shared traits for operators of the IfCmp2 InstructionFormat */
240      public static final int IfCmp2_traits = Operator.none;
241      /** Shared traits for operators of the InlineGuard InstructionFormat */
242      public static final int InlineGuard_traits = Operator.none;
243      /** Shared traits for operators of the BooleanCmp InstructionFormat */
244      public static final int BooleanCmp_traits = Operator.none;
245      /** Shared traits for operators of the CondMove InstructionFormat */
246      public static final int CondMove_traits = Operator.none;
247      /** Shared traits for operators of the Goto InstructionFormat */
248      public static final int Goto_traits = Operator.none;
249      /** Shared traits for operators of the Label InstructionFormat */
250      public static final int Label_traits = Operator.none;
251      /** Shared traits for operators of the BBend InstructionFormat */
252      public static final int BBend_traits = Operator.none;
253      /** Shared traits for operators of the Unary InstructionFormat */
254      public static final int Unary_traits = Operator.none;
255      /** Shared traits for operators of the GuardedUnary InstructionFormat */
256      public static final int GuardedUnary_traits = Operator.none;
257      /** Shared traits for operators of the Binary InstructionFormat */
258      public static final int Binary_traits = Operator.none;
259      /** Shared traits for operators of the GuardedBinary InstructionFormat */
260      public static final int GuardedBinary_traits = Operator.none;
261      /** Shared traits for operators of the GuardedSet InstructionFormat */
262      public static final int GuardedSet_traits = Operator.none;
263      /** Shared traits for operators of the ALoad InstructionFormat */
264      public static final int ALoad_traits = Operator.none;
265      /** Shared traits for operators of the GetField InstructionFormat */
266      public static final int GetField_traits = Operator.none;
267      /** Shared traits for operators of the GetStatic InstructionFormat */
268      public static final int GetStatic_traits = Operator.none;
269      /** Shared traits for operators of the Load InstructionFormat */
270      public static final int Load_traits = Operator.none;
271      /** Shared traits for operators of the AStore InstructionFormat */
272      public static final int AStore_traits = Operator.none;
273      /** Shared traits for operators of the PutField InstructionFormat */
274      public static final int PutField_traits = Operator.none;
275      /** Shared traits for operators of the PutStatic InstructionFormat */
276      public static final int PutStatic_traits = Operator.none;
277      /** Shared traits for operators of the Store InstructionFormat */
278      public static final int Store_traits = Operator.none;
279      /** Shared traits for operators of the Prepare InstructionFormat */
280      public static final int Prepare_traits = Operator.none;
281      /** Shared traits for operators of the Attempt InstructionFormat */
282      public static final int Attempt_traits = Operator.none;
283      /** Shared traits for operators of the Call InstructionFormat */
284      public static final int Call_traits = Operator.varUses;
285      /** Shared traits for operators of the TableSwitch InstructionFormat */
286      public static final int TableSwitch_traits = Operator.varUses;
287      /** Shared traits for operators of the LookupSwitch InstructionFormat */
288      public static final int LookupSwitch_traits = Operator.varUses;
289      /** Shared traits for operators of the LowTableSwitch InstructionFormat */
290      public static final int LowTableSwitch_traits = Operator.varUses;
291      /** Shared traits for operators of the Phi InstructionFormat */
292      public static final int Phi_traits = Operator.varUses;
293      /** Shared traits for operators of the OsrBarrier InstructionFormat */
294      public static final int OsrBarrier_traits = Operator.varUses;
295      /** Shared traits for operators of the OsrPoint InstructionFormat */
296      public static final int OsrPoint_traits = Operator.varUses;
297      /** Shared traits for operators of the MIR_LowTableSwitch InstructionFormat */
298      public static final int MIR_LowTableSwitch_traits = Operator.varUses;
299      /** Shared traits for operators of the MIR_Move InstructionFormat */
300      public static final int MIR_Move_traits = Operator.none;
301      /** Shared traits for operators of the MIR_CondMove InstructionFormat */
302      public static final int MIR_CondMove_traits = Operator.none;
303      /** Shared traits for operators of the MIR_Lea InstructionFormat */
304      public static final int MIR_Lea_traits = Operator.none;
305      /** Shared traits for operators of the MIR_BinaryAcc InstructionFormat */
306      public static final int MIR_BinaryAcc_traits = Operator.none;
307      /** Shared traits for operators of the MIR_Divide InstructionFormat */
308      public static final int MIR_Divide_traits = Operator.none;
309      /** Shared traits for operators of the MIR_Multiply InstructionFormat */
310      public static final int MIR_Multiply_traits = Operator.none;
311      /** Shared traits for operators of the MIR_ConvertDW2QW InstructionFormat */
312      public static final int MIR_ConvertDW2QW_traits = Operator.none;
313      /** Shared traits for operators of the MIR_UnaryAcc InstructionFormat */
314      public static final int MIR_UnaryAcc_traits = Operator.none;
315      /** Shared traits for operators of the MIR_Compare InstructionFormat */
316      public static final int MIR_Compare_traits = Operator.none;
317      /** Shared traits for operators of the MIR_CompareExchange InstructionFormat */
318      public static final int MIR_CompareExchange_traits = Operator.none;
319      /** Shared traits for operators of the MIR_CompareExchange8B InstructionFormat */
320      public static final int MIR_CompareExchange8B_traits = Operator.none;
321      /** Shared traits for operators of the MIR_Trap InstructionFormat */
322      public static final int MIR_Trap_traits = Operator.none;
323      /** Shared traits for operators of the MIR_TrapIf InstructionFormat */
324      public static final int MIR_TrapIf_traits = Operator.none;
325      /** Shared traits for operators of the MIR_Branch InstructionFormat */
326      public static final int MIR_Branch_traits = Operator.none;
327      /** Shared traits for operators of the MIR_CondBranch InstructionFormat */
328      public static final int MIR_CondBranch_traits = Operator.none;
329      /** Shared traits for operators of the MIR_CondBranch2 InstructionFormat */
330      public static final int MIR_CondBranch2_traits = Operator.none;
331      /** Shared traits for operators of the MIR_Call InstructionFormat */
332      public static final int MIR_Call_traits = Operator.varUses;
333      /** Shared traits for operators of the MIR_Empty InstructionFormat */
334      public static final int MIR_Empty_traits = Operator.none;
335      /** Shared traits for operators of the MIR_Return InstructionFormat */
336      public static final int MIR_Return_traits = Operator.none;
337      /** Shared traits for operators of the MIR_Set InstructionFormat */
338      public static final int MIR_Set_traits = Operator.none;
339      /** Shared traits for operators of the MIR_Test InstructionFormat */
340      public static final int MIR_Test_traits = Operator.none;
341      /** Shared traits for operators of the MIR_Nullary InstructionFormat */
342      public static final int MIR_Nullary_traits = Operator.none;
343      /** Shared traits for operators of the MIR_UnaryNoRes InstructionFormat */
344      public static final int MIR_UnaryNoRes_traits = Operator.none;
345      /** Shared traits for operators of the MIR_Unary InstructionFormat */
346      public static final int MIR_Unary_traits = Operator.none;
347      /** Shared traits for operators of the MIR_XChng InstructionFormat */
348      public static final int MIR_XChng_traits = Operator.none;
349      /** Shared traits for operators of the MIR_DoubleShift InstructionFormat */
350      public static final int MIR_DoubleShift_traits = Operator.none;
351      /** Shared traits for operators of the MIR_CaseLabel InstructionFormat */
352      public static final int MIR_CaseLabel_traits = Operator.none;
353      /** Shared traits for operators of the MIR_FSave InstructionFormat */
354      public static final int MIR_FSave_traits = Operator.none;
355      /** Shared traits for operators of the MIR_RDTSC InstructionFormat */
356      public static final int MIR_RDTSC_traits = Operator.none;
357      /** Shared traits for operators of the MIR_CacheOp InstructionFormat */
358      public static final int MIR_CacheOp_traits = Operator.none;
359    
360      /**
361       * Called to generate a (possibly fatal) error message
362       * when it is detected that an InstructionFormat method
363       * was invoked on an instruction/operator that does not
364       * conform to that format.
365       * @param i the instruction that failed to conform to the
366       *          expected format.
367       * @param name the name of the instruction format that the
368       *             instruction was expected to conform to.
369       */
370      protected static void fail(Instruction i, String name) {
371          VM.sysWrite("Instruction "+i+" improperly accessed as "+name+"\n");
372          throw new OptimizingCompilerException();
373        }
374    
375      /**
376       * Called to generate a (possibly fatal) error message
377       * when it is detected that an InstructionFormat method
378       * was invoked on an operator that does not
379       * conform to that format.
380       * @param op the operator that failed to conform to the
381       *          expected format.
382       * @param name the name of the instruction format that the
383       *             operator was expected to conform to.
384       */
385      protected static void fail(Operator op, String name) {
386          VM.sysWrite("Improper attempt to create/mutate as "+name+"\n");
387          throw new OptimizingCompilerException();
388        }
389    }
390