public abstract class RegisterMapper extends Object
Represents a mapping between two register numbering schemes.
Subclasses of this may be mutable, and as such the mapping provided
is only valid for the lifetime of the method call in which
instances of this class are passed.
new mapped register list, or old if nothing has changed.
int sz = sources.size();
RegisterSpecList newSources = new RegisterSpecList(sz);
for (int i = 0; i < sz; i++) {
newSources.set(i, map(sources.get(i)));
}
newSources.setImmutable();
// Return the old sources if nothing has changed.
return newSources.equals(sources) ? sources : newSources;
new mapped register set, or old if nothing has changed.
int sz = sources.getMaxSize();
RegisterSpecSet newSources = new RegisterSpecSet(getNewRegisterCount());
for (int i = 0; i < sz; i++) {
RegisterSpec registerSpec = sources.get(i);
if (registerSpec != null) {
newSources.put(map(registerSpec));
}
}
newSources.setImmutable();
// Return the old sources if nothing has changed.
return newSources.equals(sources) ? sources : newSources;