Search in sources :

Example 1 with DF_LatticeCell

use of org.jikesrvm.compilers.opt.dfsolver.DF_LatticeCell 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 2 with DF_LatticeCell

use of org.jikesrvm.compilers.opt.dfsolver.DF_LatticeCell in project JikesRVM by JikesRVM.

the class IndexPropagationSystem method addUpdateObjectUseEquation.

/**
 * Add an equation to the system of the form
 * <pre>
 * L(A1) = updateUse(L(A2), VALNUM(address))
 * </pre>
 *
 * @param A1 variable in the equation
 * @param A2 variable in the equation
 * @param valueNumber value number of address
 */
void addUpdateObjectUseEquation(HeapVariable<?> A1, HeapVariable<?> A2, int valueNumber) {
    DF_LatticeCell cell1 = findOrCreateCell(A1);
    DF_LatticeCell cell2 = findOrCreateCell(A2);
    UpdateUseObjectOperator op = new UpdateUseObjectOperator(valueNumber);
    newEquation(cell1, op, cell2);
}
Also used : DF_LatticeCell(org.jikesrvm.compilers.opt.dfsolver.DF_LatticeCell)

Example 3 with DF_LatticeCell

use of org.jikesrvm.compilers.opt.dfsolver.DF_LatticeCell in project JikesRVM by JikesRVM.

the class IndexPropagationSystem method addUpdateArrayUseEquation.

/**
 * Add an equation to the system of the form
 * <pre>
 * L(A1) = updateUse(L(A2), &lt;VALNUM(array),VALNUM(index)&gt;)
 * </pre>
 *
 * @param A1 variable in the equation
 * @param A2 variable in the equation
 * @param array variable in the equation
 * @param index variable in the equation
 */
void addUpdateArrayUseEquation(HeapVariable<?> A1, HeapVariable<?> A2, Object array, Object index) {
    DF_LatticeCell cell1 = findOrCreateCell(A1);
    DF_LatticeCell cell2 = findOrCreateCell(A2);
    int arrayNumber = valueNumbers.getValueNumber(array);
    int indexNumber = valueNumbers.getValueNumber(index);
    UpdateUseArrayOperator op = new UpdateUseArrayOperator(arrayNumber, indexNumber);
    newEquation(cell1, op, cell2);
}
Also used : DF_LatticeCell(org.jikesrvm.compilers.opt.dfsolver.DF_LatticeCell)

Example 4 with DF_LatticeCell

use of org.jikesrvm.compilers.opt.dfsolver.DF_LatticeCell in project JikesRVM by JikesRVM.

the class IndexPropagationSystem method addUpdateObjectDefEquation.

/**
 * Add an equation to the system of the form
 * L(A1) = updateDef(L(A2), VALNUM(address))
 *
 * @param A1 variable in the equation
 * @param A2 variable in the equation
 * @param valueNumber value number of the address
 */
void addUpdateObjectDefEquation(HeapVariable<?> A1, HeapVariable<?> A2, int valueNumber) {
    DF_LatticeCell cell1 = findOrCreateCell(A1);
    DF_LatticeCell cell2 = findOrCreateCell(A2);
    UpdateDefObjectOperator op = new UpdateDefObjectOperator(valueNumber);
    newEquation(cell1, op, cell2);
}
Also used : DF_LatticeCell(org.jikesrvm.compilers.opt.dfsolver.DF_LatticeCell)

Example 5 with DF_LatticeCell

use of org.jikesrvm.compilers.opt.dfsolver.DF_LatticeCell in project JikesRVM by JikesRVM.

the class IndexPropagationSystem method initializeLatticeCells.

/**
 * Initialize the lattice variables.
 */
@Override
protected void initializeLatticeCells() {
    // set the lattice cells that are exposed on entry to BOTTOM
    for (DF_LatticeCell c : cells.values()) {
        if (c instanceof ObjectCell) {
            ObjectCell c1 = (ObjectCell) c;
            HeapVariable<?> key = c1.getKey();
            if (key.isExposedOnEntry()) {
                c1.setBOTTOM();
            }
        } else {
            ArrayCell c1 = (ArrayCell) c;
            HeapVariable<?> key = c1.getKey();
            if (key.isExposedOnEntry()) {
                c1.setBOTTOM();
            }
        }
    }
}
Also used : ArrayCell(org.jikesrvm.compilers.opt.ssa.IndexPropagation.ArrayCell) DF_LatticeCell(org.jikesrvm.compilers.opt.dfsolver.DF_LatticeCell) ObjectCell(org.jikesrvm.compilers.opt.ssa.IndexPropagation.ObjectCell)

Aggregations

DF_LatticeCell (org.jikesrvm.compilers.opt.dfsolver.DF_LatticeCell)11 BasicBlock (org.jikesrvm.compilers.opt.ir.BasicBlock)4 ArrayCell (org.jikesrvm.compilers.opt.ssa.IndexPropagation.ArrayCell)2 ObjectCell (org.jikesrvm.compilers.opt.ssa.IndexPropagation.ObjectCell)2 Enumeration (java.util.Enumeration)1 TypeReference (org.jikesrvm.classloader.TypeReference)1 OptimizingCompilerException (org.jikesrvm.compilers.opt.OptimizingCompilerException)1 HeapOperand (org.jikesrvm.compilers.opt.ir.operand.HeapOperand)1 Operand (org.jikesrvm.compilers.opt.ir.operand.Operand)1