# HG changeset patch # User Josef Eisl # Date 1428930655 -7200 # Node ID 916aac9fe6f7e594973e31263a4c986e767449e2 # Parent 4278c6500f2a2ee390b6b746877b2d0563effa72 LinearScan: use RegisterAllocationConfig. diff -r 4278c6500f2a -r 916aac9fe6f7 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScan.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScan.java Mon Apr 13 15:01:46 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScan.java Mon Apr 13 15:10:55 2015 +0200 @@ -66,6 +66,7 @@ final SpillMoveFactory spillMoveFactory; final RegisterAttributes[] registerAttributes; final Register[] registers; + final RegisterAllocationConfig regAllocConfig; final boolean callKillsRegisters; @@ -163,14 +164,15 @@ */ private final int firstVariableNumber; - LinearScan(TargetDescription target, LIRGenerationResult res, SpillMoveFactory spillMoveFactory) { + LinearScan(TargetDescription target, LIRGenerationResult res, SpillMoveFactory spillMoveFactory, RegisterAllocationConfig regAllocConfig) { this.target = target; this.res = res; this.ir = res.getLIR(); this.spillMoveFactory = spillMoveFactory; this.frameMapBuilder = res.getFrameMapBuilder(); this.sortedBlocks = ir.linearScanOrder(); - this.registerAttributes = frameMapBuilder.getRegisterConfig().getAttributesMap(); + this.registerAttributes = regAllocConfig.getRegisterConfig().getAttributesMap(); + this.regAllocConfig = regAllocConfig; this.registers = target.arch.getRegisters(); this.firstVariableNumber = registers.length; @@ -178,7 +180,7 @@ // If all allocatable registers are caller saved, then no registers are live across a call // site. The register allocator can save time not trying to find a register at a call site. - this.callKillsRegisters = this.frameMapBuilder.getRegisterConfig().areAllAllocatableRegistersCallerSaved(); + this.callKillsRegisters = regAllocConfig.getRegisterConfig().areAllAllocatableRegistersCallerSaved(); } int getFirstLirInstructionId(AbstractBlockBase block) { @@ -1169,7 +1171,7 @@ }; // create a list with all caller-save registers (cpu, fpu, xmm) - Register[] callerSaveRegs = frameMapBuilder.getRegisterConfig().getCallerSaveRegisters(); + Register[] callerSaveRegs = regAllocConfig.getRegisterConfig().getCallerSaveRegisters(); // iterate all blocks in reverse order for (int i = blockCount() - 1; i >= 0; i--) { diff -r 4278c6500f2a -r 916aac9fe6f7 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanPhase.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanPhase.java Mon Apr 13 15:01:46 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanPhase.java Mon Apr 13 15:10:55 2015 +0200 @@ -25,6 +25,7 @@ import java.util.*; import com.oracle.graal.api.code.*; +import com.oracle.graal.compiler.common.alloc.*; import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.lir.gen.*; import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; @@ -34,7 +35,7 @@ @Override protected > void run(TargetDescription target, LIRGenerationResult lirGenRes, List codeEmittingOrder, List linearScanOrder, SpillMoveFactory spillMoveFactory) { - new LinearScan(target, lirGenRes, spillMoveFactory).allocate(); + new LinearScan(target, lirGenRes, spillMoveFactory, new RegisterAllocationConfig(lirGenRes.getFrameMapBuilder().getRegisterConfig())).allocate(); } } diff -r 4278c6500f2a -r 916aac9fe6f7 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanWalker.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanWalker.java Mon Apr 13 15:01:46 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanWalker.java Mon Apr 13 15:10:55 2015 +0200 @@ -766,8 +766,7 @@ } void initVarsForAlloc(Interval interval) { - RegisterConfig registerConfig = allocator.frameMapBuilder.getRegisterConfig(); - availableRegs = registerConfig.getAllocatableRegisters(interval.kind().getPlatformKind(), registerConfig.getAllocatableRegisters()); + availableRegs = allocator.regAllocConfig.getAllocatableRegisters(interval.kind().getPlatformKind()); } static boolean isMove(LIRInstruction op, Interval from, Interval to) { diff -r 4278c6500f2a -r 916aac9fe6f7 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/RegisterVerifier.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/RegisterVerifier.java Mon Apr 13 15:01:46 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/RegisterVerifier.java Mon Apr 13 15:10:55 2015 +0200 @@ -225,7 +225,7 @@ op.visitEachInput(useConsumer); // invalidate all caller save registers at calls if (op.destroysCallerSavedRegisters()) { - for (Register r : allocator.frameMapBuilder.getRegisterConfig().getCallerSaveRegisters()) { + for (Register r : allocator.regAllocConfig.getRegisterConfig().getCallerSaveRegisters()) { statePut(inputState, r.asValue(), null); } }