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.VM;
011import org.jikesrvm.compilers.opt.OptimizingCompilerException;
012import 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 */
021public 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  protected 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
135  /** Shared traits for operators of the Move InstructionFormat */
136  public static final int Move_traits = Operator.none;
137  /** Shared traits for operators of the Return InstructionFormat */
138  public static final int Return_traits = Operator.none;
139  /** Shared traits for operators of the Prologue InstructionFormat */
140  public static final int Prologue_traits = Operator.varDefs;
141  /** Shared traits for operators of the InstrumentedCounter InstructionFormat */
142  public static final int InstrumentedCounter_traits = Operator.none;
143  /** Shared traits for operators of the Empty InstructionFormat */
144  public static final int Empty_traits = Operator.none;
145  /** Shared traits for operators of the Nullary InstructionFormat */
146  public static final int Nullary_traits = Operator.none;
147  /** Shared traits for operators of the New InstructionFormat */
148  public static final int New_traits = Operator.none;
149  /** Shared traits for operators of the NewArray InstructionFormat */
150  public static final int NewArray_traits = Operator.none;
151  /** Shared traits for operators of the Multianewarray InstructionFormat */
152  public static final int Multianewarray_traits = Operator.varUses;
153  /** Shared traits for operators of the Athrow InstructionFormat */
154  public static final int Athrow_traits = Operator.none;
155  /** Shared traits for operators of the MonitorOp InstructionFormat */
156  public static final int MonitorOp_traits = Operator.none;
157  /** Shared traits for operators of the CacheOp InstructionFormat */
158  public static final int CacheOp_traits = Operator.none;
159  /** Shared traits for operators of the NullCheck InstructionFormat */
160  public static final int NullCheck_traits = Operator.none;
161  /** Shared traits for operators of the ZeroCheck InstructionFormat */
162  public static final int ZeroCheck_traits = Operator.none;
163  /** Shared traits for operators of the BoundsCheck InstructionFormat */
164  public static final int BoundsCheck_traits = Operator.none;
165  /** Shared traits for operators of the StoreCheck InstructionFormat */
166  public static final int StoreCheck_traits = Operator.none;
167  /** Shared traits for operators of the TypeCheck InstructionFormat */
168  public static final int TypeCheck_traits = Operator.none;
169  /** Shared traits for operators of the InstanceOf InstructionFormat */
170  public static final int InstanceOf_traits = Operator.none;
171  /** Shared traits for operators of the Trap InstructionFormat */
172  public static final int Trap_traits = Operator.none;
173  /** Shared traits for operators of the TrapIf InstructionFormat */
174  public static final int TrapIf_traits = Operator.none;
175  /** Shared traits for operators of the IfCmp InstructionFormat */
176  public static final int IfCmp_traits = Operator.none;
177  /** Shared traits for operators of the IfCmp2 InstructionFormat */
178  public static final int IfCmp2_traits = Operator.none;
179  /** Shared traits for operators of the InlineGuard InstructionFormat */
180  public static final int InlineGuard_traits = Operator.none;
181  /** Shared traits for operators of the BooleanCmp InstructionFormat */
182  public static final int BooleanCmp_traits = Operator.none;
183  /** Shared traits for operators of the CondMove InstructionFormat */
184  public static final int CondMove_traits = Operator.none;
185  /** Shared traits for operators of the Goto InstructionFormat */
186  public static final int Goto_traits = Operator.none;
187  /** Shared traits for operators of the Label InstructionFormat */
188  public static final int Label_traits = Operator.none;
189  /** Shared traits for operators of the BBend InstructionFormat */
190  public static final int BBend_traits = Operator.none;
191  /** Shared traits for operators of the Unary InstructionFormat */
192  public static final int Unary_traits = Operator.none;
193  /** Shared traits for operators of the GuardedUnary InstructionFormat */
194  public static final int GuardedUnary_traits = Operator.none;
195  /** Shared traits for operators of the Binary InstructionFormat */
196  public static final int Binary_traits = Operator.none;
197  /** Shared traits for operators of the GuardedBinary InstructionFormat */
198  public static final int GuardedBinary_traits = Operator.none;
199  /** Shared traits for operators of the GuardedSet InstructionFormat */
200  public static final int GuardedSet_traits = Operator.none;
201  /** Shared traits for operators of the ALoad InstructionFormat */
202  public static final int ALoad_traits = Operator.none;
203  /** Shared traits for operators of the GetField InstructionFormat */
204  public static final int GetField_traits = Operator.none;
205  /** Shared traits for operators of the GetStatic InstructionFormat */
206  public static final int GetStatic_traits = Operator.none;
207  /** Shared traits for operators of the Load InstructionFormat */
208  public static final int Load_traits = Operator.none;
209  /** Shared traits for operators of the AStore InstructionFormat */
210  public static final int AStore_traits = Operator.none;
211  /** Shared traits for operators of the PutField InstructionFormat */
212  public static final int PutField_traits = Operator.none;
213  /** Shared traits for operators of the PutStatic InstructionFormat */
214  public static final int PutStatic_traits = Operator.none;
215  /** Shared traits for operators of the Store InstructionFormat */
216  public static final int Store_traits = Operator.none;
217  /** Shared traits for operators of the Prepare InstructionFormat */
218  public static final int Prepare_traits = Operator.none;
219  /** Shared traits for operators of the Attempt InstructionFormat */
220  public static final int Attempt_traits = Operator.none;
221  /** Shared traits for operators of the Call InstructionFormat */
222  public static final int Call_traits = Operator.varUses;
223  /** Shared traits for operators of the TableSwitch InstructionFormat */
224  public static final int TableSwitch_traits = Operator.varUses;
225  /** Shared traits for operators of the LookupSwitch InstructionFormat */
226  public static final int LookupSwitch_traits = Operator.varUses;
227  /** Shared traits for operators of the LowTableSwitch InstructionFormat */
228  public static final int LowTableSwitch_traits = Operator.varUses;
229  /** Shared traits for operators of the Phi InstructionFormat */
230  public static final int Phi_traits = Operator.varUses;
231  /** Shared traits for operators of the OsrBarrier InstructionFormat */
232  public static final int OsrBarrier_traits = Operator.varUses;
233  /** Shared traits for operators of the OsrPoint InstructionFormat */
234  public static final int OsrPoint_traits = Operator.varUses;
235
236  /**
237   * Called to generate a (possibly fatal) error message
238   * when it is detected that an InstructionFormat method
239   * was invoked on an instruction/operator that does not
240   * conform to that format.
241   * @param i the instruction that failed to conform to the
242   *          expected format.
243   * @param name the name of the instruction format that the
244   *             instruction was expected to conform to.
245   */
246  protected static void fail(Instruction i, String name) {
247      VM.sysWrite("Instruction "+i+" improperly accessed as "+name+"\n");
248      throw new OptimizingCompilerException();
249    }
250
251  /**
252   * Called to generate a (possibly fatal) error message
253   * when it is detected that an InstructionFormat method
254   * was invoked on an operator that does not
255   * conform to that format.
256   * @param op the operator that failed to conform to the
257   *          expected format.
258   * @param name the name of the instruction format that the
259   *             operator was expected to conform to.
260   */
261  protected static void fail(Operator op, String name) {
262      VM.sysWrite("Improper attempt to create/mutate as "+name+"\n");
263      throw new OptimizingCompilerException();
264    }
265}
266