org.jikesrvm.compilers.opt.ir
Class Phi

java.lang.Object
  extended by org.jikesrvm.compilers.opt.ir.InstructionFormat
      extended by org.jikesrvm.compilers.opt.ir.Phi

public final class Phi
extends InstructionFormat

The Phi InstructionFormat class. The header comment for Instruction contains an explanation of the role of InstructionFormats in the opt compiler's IR.


Field Summary
 
Fields inherited from class org.jikesrvm.compilers.opt.ir.InstructionFormat
ALoad_format, ALoad_traits, ARCH_INDEPENDENT_INSTR_FORMAT_END_format, AStore_format, AStore_traits, Athrow_format, Athrow_traits, Attempt_format, Attempt_traits, BBend_format, BBend_traits, Binary_format, Binary_traits, BooleanCmp_format, BooleanCmp_traits, BoundsCheck_format, BoundsCheck_traits, CacheOp_format, CacheOp_traits, Call_format, Call_traits, CondMove_format, CondMove_traits, Empty_format, Empty_traits, GetField_format, GetField_traits, GetStatic_format, GetStatic_traits, Goto_format, Goto_traits, GuardedBinary_format, GuardedBinary_traits, GuardedSet_format, GuardedSet_traits, GuardedUnary_format, GuardedUnary_traits, IfCmp_format, IfCmp_traits, IfCmp2_format, IfCmp2_traits, InlineGuard_format, InlineGuard_traits, InstanceOf_format, InstanceOf_traits, InstrumentedCounter_format, InstrumentedCounter_traits, Label_format, Label_traits, Load_format, Load_traits, LookupSwitch_format, LookupSwitch_traits, LowTableSwitch_format, LowTableSwitch_traits, MIN_OPERAND_ARRAY_LENGTH, MIR_BinaryAcc_format, MIR_BinaryAcc_traits, MIR_Branch_format, MIR_Branch_traits, MIR_CacheOp_format, MIR_CacheOp_traits, MIR_Call_format, MIR_Call_traits, MIR_CaseLabel_format, MIR_CaseLabel_traits, MIR_Compare_format, MIR_Compare_traits, MIR_CompareExchange_format, MIR_CompareExchange_traits, MIR_CompareExchange8B_format, MIR_CompareExchange8B_traits, MIR_CondBranch_format, MIR_CondBranch_traits, MIR_CondBranch2_format, MIR_CondBranch2_traits, MIR_CondMove_format, MIR_CondMove_traits, MIR_ConvertDW2QW_format, MIR_ConvertDW2QW_traits, MIR_Divide_format, MIR_Divide_traits, MIR_DoubleShift_format, MIR_DoubleShift_traits, MIR_Empty_format, MIR_Empty_traits, MIR_FSave_format, MIR_FSave_traits, MIR_Lea_format, MIR_Lea_traits, MIR_LowTableSwitch_format, MIR_LowTableSwitch_traits, MIR_Move_format, MIR_Move_traits, MIR_Multiply_format, MIR_Multiply_traits, MIR_Nullary_format, MIR_Nullary_traits, MIR_RDTSC_format, MIR_RDTSC_traits, MIR_Return_format, MIR_Return_traits, MIR_Set_format, MIR_Set_traits, MIR_Test_format, MIR_Test_traits, MIR_Trap_format, MIR_Trap_traits, MIR_TrapIf_format, MIR_TrapIf_traits, MIR_Unary_format, MIR_Unary_traits, MIR_UnaryAcc_format, MIR_UnaryAcc_traits, MIR_UnaryNoRes_format, MIR_UnaryNoRes_traits, MIR_XChng_format, MIR_XChng_traits, MonitorOp_format, MonitorOp_traits, Move_format, Move_traits, Multianewarray_format, Multianewarray_traits, New_format, New_traits, NewArray_format, NewArray_traits, Nullary_format, Nullary_traits, NullCheck_format, NullCheck_traits, OsrBarrier_format, OsrBarrier_traits, OsrPoint_format, OsrPoint_traits, Phi_format, Phi_traits, Prepare_format, Prepare_traits, Prologue_format, Prologue_traits, PutField_format, PutField_traits, PutStatic_format, PutStatic_traits, Return_format, Return_traits, Store_format, Store_traits, StoreCheck_format, StoreCheck_traits, TableSwitch_format, TableSwitch_traits, Trap_format, Trap_traits, TrapIf_format, TrapIf_traits, TypeCheck_format, TypeCheck_traits, Unary_format, Unary_traits, Unassigned_format, ZeroCheck_format, ZeroCheck_traits
 
Constructor Summary
Phi()
           
 
Method Summary
static boolean conforms(Instruction i)
          InstructionFormat identification method for Phi.
static boolean conforms(Operator o)
          InstructionFormat identification method for Phi.
static Instruction create(Operator o, Operand Result, int numVarOps)
          Create an instruction of the Phi instruction format.
