Search in sources :

Example 51 with Operand

use of org.jikesrvm.compilers.opt.ir.operand.Operand in project JikesRVM by JikesRVM.

the class IndexPropagationSystem method processPhi.

/**
 * Update the set of dataflow equations to account for the actions
 * of Phi instruction.
 *
 * <p> The instruction has the form A1 = PHI (A2, A3, A4);
 * We add the dataflow equation
 * L(A1) = MEET(L(A2), L(A3), L(A4))
 *
 * @param s the Phi instruction
 */
void processPhi(Instruction s) {
    Operand result = Phi.getResult(s);
    if (!(result instanceof HeapOperand)) {
        return;
    }
    HeapVariable<?> lhs = ((HeapOperand<?>) result).value;
    DF_LatticeCell A1 = findOrCreateCell(lhs);
    DF_LatticeCell[] rhs = new DF_LatticeCell[Phi.getNumberOfValues(s)];
    for (int i = 0; i < rhs.length; i++) {
        HeapOperand<?> op = (HeapOperand<?>) Phi.getValue(s, i);
        rhs[i] = findOrCreateCell(op.value);
    }
    newEquation(A1, MEET, rhs);
}
Also used : HeapOperand(org.jikesrvm.compilers.opt.ir.operand.HeapOperand) DF_LatticeCell(org.jikesrvm.compilers.opt.dfsolver.DF_LatticeCell) HeapOperand(org.jikesrvm.compilers.opt.ir.operand.HeapOperand) Operand(org.jikesrvm.compilers.opt.ir.operand.Operand)

Example 52 with Operand

use of org.jikesrvm.compilers.opt.ir.operand.Operand in project JikesRVM by JikesRVM.

the class IndexPropagationSystem method processALoad.

/**
 * Update the set of dataflow equations to account for the actions
 * of ALoad instruction s
 *
 * <p> The load is of the form x = A[k].  let A_1 be the array SSA
 * variable before the load, and A_2 the array SSA variable after
 * the load.  Then we add the dataflow equation
 * L(A_2) = updateUse(L(A_1), VALNUM(k))
 *
 * <p> Intuitively, this equation represents the fact that A[k] is available
 * after the store
 *
 * @param s the Aload instruction
 */
void processALoad(Instruction s) {
    HeapOperand<?>[] A1 = ssa.getHeapUses(s);
    HeapOperand<?>[] A2 = ssa.getHeapDefs(s);
    if ((A1.length != 1) || (A2.length != 1)) {
        throw new OptimizingCompilerException("IndexPropagation.processALoad: aload instruction defs or uses multiple heap variables?");
    }
    Operand array = ALoad.getArray(s);
    Operand index = ALoad.getIndex(s);
    if (IRTools.mayBeVolatileFieldLoad(s) || ir.options.READS_KILL) {
        // to obey JMM strictly, we must treat every load as a
        // DEF
        addUpdateArrayDefEquation(A2[0].getHeapVariable(), A1[0].getHeapVariable(), array, index);
    } else {
        // otherwise, don't have to treat every load as a DEF
        addUpdateArrayUseEquation(A2[0].getHeapVariable(), A1[0].getHeapVariable(), array, index);
    }
}
Also used : HeapOperand(org.jikesrvm.compilers.opt.ir.operand.HeapOperand) HeapOperand(org.jikesrvm.compilers.opt.ir.operand.HeapOperand) Operand(org.jikesrvm.compilers.opt.ir.operand.Operand) OptimizingCompilerException(org.jikesrvm.compilers.opt.OptimizingCompilerException)

Example 53 with Operand

use of org.jikesrvm.compilers.opt.ir.operand.Operand in project JikesRVM by JikesRVM.

the class IndexPropagationSystem method processAStore.

/**
 * Update the set of dataflow equations to account for the actions
 * of AStore instruction s
 *
 * <p> The store is of the form A[k] = val.  let A_1 be the array SSA
 * variable before the store, and A_2 the array SSA variable after
 * the store.  Then we add the dataflow equation
 * L(A_2) = update(L(A_1), VALNUM(k))
 *
 * <p> Intuitively, this equation represents the fact that A[k] is available
 * after the store
 *
 * @param s the Astore instruction
 */
void processAStore(Instruction s) {
    HeapOperand<?>[] A1 = ssa.getHeapUses(s);
    HeapOperand<?>[] A2 = ssa.getHeapDefs(s);
    if ((A1.length != 1) || (A2.length != 1)) {
        throw new OptimizingCompilerException("IndexPropagation.processAStore: astore instruction defs or uses multiple heap variables?");
    }
    Operand array = AStore.getArray(s);
    Operand index = AStore.getIndex(s);
    addUpdateArrayDefEquation(A2[0].getHeapVariable(), A1[0].getHeapVariable(), array, index);
}
Also used : HeapOperand(org.jikesrvm.compilers.opt.ir.operand.HeapOperand) HeapOperand(org.jikesrvm.compilers.opt.ir.operand.HeapOperand) Operand(org.jikesrvm.compilers.opt.ir.operand.Operand) OptimizingCompilerException(org.jikesrvm.compilers.opt.OptimizingCompilerException)

Example 54 with Operand

