FileDocCategorySizeDatePackage
RegisterMapper.javaAPI DocAndroid 5.1 API2740Thu Mar 12 22:18:30 GMT 2015com.android.dx.ssa

RegisterMapper

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.

Fields Summary
Constructors Summary
Methods Summary
public abstract intgetNewRegisterCount()
Gets the count of registers (really, the total register width, since category width is counted) in the new namespace.

return
>= 0 width of new namespace.

public abstract com.android.dx.rop.code.RegisterSpecmap(com.android.dx.rop.code.RegisterSpec registerSpec)

param
registerSpec old register
return
register in new space

public final com.android.dx.rop.code.RegisterSpecListmap(com.android.dx.rop.code.RegisterSpecList sources)

param
sources old register list
return
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;
    
public final com.android.dx.rop.code.RegisterSpecSetmap(com.android.dx.rop.code.RegisterSpecSet sources)

param
sources old register set
return
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;