/** * Assigns registers to this local. * * @return the number of registers required. */ int initialize(int nextAvailableRegister) { this.reg = nextAvailableRegister; this.spec = RegisterSpec.make(nextAvailableRegister, type.ropType); return size(); }
RegisterSpec rs = sources.get(i); if (rs.getBasicType() != Type.BT_VOID) { first = rs; firstIndex = i; LocalItem firstLocal = first.getLocalItem(); TypeBearer mergedType = first.getType(); boolean sameLocals = true; for (int i = 0 ; i < szSources ; i++) { if (rs.getBasicType() == Type.BT_VOID){ continue; && equalsHandlesNulls(firstLocal, rs.getLocalItem()); mergedType = Merger.mergeType(mergedType, rs.getType()); sb.append(sources.get(i).toString()); sb.append(' '); if ((result.getTypeBearer() == newResultType) && equalsHandlesNulls(newLocal, result.getLocalItem())) { return false;
&& (definsn.getResult().getBasicType() == Type.BT_VOID)) { worklist.set(reg); RegisterSpec resultReg = useInsn.getResult(); if (resultReg != null && useInsn instanceof PhiInsn) { worklist.set(resultReg.getReg());
@Override public RegisterSpec map(RegisterSpec registerSpec) { if (registerSpec.getReg() == origReg.getReg()) { return newReg.withLocalItem( registerSpec.getLocalItem()); } return registerSpec; } };
/** * Returns the local variable listing string for a single register spec. * * @param spec {@code non-null;} the spec to convert * @return {@code non-null;} the string form */ public static String localString(RegisterSpec spec) { return spec.regString() + ' ' + spec.getLocalItem().toString() + ": " + spec.getTypeBearer().toHuman(); }
/** * Checks to see if old namespace reg {@code oldReg} interferes * with what currently maps to {@code newReg}. * * @param oldSpec {@code non-null;} old namespace register * @param newReg new namespace register * @return true if oldReg will interfere with newReg */ public boolean interferes(RegisterSpec oldSpec, int newReg) { return interferes(oldSpec.getReg(), newReg, oldSpec.getCategory()); }
/** * Returns whether or not this instance matches the given spec. * * @param otherSpec {@code non-null;} the spec in question * @return {@code true} iff this instance matches * {@code spec} */ public boolean matches(RegisterSpec otherSpec) { return spec.equalsUsingSimpleType(otherSpec); }
/** {@inheritDoc} */ @Override public boolean equals(Object other) { if (!(other instanceof RegisterSpec)) { return false; } RegisterSpec spec = (RegisterSpec) other; return equals(spec.reg, spec.type, spec.local); }
/** * Returns the proper move instruction for the given source spec * and destination index. * * @param src {@code non-null;} the source register spec * @param destIndex {@code >= 0;} the destination register index * @return {@code non-null;} the appropriate move instruction */ private static SimpleInsn moveInsnFor(RegisterSpec src, int destIndex) { return DalvInsn.makeMove(SourcePosition.NO_INFO, RegisterSpec.make(destIndex, src.getType()), src); } }
/** * Processes the given register spec. * * @param spec {@code non-null;} the register spec */ private void processReg(RegisterSpec spec) { int reg = spec.getNextReg(); if (reg > regCount) { regCount = reg; } } }
/** {@inheritDoc} */ @Override public void visitMoveInsn (NormalSsaInsn insn) { // If we're tracking local vars, some moves have side effects. if (!hasSideEffect(insn)) { noSideEffectRegs.set(insn.getResult().getReg()); } }
/** * Construct a {@code RegisterSpec} of this instance's * contents. * * @return {@code non-null;} an appropriately-constructed instance */ public RegisterSpec toRegisterSpec() { return new RegisterSpec(reg, type, local); }
/** * Compares by (in priority order) address, end then start * disposition (variants of end are all consistered * equivalent), and spec. * * @param other {@code non-null;} entry to compare to * @return {@code -1..1;} standard result of comparison */ public int compareTo(Entry other) { if (address < other.address) { return -1; } else if (address > other.address) { return 1; } boolean thisIsStart = isStart(); boolean otherIsStart = other.isStart(); if (thisIsStart != otherIsStart) { return thisIsStart ? 1 : -1; } return spec.compareTo(other.spec); }
/** * Changes the result type. Used during phi type resolution * * @param type {@code non-null;} new TypeBearer * @param local {@code null-ok;} new local info, if available */ public void changeResultType(TypeBearer type, LocalItem local) { setResult(RegisterSpec.makeLocalOptional( getResult().getReg(), type, local)); }
/** * Gets the next available register number after the one in this * instance. This is equal to the register number plus the width * (category) of the type used. Among other things, this may also * be used to determine the minimum required register count * implied by this instance. * * @return {@code >= 0;} the required registers size */ public int getNextReg() { return reg + getCategory(); }
/** * Gets the variable signature. * * @return {@code null-ok;} the variable signature */ public CstString getSignature() { return spec.getLocalItem().getSignature(); }
RegisterSpec rs = sources.get(i); if (rs.getBasicType() != Type.BT_VOID) { first = rs; firstIndex = i; LocalItem firstLocal = first.getLocalItem(); TypeBearer mergedType = first.getType(); boolean sameLocals = true; for (int i = 0 ; i < szSources ; i++) { if (rs.getBasicType() == Type.BT_VOID){ continue; && equalsHandlesNulls(firstLocal, rs.getLocalItem()); mergedType = Merger.mergeType(mergedType, rs.getType()); sb.append(sources.get(i).toString()); sb.append(' '); if ((result.getTypeBearer() == newResultType) && equalsHandlesNulls(newLocal, result.getLocalItem())) { return false;
&& (definsn.getResult().getBasicType() == Type.BT_VOID)) { worklist.set(reg); RegisterSpec resultReg = useInsn.getResult(); if (resultReg != null && useInsn instanceof PhiInsn) { worklist.set(resultReg.getReg());
@Override public RegisterSpec map(RegisterSpec registerSpec) { if (registerSpec.getReg() == origReg.getReg()) { return newReg.withLocalItem( registerSpec.getLocalItem()); } return registerSpec; } };
/** * Checks to see if old namespace reg {@code oldReg} interferes * with what currently maps to {@code newReg}. * * @param oldSpec {@code non-null;} old namespace register * @param newReg new namespace register * @return true if oldReg will interfere with newReg */ public boolean interferes(RegisterSpec oldSpec, int newReg) { return interferes(oldSpec.getReg(), newReg, oldSpec.getCategory()); }