use of org.jikesrvm.compilers.opt.ir.operand.Operand in project JikesRVM by JikesRVM.

the class ValueGraph method processPi.

/**
 * Update the value graph to account for a given PI instruction.
 *
 * <p><b>PRECONDITION:</b> <code> s.operator == PI </code>
 *
 * @param s the instruction in question
 */
private void processPi(Instruction s) {
    Register result = GuardedUnary.getResult(s).getRegister();
    ValueGraphVertex v = findOrCreateVertex(result);
    Operand val = GuardedUnary.getVal(s);
    // bypass Move instructions that define the right-hand side
    val = bypassMoves(val);
    v.copyVertex(findOrCreateVertex(val));
}
Also used : Register(org.jikesrvm.compilers.opt.ir.Register) MethodOperand(org.jikesrvm.compilers.opt.ir.operand.MethodOperand) UnreachableOperand(org.jikesrvm.compilers.opt.ir.operand.UnreachableOperand) LongConstantOperand(org.jikesrvm.compilers.opt.ir.operand.LongConstantOperand) DoubleConstantOperand(org.jikesrvm.compilers.opt.ir.operand.DoubleConstantOperand) TypeOperand(org.jikesrvm.compilers.opt.ir.operand.TypeOperand) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) TrueGuardOperand(org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand) ConditionOperand(org.jikesrvm.compilers.opt.ir.operand.ConditionOperand) Operand(org.jikesrvm.compilers.opt.ir.operand.Operand) ObjectConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ObjectConstantOperand) FloatConstantOperand(org.jikesrvm.compilers.opt.ir.operand.FloatConstantOperand) TIBConstantOperand(org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand) IntConstantOperand(org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand) ConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ConstantOperand)

Example 55 with Operand

use of org.jikesrvm.compilers.opt.ir.operand.Operand in project JikesRVM by JikesRVM.

the class ValueGraph method processGuardedUnary.

/**
 * Update the value graph to account for a given GuardedUnary instruction.
 *
 * <p><b>PRECONDITION:</b> <code> GuardedUnary.conforms(s); </code>
 *
 * Careful: we define two Guarded Unaries to be equivalent regardless of
 * whether the guards are equivalent!
 *
 * @param s the instruction in question
 */
private void processGuardedUnary(Instruction s) {
    // label the vertex corresponding to the result with the operator
    RegisterOperand result = GuardedUnary.getResult(s);
    ValueGraphVertex v = findOrCreateVertex(result.getRegister());
    v.setLabel(s.operator(), 1);
    // link node v to the operand it uses
    Operand val = GuardedUnary.getVal(s);
    // bypass Move instructions
    val = bypassMoves(val);
    link(v, findOrCreateVertex(val), 0);
}
Also used : RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) MethodOperand(org.jikesrvm.compilers.opt.ir.operand.MethodOperand) UnreachableOperand(org.jikesrvm.compilers.opt.ir.operand.UnreachableOperand) LongConstantOperand(org.jikesrvm.compilers.opt.ir.operand.LongConstantOperand) DoubleConstantOperand(org.jikesrvm.compilers.opt.ir.operand.DoubleConstantOperand) TypeOperand(org.jikesrvm.compilers.opt.ir.operand.TypeOperand) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) TrueGuardOperand(org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand) ConditionOperand(org.jikesrvm.compilers.opt.ir.operand.ConditionOperand) Operand(org.jikesrvm.compilers.opt.ir.operand.Operand) ObjectConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ObjectConstantOperand) FloatConstantOperand(org.jikesrvm.compilers.opt.ir.operand.FloatConstantOperand) TIBConstantOperand(org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand) IntConstantOperand(org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand) ConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ConstantOperand)

Aggregations

Operand (org.jikesrvm.compilers.opt.ir.operand.Operand)355 RegisterOperand (org.jikesrvm.compilers.opt.ir.operand.RegisterOperand)328 IntConstantOperand (org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand)242 ConditionOperand (org.jikesrvm.compilers.opt.ir.operand.ConditionOperand)217 BranchProfileOperand (org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand)212 TrueGuardOperand (org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand)210 MethodOperand (org.jikesrvm.compilers.opt.ir.operand.MethodOperand)207 TrapCodeOperand (org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand)185 LongConstantOperand (org.jikesrvm.compilers.opt.ir.operand.LongConstantOperand)174 ConstantOperand (org.jikesrvm.compilers.opt.ir.operand.ConstantOperand)165 TypeOperand (org.jikesrvm.compilers.opt.ir.operand.TypeOperand)153 Instruction (org.jikesrvm.compilers.opt.ir.Instruction)144 AddressConstantOperand (org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand)143 NullConstantOperand (org.jikesrvm.compilers.opt.ir.operand.NullConstantOperand)141 ObjectConstantOperand (org.jikesrvm.compilers.opt.ir.operand.ObjectConstantOperand)128 TIBConstantOperand (org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand)121 UnreachableOperand (org.jikesrvm.compilers.opt.ir.operand.UnreachableOperand)117 LocationOperand (org.jikesrvm.compilers.opt.ir.operand.LocationOperand)102 CodeConstantOperand (org.jikesrvm.compilers.opt.ir.operand.CodeConstantOperand)98 Register (org.jikesrvm.compilers.opt.ir.Register)82