Methods Summary |
---|
public void | accept(SsaInsn.Visitor v){@inheritDoc}
v.visitPhiInsn(this);
|
public void | addPhiOperand(RegisterSpec registerSpec, SsaBasicBlock predBlock)Add an operand to this phi instruction
operands.add(new Operand(registerSpec, predBlock.getIndex(),
predBlock.getRopLabel()));
// in case someone has already called getSources()
sources = null;
|
public boolean | areAllOperandsEqual()
if (operands.size() == 0 ) {
// this should never happen
return true;
}
int firstReg = operands.get(0).regSpec.getReg();
for (Operand o: operands) {
if (firstReg != o.regSpec.getReg()) {
return false;
}
}
return true;
|
public boolean | canThrow(){@inheritDoc}
Always returns false for PhiInsn s
return false;
|
void | changeResultType(com.android.dx.rop.type.TypeBearer type, LocalItem local)Changes the result type. Used during phi type resolution
result = RegisterSpec.makeLocalOptional(result.getReg(), type, local);
|
public com.android.dx.ssa.PhiInsn | clone()
throw new UnsupportedOperationException("can't clone phi");
|
public Rop | getOpcode(){@inheritDoc}
Always returns null for PhiInsn s
return null;
|
public Insn | getOriginalRopInsn(){@inheritDoc}
Always returns null for PhiInsn s
return null;
|
int | getRopResultReg()
return ropResultReg;
|
public RegisterSpecList | getSources()Gets sources. Constructed lazily from phi operand data structures and
then cached.
if (sources != null) {
return sources;
}
if (operands.size() == 0) {
// How'd this happen? A phi insn with no operand?
return RegisterSpecList.EMPTY;
}
int szSources = operands.size();
sources = new RegisterSpecList(szSources);
for (int i = 0; i < szSources; i++) {
Operand o = operands.get(i);
sources.set(i, o.regSpec);
}
sources.setImmutable();
return sources;
|
public boolean | hasSideEffect(){@inheritDoc}
return Optimizer.getPreserveLocals() && getLocalAssignment() != null;
|
public boolean | isPhiOrMove(){@inheritDoc}
return true;
|
public boolean | isRegASource(int reg){@inheritDoc}
/*
* Avoid creating a sources list in case it has not already been
* created
*/
for (Operand o: operands) {
if (o.regSpec.getReg() == reg) {
return true;
}
}
return false;
|
public final void | mapSourceRegisters(RegisterMapper mapper){@inheritDoc}
for (Operand o: operands) {
RegisterSpec old = o.regSpec;
o.regSpec = mapper.map(old);
if (old != o.regSpec) {
block.getParent().onSourceChanged(this, old, o.regSpec);
}
}
sources = null;
|
public int | predBlockIndexForSourcesIndex(int sourcesIndex)Gets the index of the pred block associated with the RegisterSpec
at the particular getSources() index.
return operands.get(sourcesIndex).blockIndex;
|
public java.util.List | predBlocksForReg(int reg, SsaMethod ssaMeth)Returns the list of predecessor blocks associated with all operands
that have reg as an operand register.
ArrayList<SsaBasicBlock> ret
= (ArrayList<SsaBasicBlock>)new ArrayList();
for (Operand o: operands) {
if (o.regSpec.getReg() == reg) {
ret.add(ssaMeth.getBlocks().get(o.blockIndex));
}
}
return ret;
|
public java.lang.String | toHuman()
return toHumanWithInline(null);
|
protected final java.lang.String | toHumanWithInline(java.lang.String extra)Returns human-readable string for listing dumps.
Allows sub-classes to specify extra text
StringBuffer sb = new StringBuffer(80);
sb.append(SourcePosition.NO_INFO);
sb.append(": ");
sb.append("phi");
if (extra != null) {
sb.append("(");
sb.append(extra);
sb.append(")");
}
if (result == null) {
sb.append(" .");
} else {
sb.append(" ");
sb.append(result.toHuman());
}
sb.append(" <-");
int sz = getSources().size();
if (sz == 0) {
sb.append(" .");
} else {
for (int i = 0; i < sz; i++) {
sb.append(" ");
sb.append(sources.get(i).toHuman()
+ "[b="
+ Hex.u2(operands.get(i).ropLabel) + "]");
}
}
return sb.toString();
|
public Insn | toRopInsn()Always throws an exeption, since
a phi insn may not be converted back to rop form
throw new IllegalArgumentException(
"Cannot convert phi insns to rop form");
|
void | updateSourcesToDefinitions(SsaMethod ssaMeth)Updates the TypeBearers of all the sources (phi operands) to be
the current TypeBearer of the register-defining instruction's result.
This is used during phi-type resolution.
Note that local association of operands are preserved in this step.
for (Operand o: operands) {
RegisterSpec def
= ssaMeth.getDefinitionForRegister(
o.regSpec.getReg()).getResult();
o.regSpec = o.regSpec.withType(def.getType());
}
sources = null;
|