static BasicBlockOperand getClearPred(Instruction i, int k)
          Get the k'th operand called Pred from the argument instruction clearing its instruction pointer.
static Operand getClearResult(Instruction i)
          Get the operand called Result from the argument instruction clearing its instruction pointer.
static Operand getClearValue(Instruction i, int k)
          Get the k'th operand called Value from the argument instruction clearing its instruction pointer.
static int getNumberOfPreds(Instruction i)
          How many variable-length operands called Preds does the argument instruction have?
static int getNumberOfValues(Instruction i)
          How many variable-length operands called Values does the argument instruction have?
static BasicBlockOperand getPred(Instruction i, int k)
          Get the k'th operand called Pred from the argument instruction.
static Operand getResult(Instruction i)
          Get the operand called Result from the argument instruction.
static Operand getValue(Instruction i, int k)
          Get the k'th operand called Value from the argument instruction.
static boolean hasPred(Instruction i, int k)
          Does the argument instruction have a non-null k'th operand named Pred?
static boolean hasPreds(Instruction i)
          Does the argument instruction have any operands named Pred?
static boolean hasResult(Instruction i)
          Does the argument instruction have a non-null operand named Result?
static boolean hasValue(Instruction i, int k)
          Does the argument instruction have a non-null k'th operand named Value?
static boolean hasValues(Instruction i)
          Does the argument instruction have any operands named Value?
static int indexOfPred(Instruction i, int k)
          Return the index of the k'th operand called Pred in the argument instruction.
static int indexOfPreds(Instruction i)
          Return the index of the first operand called Pred in the argument instruction.
static int indexOfResult(Instruction i)
          Return the index of the operand called Result in the argument instruction.
static int indexOfValue(Instruction i, int k)
          Return the index of the k'th operand called Value in the argument instruction.
static int indexOfValues(Instruction i)
          Return the index of the first operand called Value in the argument instruction.
static Instruction mutate(Instruction i, Operator o, Operand Result, int numVarOps)
          Mutate the argument instruction into an instruction of the Phi instruction format having the specified operator and operands.
static void resizeNumberOfPreds(Instruction i, int numVarOps)
          Change the number of Preds that may be stored in the argument instruction to numVarOps.
static void resizeNumberOfValues(Instruction i, int numVarOps)
          Change the number of Values that may be stored in the argument instruction to numVarOps.
static void setPred(Instruction i, int k, BasicBlockOperand o)
          Set the k'th operand called Pred in the argument instruction to the argument operand.
static void setResult(Instruction i, Operand Result)
          Set the operand called Result in the argument instruction to the argument operand.
static void setValue(Instruction i, int k, Operand o)
          Set the k'th operand called Value in the argument instruction to the argument operand.
 
Methods inherited from class org.jikesrvm.compilers.opt.ir.InstructionFormat
fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Phi

public Phi()
Method Detail

conforms

public static boolean conforms(Instruction i)
InstructionFormat identification method for Phi.

Parameters:
i - an instruction
Returns:
true if the InstructionFormat of the argument instruction is Phi or false if it is not.

conforms

public static boolean conforms(Operator o)
InstructionFormat identification method for Phi.

Parameters:
o - an instruction
Returns:
true if the InstructionFormat of the argument operator is Phi or false if it is not.

getResult

public static Operand getResult(Instruction i)
Get the operand called Result from the argument instruction. Note that the returned operand will still point to its containing instruction.

Parameters:
i - the instruction to fetch the operand from
Returns:
the operand called Result

getClearResult

public static Operand getClearResult(Instruction i)
Get the operand called Result from the argument instruction clearing its instruction pointer. The returned operand will not point to any containing instruction.

Parameters:
i - the instruction to fetch the operand from
Returns:
the operand called Result

setResult

public static void setResult(Instruction i,
                             Operand Result)
Set the operand called Result in the argument instruction to the argument operand. The operand will now point to the argument instruction as its containing instruction.

Parameters:
i - the instruction in which to store the operand
Result - the operand to store

indexOfResult

public static int indexOfResult(Instruction i)
Return the index of the operand called Result in the argument instruction.

Parameters:
i - the instruction to access.
Returns:
the index of the operand called Result in the argument instruction

hasResult

public static boolean hasResult(Instruction i)
Does the argument instruction have a non-null operand named Result?

Parameters:
i - the instruction to access.
Returns:
true if the instruction has an non-null operand named Result or false if it does not.

getValue

public static Operand getValue(Instruction i,
                               int k)
Get the k'th operand called Value from the argument instruction. Note that the returned operand will still point to its containing instruction.

Parameters:
i - the instruction to fetch the operand from
k - the index of the operand
Returns:
the k'th operand called Value

getClearValue

public static Operand getClearValue(Instruction i,
                                    int k)
Get the k'th operand called Value from the argument instruction clearing its instruction pointer. The returned operand will not point to any containing instruction.

Parameters:
i - the instruction to fetch the operand from
k - the index of the operand
Returns:
the k'th operand called Value

