Mercurial > hg > graal-compiler
changeset 22688:93859a908b32
TraceRA: respect neverSpillConstants option.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Wed, 23 Sep 2015 11:35:57 +0200 |
parents | fdfe748e98d8 |
children | 87c6d0fe96e9 |
files | graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/trace/TraceLinearScanLifetimeAnalysisPhase.java |
diffstat | 1 files changed, 19 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/trace/TraceLinearScanLifetimeAnalysisPhase.java Wed Sep 23 11:34:38 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/trace/TraceLinearScanLifetimeAnalysisPhase.java Wed Sep 23 11:35:57 2015 +0200 @@ -47,6 +47,7 @@ import jdk.internal.jvmci.meta.LIRKind; import jdk.internal.jvmci.meta.Value; +import com.oracle.graal.compiler.common.BackendOptions; import com.oracle.graal.compiler.common.alloc.ComputeBlockOrder; import com.oracle.graal.compiler.common.alloc.RegisterAllocationConfig; import com.oracle.graal.compiler.common.alloc.TraceBuilder.TraceBuilderResult; @@ -627,6 +628,10 @@ } } + protected static Boolean neverSpillConstants() { + return BackendOptions.UserOptions.NeverSpillConstants.getValue(); + } + /** * Returns a value for a interval definition, which can be used for re-materialization. * @@ -641,18 +646,20 @@ if (op instanceof LoadConstantOp) { LoadConstantOp move = (LoadConstantOp) op; if (move.getConstant() instanceof JavaConstant) { - /* - * Check if the interval has any uses which would accept an stack location - * (priority == ShouldHaveRegister). Rematerialization of such intervals can - * result in a degradation, because rematerialization always inserts a constant - * load, even if the value is not needed in a register. - */ - UsePosList usePosList = interval.usePosList(); - int numUsePos = usePosList.size(); - for (int useIdx = 0; useIdx < numUsePos; useIdx++) { - TraceInterval.RegisterPriority priority = usePosList.registerPriority(useIdx); - if (priority == TraceInterval.RegisterPriority.ShouldHaveRegister) { - return null; + if (!neverSpillConstants()) { + /* + * Check if the interval has any uses which would accept an stack location + * (priority == ShouldHaveRegister). Rematerialization of such intervals can + * result in a degradation, because rematerialization always inserts a + * constant load, even if the value is not needed in a register. + */ + UsePosList usePosList = interval.usePosList(); + int numUsePos = usePosList.size(); + for (int useIdx = 0; useIdx < numUsePos; useIdx++) { + TraceInterval.RegisterPriority priority = usePosList.registerPriority(useIdx); + if (priority == TraceInterval.RegisterPriority.ShouldHaveRegister) { + return null; + } } } return (JavaConstant) move.getConstant();