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);
}
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);
}
}
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);
}
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));
}
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);
}
Aggregations