setValue

public static void setValue(Instruction i,
                            int k,
                            Operand o)
Set the k'th operand called Value in the argument instruction to the argument operand. The operand will now point to the argument instruction as its containing instruction.

Parameters:
i - the instruction in which to store the operand
k - the index of the operand
o - the operand to store

indexOfValue

public static int indexOfValue(Instruction i,
                               int k)
Return the index of the k'th operand called Value in the argument instruction.

Parameters:
i - the instruction to access.
k - the index of the operand.
Returns:
the index of the k'th operand called Value in the argument instruction

hasValue

public static boolean hasValue(Instruction i,
                               int k)
Does the argument instruction have a non-null k'th operand named Value?

Parameters:
i - the instruction to access.
k - the index of the operand.
Returns:
true if the instruction has an non-null k'th operand named Value or false if it does not.

indexOfValues

public static int indexOfValues(Instruction i)
Return the index of the first operand called Value in the argument instruction.

Parameters:
i - the instruction to access.
Returns:
the index of the first operand called Value in the argument instruction

hasValues

public static boolean hasValues(Instruction i)
Does the argument instruction have any operands named Value?

Parameters:
i - the instruction to access.
Returns:
true if the instruction has operands named Value or false if it does not.

getNumberOfValues

public static int getNumberOfValues(Instruction i)
How many variable-length operands called Values does the argument instruction have?

Parameters:
i - the instruction to access
Returns:
the number of operands called Values the instruction has

resizeNumberOfValues

public static void resizeNumberOfValues(Instruction i,
                                        int numVarOps)
Change the number of Values that may be stored in the argument instruction to numVarOps.

Parameters:
i - the instruction to access
numVarOps - the new number of variable operands called Values that may be stored in the instruction

getPred

public static BasicBlockOperand getPred(Instruction i,
                                        int k)
Get the k'th operand called Pred from the argument instruction. Note that the returned operand will still point to its containing instruction.

Parameters:
i - the instruction to fetch the operand from
k - the index of the operand
Returns:
the k'th operand called Pred

getClearPred

public static BasicBlockOperand getClearPred(Instruction i,
                                             int k)
Get the k'th operand called Pred from the argument instruction clearing its instruction pointer. The returned operand will not point to any containing instruction.

Parameters:
i - the instruction to fetch the operand from
k - the index of the operand
Returns:
the k'th operand called Pred

setPred

public static void setPred(Instruction i,
                           int k,
                           BasicBlockOperand o)
Set the k'th operand called Pred in the argument instruction to the argument operand. The operand will now point to the argument instruction as its containing instruction.

Parameters:
i - the instruction in which to store the operand
k - the index of the operand
o - the operand to store

indexOfPred

public static int indexOfPred(Instruction i,
                              int k)
Return the index of the k'th operand called Pred in the argument instruction.

Parameters:
i - the instruction to access.
k - the index of the operand.
Returns:
the index of the k'th operand called Pred in the argument instruction

hasPred

public static boolean hasPred(Instruction i,
                              int k)
Does the argument instruction have a non-null k'th operand named Pred?

Parameters:
i - the instruction to access.
k - the index of the operand.
Returns:
true if the instruction has an non-null k'th operand named Pred or false if it does not.

indexOfPreds

public static int indexOfPreds(Instruction i)
Return the index of the first operand called Pred in the argument instruction.

Parameters:
i - the instruction to access.
Returns:
the index of the first operand called Pred in the argument instruction

hasPreds

public static boolean hasPreds(Instruction i)
Does the argument instruction have any operands named Pred?

Parameters:
i - the instruction to access.
Returns:
true if the instruction has operands named Pred or false if it does not.

getNumberOfPreds

public static int getNumberOfPreds(Instruction i)
How many variable-length operands called Preds does the argument instruction have?

Parameters:
i - the instruction to access
Returns:
the number of operands called Preds the instruction has

resizeNumberOfPreds

public static void resizeNumberOfPreds(Instruction i,
                                       int numVarOps)
Change the number of Preds that may be stored in the argument instruction to numVarOps.

Parameters:
i - the instruction to access
numVarOps - the new number of variable operands called Preds that may be stored in the instruction

create

public static Instruction create(Operator o,
                                 Operand Result,
                                 int numVarOps)
Create an instruction of the Phi instruction format.

Parameters:
o - the instruction's operator
Result - the instruction's Result operand
numVarOps - the number of variable length operands that will be stored in the insruction.
Returns:
the newly created Phi instruction

mutate

public static Instruction mutate(Instruction i,
                                 Operator o,
                                 Operand Result,
                                 int numVarOps)
Mutate the argument instruction into an instruction of the Phi instruction format having the specified operator and operands.

Parameters:
i - the instruction to mutate
o - the instruction's operator
Result - the instruction's Result operand
numVarOps - the number of variable length operands that will be stored in the insruction.
Returns:
the mutated instruction