Methods Summary |
---|
public void | addMapping(int oldReg, int newReg, int category)Adds a mapping to the mapper. If oldReg has already been mapped,
overwrites previous mapping with new mapping.
if (oldReg >= oldToNew.size()) {
// expand the array as necessary
for (int i = oldReg - oldToNew.size(); i >= 0; i--) {
oldToNew.add(-1);
}
}
oldToNew.set(oldReg, newReg);
if (runningCountNewRegisters < (newReg + category)) {
runningCountNewRegisters = newReg + category;
}
|
public int | getNewRegisterCount(){@inheritDoc}
return runningCountNewRegisters;
|
public com.android.dx.rop.code.RegisterSpec | map(com.android.dx.rop.code.RegisterSpec registerSpec){@inheritDoc}
if (registerSpec == null) {
return null;
}
int newReg;
try {
newReg = oldToNew.get(registerSpec.getReg());
} catch (IndexOutOfBoundsException ex) {
newReg = -1;
}
if (newReg < 0) {
throw new RuntimeException("no mapping specified for register");
}
return registerSpec.withReg(newReg);
|
public int | oldToNew(int oldReg)Returns the new-namespace mapping for the specified
old-namespace register, or -1 if one exists.
if (oldReg >= oldToNew.size()) {
return -1;
}
return oldToNew.get(oldReg);
|
public java.lang.String | toHuman(){@inheritDoc}
StringBuilder sb = new StringBuilder();
sb.append("Old\tNew\n");
int sz = oldToNew.size();
for (int i = 0; i < sz; i++) {
sb.append(i);
sb.append('\t");
sb.append(oldToNew.get(i));
sb.append('\n");
}
sb.append("new reg count:");
sb.append(runningCountNewRegisters);
sb.append('\n");
return sb.toString();
|