# HG changeset patch # User Roland Schatz # Date 1363094686 -3600 # Node ID 7a81fbcd67bbaa805cfd0b99f2b1b111f43e15e3 # Parent 2c5df42999dd9236e31f5ff01c1033affdb96679 Debug option to reduce available registers. diff -r 2c5df42999dd -r 7a81fbcd67bb graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Tue Mar 12 10:02:20 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Tue Mar 12 14:24:46 2013 +0100 @@ -282,7 +282,6 @@ * @return the created interval */ Interval createInterval(Value operand) { - assert isProcessed(operand); assert isLegal(operand); int operandNumber = operandNumber(operand); Interval interval = new Interval(operand, operandNumber); @@ -1951,12 +1950,6 @@ throw new GraalInternalError(""); } - if (!isProcessed(i1.location())) { - TTY.println("Can not have an Interval for an ignored register " + i1.location()); - TTY.println(i1.logString(this)); - throw new GraalInternalError(""); - } - if (i1.first() == Range.EndMarker) { TTY.println("Interval %d has no Range", i1.operandNumber); TTY.println(i1.logString(this)); diff -r 2c5df42999dd -r 7a81fbcd67bb graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterConfig.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterConfig.java Tue Mar 12 10:02:20 2013 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterConfig.java Tue Mar 12 14:24:46 2013 +0100 @@ -33,15 +33,12 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.*; +import com.oracle.graal.phases.*; // @formatter:off public class AMD64HotSpotRegisterConfig implements RegisterConfig { - private final Register[] allocatable = { - rax, rbx, rcx, rdx, /*rsp,*/ rbp, rsi, rdi, r8, r9, /* r10, */r11, r12, r13, r14, /*r15, */ - xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, - xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15 - }; + private final Register[] allocatable = initAllocatable(); private final EnumMap categorized = Register.categorize(allocatable); @@ -68,6 +65,34 @@ private final CalleeSaveLayout csl; + private static Register findRegister(String name, Register[] all) { + for (Register reg : all) { + if (reg.name.equals(name)) { + return reg; + } + } + throw new IllegalArgumentException("register " + name + " is not allocatable"); + } + + private static Register[] initAllocatable() { + Register[] allocatable = { + rax, rbx, rcx, rdx, /*rsp,*/ rbp, rsi, rdi, r8, r9, /* r10, */r11, r12, r13, r14, /*r15, */ + xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, + xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15 + }; + + if (GraalOptions.RegisterPressure != null) { + String[] names = GraalOptions.RegisterPressure.split(","); + Register[] regs = new Register[names.length]; + for (int i = 0; i < names.length; i++) { + regs[i] = findRegister(names[i], allocatable); + } + return regs; + } + + return allocatable; + } + public AMD64HotSpotRegisterConfig(HotSpotVMConfig config, boolean globalStubConfig) { if (config.windowsOs) { javaGeneralParameterRegisters = new Register[] {rdx, r8, r9, rdi, rsi, rcx}; diff -r 2c5df42999dd -r 7a81fbcd67bb graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Tue Mar 12 10:02:20 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Tue Mar 12 14:24:46 2013 +0100 @@ -148,6 +148,9 @@ public static boolean ExitVMOnBailout = ____; public static boolean ExitVMOnException = true; + // Register allocator debugging + public static String RegisterPressure = null; + // Code generator settings public static boolean ConditionalElimination = true; public static boolean CullFrameStates = ____;