Top Description Fields Constructors Methods
org.droidparts.dexmaker.dx.ssa

public Class InterferenceRegisterMapper

extends BasicRegisterMapper
Class Inheritance
Imports
org.droidparts.dexmaker.dx.rop.code.RegisterSpec, .RegisterSpecList, org.droidparts.dexmaker.dx.ssa.back.InterferenceGraph, org.droidparts.dexmaker.dx.util.BitIntSet, .IntSet, java.util.ArrayList

A register mapper that keeps track of the accumulated interference information for the registers in the new namespace. Please note that this mapper requires that the old namespace does not have variable register widths/categories, and the new namespace does.

Field Summary

Modifier and TypeField and Description
private final ArrayList<BitIntSet>
newRegInterference

Array of interference sets.

private final InterferenceGraph
oldRegInterference

the interference graph for the old namespace

Constructor Summary

AccessConstructor and Description
public
InterferenceRegisterMapper(InterferenceGraph oldRegInterference, int
number of registers in old namespace
countOldRegisters
)

Constructs an instance

Method Summary

Modifier and TypeMethod and Description
private void
addInterfence(int
register in new namespace
newReg
,
int
register in old namespace
oldReg
)

Adds a register's interference set to the interference list, growing it if necessary.

public void
addMapping(int
>= 0; old register
oldReg
,
int
>= 0; new register
newReg
,
int
1..2; width of reg
category
)

Overrides org.droidparts.dexmaker.dx.ssa.BasicRegisterMapper.addMapping.

Adds a mapping to the mapper.
public boolean

Returns:

true if any of the old-namespace register have been mapped to the new-namespace register + category
areAnyPinned
(RegisterSpecList
non-null; set of old-namespace regs
oldSpecs
,
int
>= 0; new-namespace register
newReg
,
int
1..2; the number of adjacent new-namespace registers (starting at ropReg) to consider
targetCategory
)

Checks to see if any of a set of old-namespace registers are pinned to the specified new-namespace reg + category.

public boolean

Returns:

true if oldReg will interfere with newReg
interferes
(int
old namespace register
oldReg
,
int
new namespace register
newReg
,
int
category of old namespace register
category
)

Checks to see if old namespace reg oldReg interferes with what currently maps to newReg.

public boolean

Returns:

true if oldReg will interfere with newReg
interferes
(RegisterSpec
non-null; old namespace register
oldSpec
,
int
new namespace register
newReg
)

Checks to see if old namespace reg oldReg interferes with what currently maps to newReg.

Inherited from org.droidparts.dexmaker.dx.ssa.BasicRegisterMapper:
getNewRegisterCountmapoldToNewtoHuman

Field Detail

newRegInterferenceback to summary
private final ArrayList<BitIntSet> newRegInterference

Array of interference sets. ArrayList is indexed by new namespace and BitIntSet's are indexed by old namespace. The list expands as needed and missing items are assumed to interfere with nothing. Bit sets are always used here, unlike elsewhere, because the max size of this matrix will be (countSsaRegs * countRopRegs), which may grow to hundreds of K but not megabytes.

oldRegInterferenceback to summary
private final InterferenceGraph oldRegInterference

the interference graph for the old namespace

Constructor Detail

InterferenceRegisterMapperback to summary
public InterferenceRegisterMapper(InterferenceGraph oldRegInterference, int countOldRegisters)

Constructs an instance

Parameters
countOldRegisters:int

number of registers in old namespace

Method Detail

addInterfenceback to summary
private void addInterfence(int newReg, int oldReg)

Adds a register's interference set to the interference list, growing it if necessary.

Parameters
newReg:int

register in new namespace

oldReg:int

register in old namespace

addMappingback to summary
public void addMapping(int oldReg, int newReg, int category)

Overrides org.droidparts.dexmaker.dx.ssa.BasicRegisterMapper.addMapping.

Doc from org.droidparts.dexmaker.dx.ssa.BasicRegisterMapper.addMapping.

Adds a mapping to the mapper. If oldReg has already been mapped, overwrites previous mapping with new mapping.

Parameters
oldReg:int

>= 0; old register

newReg:int

>= 0; new register

category:int

1..2; width of reg

Annotations
@Override
areAnyPinnedback to summary
public boolean areAnyPinned(RegisterSpecList oldSpecs, int newReg, int targetCategory)

Checks to see if any of a set of old-namespace registers are pinned to the specified new-namespace reg + category. Takes into account the category of the old-namespace registers.

Parameters
oldSpecs:RegisterSpecList

non-null; set of old-namespace regs

newReg:int

>= 0; new-namespace register

targetCategory:int

1..2; the number of adjacent new-namespace registers (starting at ropReg) to consider

Returns:boolean

true if any of the old-namespace register have been mapped to the new-namespace register + category

interferesback to summary
public boolean interferes(int oldReg, int newReg, int category)

Checks to see if old namespace reg oldReg interferes with what currently maps to newReg.

Parameters
oldReg:int

old namespace register

newReg:int

new namespace register

category:int

category of old namespace register

Returns:boolean

true if oldReg will interfere with newReg

interferesback to summary
public boolean interferes(RegisterSpec oldSpec, int newReg)

Checks to see if old namespace reg oldReg interferes with what currently maps to newReg.

Parameters
oldSpec:RegisterSpec

non-null; old namespace register

newReg:int

new namespace register

Returns:boolean

true if oldReg will interfere with newReg