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

public Class FirstFitAllocator

extends RegisterAllocator
Class Inheritance
Imports
org.droidparts.dexmaker.dx.rop.code.CstInsn, org.droidparts.dexmaker.dx.rop.cst.CstInteger, org.droidparts.dexmaker.dx.ssa.BasicRegisterMapper, .NormalSsaInsn, .RegisterMapper, .SsaMethod, org.droidparts.dexmaker.dx.util.BitIntSet, .IntSet, java.util.BitSet

Allocates registers via a naive n^2 register allocator. This allocator does not try to co-locate local variables or deal intelligently with different size register uses.

Field Summary

Modifier and TypeField and Description
private final BitSet
mapped

indexed by old reg; the set of old regs we've mapped

private static final boolean
PRESLOT_PARAMS

If true, allocator places parameters at the top of the frame in calling-convention order.

Inherited from org.droidparts.dexmaker.dx.ssa.back.RegisterAllocator:
interferencessaMeth

Constructor Summary

AccessConstructor and Description
public
FirstFitAllocator(final SsaMethod ssaMeth, final InterferenceGraph interference)

Method Summary

Modifier and TypeMethod and Description
public RegisterMapper
private int

Returns:

parameter number (offset in the total parameter width)
paramNumberFromMoveParam
(NormalSsaInsn
a move-param insn (otherwise, exceptions will be thrown)
ndefInsn
)

Returns the parameter number that this move-param insn refers to

public boolean
wantsParamsMovedHigh()

Implements abstract org.droidparts.dexmaker.dx.ssa.back.RegisterAllocator.wantsParamsMovedHigh.

Indicates whether the method params were allocated at the bottom of the namespace, and thus should be moved up to the top of the namespace after phi removal.
Inherited from org.droidparts.dexmaker.dx.ssa.back.RegisterAllocator:
getCategoryForSsaReggetDefinitionSpecForSsaReginsertMoveBeforeisDefinitionMoveParam

Field Detail

mappedback to summary
private final BitSet mapped

indexed by old reg; the set of old regs we've mapped

PRESLOT_PARAMSback to summary
private static final boolean PRESLOT_PARAMS

If true, allocator places parameters at the top of the frame in calling-convention order.

Constructor Detail

FirstFitAllocatorback to summary
public FirstFitAllocator(final SsaMethod ssaMeth, final InterferenceGraph interference)

Method Detail

allocateRegistersback to summary
public RegisterMapper allocateRegisters()

Implements abstract org.droidparts.dexmaker.dx.ssa.back.RegisterAllocator.allocateRegisters.

Doc from org.droidparts.dexmaker.dx.ssa.back.RegisterAllocator.allocateRegisters.

Runs the algorithm.

Returns:RegisterMapper

a register mapper to apply to the SsaMethod

Annotations
@Override
paramNumberFromMoveParamback to summary
private int paramNumberFromMoveParam(NormalSsaInsn ndefInsn)

Returns the parameter number that this move-param insn refers to

Parameters
ndefInsn:NormalSsaInsn

a move-param insn (otherwise, exceptions will be thrown)

Returns:int

parameter number (offset in the total parameter width)

wantsParamsMovedHighback to summary
public boolean wantsParamsMovedHigh()

Implements abstract org.droidparts.dexmaker.dx.ssa.back.RegisterAllocator.wantsParamsMovedHigh.

Doc from org.droidparts.dexmaker.dx.ssa.back.RegisterAllocator.wantsParamsMovedHigh.

Indicates whether the method params were allocated at the bottom of the namespace, and thus should be moved up to the top of the namespace after phi removal.

Returns:boolean

true if params should be moved from low to high

Annotations
@Override