private void visitInstruction(Instruction instr) { if (instr instanceof StartingInstruction) { StartingInstruction startingInstr = (StartingInstruction) instr; Instruction_phi phi = startingInstr.getInstruction(); EList<BasicBlockRef> labels = phi.getLabels(); int valueIndex = 0; for (BasicBlockRef blockRef : labels) { BasicBlock block = blockRef.getRef(); List<Phi> valueRefs = basicBlockReferences.get(block); ValueRef valueRef = phi.getValues().get(valueIndex++); valueRefs.add(new Phi(startingInstr.getName(), valueRef, phi.getType(), startingInstr)); } } }
public LocalValueRefImpl getLocalVariablesInPhi(BasicBlock block) { int i = 0; Instruction_phi instruction = getStartingInstr().getInstruction(); for (BasicBlockRef label : instruction.getLabels()) { if (label.getRef().equals(block)) { break; } i++; } ValueRef value = instruction.getValues().get(i); if (value instanceof LocalValueRefImpl) { return (LocalValueRefImpl) value; } else { return null; } }
@Override public ResolvedType caseInstruction_phi(Instruction_phi object) { return resolve(object.getType()); }