changeset 4524:dcc8f5c6f394

Refactorings to prepare for LIR project splitting
author Christian Wimmer <Christian.Wimmer@Oracle.com>
date Wed, 08 Feb 2012 18:19:09 -0800
parents ade4281b79c3
children 681e969888a7
files graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/AssignRegisters.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/DataFlowAnalysis.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/LinearScanAllocator.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/ResolveDataFlow.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/SpillAllAllocator.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/IntervalPrinter.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/LocationMap.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/LocationUtil.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/MoveResolver.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/RegisterVerifier.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/ValueUtil.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/Interval.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScanWalker.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/asm/ExceptionInfo.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/asm/TargetMethodAssembler.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/cfg/ControlFlowGraph.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/PhiResolver.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/FrameMap.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIR.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRDebugInfo.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRInstruction.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRVerifier.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRXirInstruction.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/StandardOp.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/ValueUtil.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Arithmetic.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Call.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Compare.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64CompareToIntOpcode.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ControlFlow.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64DeoptimizationStub.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Move.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64XirOp.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/Util.java graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/GraalInternalError.java graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotRegisterConfig.java graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotTypePrimitive.java graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/target/amd64/AMD64TailcallOp.java graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/nodes/MathIntrinsicNode.java graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/target/amd64/AMD64MathIntrinsicOp.java
diffstat 46 files changed, 427 insertions(+), 514 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/AssignRegisters.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/AssignRegisters.java	Wed Feb 08 18:19:09 2012 -0800
@@ -22,15 +22,14 @@
  */
 package com.oracle.max.graal.alloc.simple;
 
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
+import static com.oracle.max.graal.alloc.util.LocationUtil.*;
 
 import com.oracle.max.cri.ci.*;
-import com.oracle.max.criutils.*;
 import com.oracle.max.graal.alloc.util.*;
-import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.cfg.*;
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.compiler.lir.LIRInstruction.ValueProcedure;
+import com.oracle.max.graal.debug.*;
 
 public abstract class AssignRegisters {
     public final LIR lir;
@@ -49,10 +48,10 @@
         ValueProcedure defProc =          new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return def(value); } };
         ValueProcedure setReferenceProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return setReference(value); } };
 
-        assert trace("==== start assign registers ====");
+        Debug.log("==== start assign registers ====");
         for (int i = lir.linearScanOrder().size() - 1; i >= 0; i--) {
             Block block = lir.linearScanOrder().get(i);
-            assert trace("start block %s", block);
+            Debug.log("start block %s", block);
 
             curRegisterRefMap = frameMap.initRegisterRefMap();
             curFrameRefMap = frameMap.initFrameRefMap();
@@ -62,7 +61,7 @@
 
             for (int j = block.lir.size() - 1; j >= 0; j--) {
                 LIRInstruction op = block.lir.get(j);
-                assert trace("  op %d %s", op.id(), op);
+                Debug.log("  op %d %s", op.id(), op);
 
                 op.forEachOutput(defProc);
                 op.forEachTemp(defProc);
@@ -70,7 +69,7 @@
                 op.forEachAlive(useProc);
 
                 if (op.info != null) {
-                    assert trace("    registerRefMap: %s  frameRefMap: %s", curRegisterRefMap, curFrameRefMap);
+                    Debug.log("    registerRefMap: %s  frameRefMap: %s", curRegisterRefMap, curFrameRefMap);
                     op.info.finish(new CiBitMap(curRegisterRefMap), new CiBitMap(curFrameRefMap), frameMap);
 
                     if (op instanceof LIRXirInstruction) {
@@ -85,13 +84,13 @@
                 // for the last time at this instruction are not part of the reference map.
                 op.forEachInput(useProc);
             }
-            assert trace("end block %s", block);
+            Debug.log("end block %s", block);
         }
-        assert trace("==== end assign registers ====");
+        Debug.log("==== end assign registers ====");
     }
 
     private CiValue use(CiValue value) {
-        assert trace("    use %s", value);
+        Debug.log("    use %s", value);
         if (isLocation(value)) {
             CiValue location = asLocation(value).location;
             frameMap.setReference(location, curRegisterRefMap, curFrameRefMap);
@@ -103,7 +102,7 @@
     }
 
     private CiValue def(CiValue value) {
-        assert trace("    def %s", value);
+        Debug.log("    def %s", value);
         if (isLocation(value)) {
             CiValue location = asLocation(value).location;
             frameMap.clearReference(location, curRegisterRefMap, curFrameRefMap);
@@ -115,17 +114,10 @@
     }
 
     private CiValue setReference(CiValue value) {
-        assert trace("    setReference %s", value);
+        Debug.log("    setReference %s", value);
         frameMap.setReference(asLocation(value).location, curRegisterRefMap, curFrameRefMap);
         return value;
     }
 
     protected abstract LocationMap locationsForBlockEnd(Block block);
-
-    private static boolean trace(String format, Object...args) {
-        if (GraalOptions.TraceRegisterAllocation) {
-            TTY.println(format, args);
-        }
-        return true;
-    }
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/DataFlowAnalysis.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/DataFlowAnalysis.java	Wed Feb 08 18:19:09 2012 -0800
@@ -23,18 +23,17 @@
 package com.oracle.max.graal.alloc.simple;
 
 import static com.oracle.max.cri.ci.CiValueUtil.*;
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
+import static com.oracle.max.graal.alloc.util.LocationUtil.*;
 
 import java.util.*;
 
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ri.*;
-import com.oracle.max.criutils.*;
-import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.alloc.*;
 import com.oracle.max.graal.compiler.cfg.*;
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.compiler.lir.LIRInstruction.ValueProcedure;
+import com.oracle.max.graal.debug.*;
 
 public class DataFlowAnalysis {
     private final LIR lir;
@@ -164,16 +163,16 @@
         blockLiveIn = new BitSet[blocks().size()];
         registerLive = new BitSet();
 
-        assert trace("==== start backward data flow analysis ====");
+        Debug.log("==== start backward data flow analysis ====");
         for (int i = blocks().size() - 1; i >= 0; i--) {
             Block block = blocks().get(i);
-            assert trace("start block %s  loop %s", block, block.getLoop());
+            Debug.log("start block %s  loop %s", block, block.getLoop());
 
             variableLive = new BitSet();
             for (Block sux : block.getSuccessors()) {
                 BitSet suxLive = liveIn(sux);
                 if (suxLive != null) {
-                    assert trace("  sux %s  suxLive: %s", sux, suxLive);
+                    Debug.log("  sux %s  suxLive: %s", sux, suxLive);
                     variableLive.or(suxLive);
                 }
             }
@@ -183,7 +182,7 @@
             for (int j = block.lir.size() - 1; j >= 0; j--) {
                 LIRInstruction op = block.lir.get(j);
                 curOpId = op.id();
-                assert trace("  op %d %s  variableLive: %s  registerLive: %s", curOpId, op, variableLive, registerLive);
+                Debug.log("  op %d %s  variableLive: %s  registerLive: %s", curOpId, op, variableLive, registerLive);
 
                 op.forEachOutput(outputProc);
                 op.forEachTemp(tempProc);
@@ -197,29 +196,29 @@
             setLiveIn(block, variableLive);
 
             if (block.isLoopHeader()) {
-                assert trace("  loop header, propagating live set to loop blocks  variableLive: %s", variableLive);
+                Debug.log("  loop header, propagating live set to loop blocks  variableLive: %s", variableLive);
                 // All variables that are live at the beginning of a loop are also live the whole loop.
                 // This is guaranteed by the SSA form.
                 for (Block loop : block.getLoop().blocks) {
                     BitSet loopLiveIn = liveIn(loop);
                     assert loopLiveIn != null : "All loop blocks must have been processed before the loop header";
                     loopLiveIn.or(variableLive);
-                    assert trace("    block %s  loopLiveIn %s", loop, loopLiveIn);
+                    Debug.log("    block %s  loopLiveIn %s", loop, loopLiveIn);
                 }
             }
 
-            assert trace("end block %s  variableLive: %s", block, variableLive);
+            Debug.log("end block %s  variableLive: %s", block, variableLive);
         }
-        assert trace("==== end backward data flow analysis ====");
+        Debug.log("==== end backward data flow analysis ====");
     }
 
     private CiValue use(CiValue value, int killOpId) {
-        assert trace("    use %s", value);
+        Debug.log("    use %s", value);
         if (isVariable(value)) {
             int variableIdx = asVariable(value).index;
             assert definitions[variableIdx] < curOpId;
             if (!variableLive.get(variableIdx)) {
-                assert trace("      set live variable %d", variableIdx);
+                Debug.log("      set live variable %d", variableIdx);
                 variableLive.set(variableIdx);
                 kill(value, killOpId);
             }
@@ -227,7 +226,7 @@
         } else if (isAllocatableRegister(value)) {
             int regNum = asRegister(value).number;
             if (!registerLive.get(regNum)) {
-                assert trace("      set live register %d", regNum);
+                Debug.log("      set live register %d", regNum);
                 registerLive.set(regNum);
                 kill(value, killOpId);
             }
@@ -236,12 +235,12 @@
     }
 
     private CiValue def(CiValue value, boolean isTemp) {
-        assert trace("    def %s", value);
+        Debug.log("    def %s", value);
         if (isVariable(value)) {
             int variableIdx = asVariable(value).index;
             assert definitions[variableIdx] == curOpId;
             if (variableLive.get(variableIdx)) {
-                assert trace("      clear live variable %d", variableIdx);
+                Debug.log("      clear live variable %d", variableIdx);
                 assert !isTemp : "temp variable cannot be used after the operation";
                 variableLive.clear(variableIdx);
             } else {
@@ -252,7 +251,7 @@
         } else if (isAllocatableRegister(value)) {
             int regNum = asRegister(value).number;
             if (registerLive.get(regNum)) {
-                assert trace("      clear live register %d", regNum);
+                Debug.log("      clear live register %d", regNum);
                 assert !isTemp : "temp variable cannot be used after the operation";
                 registerLive.clear(regNum);
             } else {
@@ -277,11 +276,11 @@
             if (useBlock.getLoop() != null && useBlock.getLoop() != defBlock.getLoop()) {
                 // This is a value defined outside of the loop it is currently used in.  Therefore, it is live the whole loop
                 // and is not killed by the current instruction.
-                assert trace("      no kill because use in %s, definition in %s", useBlock.getLoop(), defBlock.getLoop());
+                Debug.log("      no kill because use in %s, definition in %s", useBlock.getLoop(), defBlock.getLoop());
                 return;
             }
         }
-        assert trace("      kill %s at %d", value, opId);
+        Debug.log("      kill %s at %d", value, opId);
 
         Object entry = killedValues(opId);
         if (entry == null) {
@@ -302,11 +301,4 @@
             killed[oldLen] = value;
         }
     }
-
-    private static boolean trace(String format, Object...args) {
-        if (GraalOptions.TraceRegisterAllocation) {
-            TTY.println(format, args);
-        }
-        return true;
-    }
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/LinearScanAllocator.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/LinearScanAllocator.java	Wed Feb 08 18:19:09 2012 -0800
@@ -23,22 +23,20 @@
 package com.oracle.max.graal.alloc.simple;
 
 import static com.oracle.max.cri.ci.CiValueUtil.*;
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
+import static com.oracle.max.graal.alloc.util.LocationUtil.*;
 
 import java.util.*;
 
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ci.CiRegister.RegisterFlag;
-import com.oracle.max.criutils.*;
 import com.oracle.max.graal.alloc.util.*;
-import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.cfg.*;
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.compiler.lir.LIRInstruction.OperandFlag;
 import com.oracle.max.graal.compiler.lir.LIRInstruction.OperandMode;
 import com.oracle.max.graal.compiler.lir.LIRInstruction.ValueProcedure;
-import com.oracle.max.graal.compiler.util.*;
 import com.oracle.max.graal.debug.*;
+import com.oracle.max.graal.graph.*;
 
 public class LinearScanAllocator {
     private final LIR lir;
@@ -65,7 +63,7 @@
 
         @Override
         protected CiValue scratchRegister(Variable spilled) {
-            Util.shouldNotReachHere("needs working implementation");
+            GraalInternalError.shouldNotReachHere("needs working implementation");
 
             EnumMap<RegisterFlag, CiRegister[]> categorizedRegs = frameMap.registerConfig.getCategorizedAllocatableRegisters();
             CiRegister[] availableRegs = categorizedRegs.get(spilled.flag);
@@ -186,12 +184,12 @@
         ValueProcedure useProc =          new ValueProcedure() { @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet<OperandFlag> flags) { return use(value, mode, flags); } };
         ValueProcedure defProc =          new ValueProcedure() { @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet<OperandFlag> flags) { return def(value, mode, flags); } };
 
-        assert trace("==== start linear scan allocation ====");
+        Debug.log("==== start linear scan allocation ====");
         canonicalSpillLocations = new LocationMap(lir.numVariables());
         curInRegisterState = new CiValue[maxRegisterNum()];
         curOutRegisterState = new CiValue[maxRegisterNum()];
         for (Block block : lir.linearScanOrder()) {
-            assert trace("start block %s %s", block, block.getLoop());
+            Debug.log("start block %s %s", block, block.getLoop());
 
             Arrays.fill(curOutRegisterState, null);
             if (block.getDominator() != null) {
@@ -204,14 +202,14 @@
             } else {
                 curLocations = new LocationMap(lir.numVariables());
             }
-            assert traceState();
+            Debug.log(logCurrentState());
 
             for (int opIdx = 0; opIdx < block.lir.size(); opIdx++) {
                 LIRInstruction op = block.lir.get(opIdx);
                 curOpId = op.id();
                 curPhiDefs = opIdx == 0;
 
-                assert trace("  op %d %s", op.id(), op);
+                Debug.log("  op %d %s", op.id(), op);
 
                 System.arraycopy(curOutRegisterState, 0, curInRegisterState, 0, curOutRegisterState.length);
 
@@ -258,12 +256,12 @@
             assert endLocationsFor(block) == null;
             setEndLocationsFor(block, curLocations);
 
-            traceState();
-            assert trace("end block %s", block);
+            logCurrentState();
+            Debug.log("end block %s", block);
         }
 
         moveResolver.finish();
-        assert trace("==== end linear scan allocation ====");
+        Debug.log("==== end linear scan allocation ====");
     }
 
     private CiValue killNonLive(CiValue value) {
@@ -281,7 +279,7 @@
 
     private CiValue unblock(CiValue value) {
         if (isAllocatableRegister(value)) {
-            assert trace("    unblock register %s", value);
+            Debug.log("    unblock register %s", value);
             int regNum = asRegister(value).number;
             assert curOutRegisterState[regNum] == value;
             curOutRegisterState[regNum] = null;
@@ -292,7 +290,7 @@
     private CiValue kill(CiValue value) {
         if (isVariable(value)) {
             Location location = curLocations.get(asVariable(value));
-            assert trace("    kill location %s", location);
+            Debug.log("    kill location %s", location);
             if (isRegister(location.location)) {
                 int regNum = asRegister(location.location).number;
                 if (curOutRegisterState[regNum] == location) {
@@ -307,7 +305,7 @@
 
     private CiValue block(CiValue value) {
         if (isAllocatableRegister(value)) {
-            assert trace("    block %s", value);
+            Debug.log("    block %s", value);
             int regNum = asRegister(value).number;
             assert curOutRegisterState[regNum] == null || curOutRegisterState[regNum] instanceof Location;
             curOutRegisterState[regNum] = value;
@@ -316,7 +314,7 @@
     }
 
     private void spillCallerSaveRegisters() {
-        assert trace("    spill caller save registers in curInRegisterState %s", Arrays.toString(curInRegisterState));
+        Debug.log("    spill caller save registers in curInRegisterState %s", Arrays.toString(curInRegisterState));
         for (CiRegister reg : frameMap.registerConfig.getCallerSaveRegisters()) {
             CiValue in = curInRegisterState[reg.number];
             if (in != null && isLocation(in)) {
@@ -342,19 +340,19 @@
 
             Location curLoc = curLocations.get(asVariable(value));
             if (isStackSlot(curLoc.location) && flags.contains(OperandFlag.Stack)) {
-                assert trace("    use %s %s: use current stack slot %s", mode, value, curLoc.location);
+                Debug.log("    use %s %s: use current stack slot %s", mode, value, curLoc.location);
                 return curLoc;
             }
             if (isRegister(curLoc.location)) {
                 int regNum = asRegister(curLoc.location).number;
                 assert curInRegisterState[regNum] == curLoc;
                 if (mode == OperandMode.Input || curOutRegisterState[regNum] == curLoc) {
-                    assert trace("    use %s %s: use current register %s", mode, value, curLoc.location);
+                    Debug.log("    use %s %s: use current register %s", mode, value, curLoc.location);
                     return curLoc;
                 }
             }
 
-            assert trace("    use %s %s", mode, value);
+            Debug.log("    use %s %s", mode, value);
 
             Location newLoc = allocateRegister(asVariable(value), mode, flags);
             if (newLoc != curLoc) {
@@ -372,7 +370,7 @@
     private CiValue def(CiValue value, OperandMode mode, EnumSet<OperandFlag> flags) {
         assert mode == OperandMode.Temp || mode == OperandMode.Output;
         if (isVariable(value)) {
-            assert trace("    def %s %s", mode, value);
+            Debug.log("    def %s %s", mode, value);
             assert curLocations.get(asVariable(value)) == null;
 
             Location newLoc = allocateRegister(asVariable(value), mode, flags);
@@ -388,7 +386,7 @@
             CiValue out = curOutRegisterState[i];
 
             if (in != null && in != out && isLocation(in) && curLocations.get(asLocation(in).variable) == in) {
-                assert trace("    %s was evicted by %s, need to allocate new location", in, out);
+                Debug.log("    %s was evicted by %s, need to allocate new location", in, out);
                 Location oldLoc = asLocation(in);
                 Location newLoc = allocateRegister(oldLoc.variable, OperandMode.Alive, SPILL_FLAGS);
                 assert oldLoc != newLoc;
@@ -405,7 +403,7 @@
 //            CiValue result = curInstruction.forEachRegisterHint(variable, mode, new ValueProcedure() {
 //                @Override
 //                public CiValue doValue(CiValue registerHint) {
-//                    assert trace("      registerHint %s", registerHint);
+//                    Debug.log("      registerHint %s", registerHint);
 //                    CiRegister hint = null;
 //                    if (isRegister(registerHint)) {
 //                        hint = asRegister(registerHint);
@@ -460,7 +458,7 @@
 
     private void spill(Location value) {
         Location newLoc = spillLocation(value.variable);
-        assert trace("      spill %s to %s", value, newLoc);
+        Debug.log("      spill %s to %s", value, newLoc);
         if (!curPhiDefs) {
             moveResolver.add(value, newLoc);
         }
@@ -480,7 +478,7 @@
             case Alive:  return curInRegisterState[reg.number] == null && curOutRegisterState[reg.number] == null;
             case Temp:   return curOutRegisterState[reg.number] == null;
             case Output: return curOutRegisterState[reg.number] == null;
-            default:     throw Util.shouldNotReachHere();
+            default:     throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -526,7 +524,7 @@
         curLocations.put(loc);
         recordUse(variable);
 
-        assert trace("      selected register %s", loc);
+        Debug.log("      selected register %s", loc);
         return loc;
     }
 
@@ -535,7 +533,7 @@
         curLocations.put(loc);
         recordUse(variable);
 
-        assert trace("      selected spill slot %s", loc);
+        Debug.log("      selected spill slot %s", loc);
         return loc;
     }
 
@@ -562,25 +560,16 @@
     }
 
 
-    private boolean traceState() {
-        if (GraalOptions.TraceRegisterAllocation) {
-            TTY.print("  current lcoations: ");
-            curLocations.forEachLocation(new ValueProcedure() {
-                @Override
-                public CiValue doValue(CiValue value) {
-                    TTY.print("%s ", value);
-                    return value;
-                }
-            });
-            TTY.println();
-        }
-        return true;
-    }
-
-    private static boolean trace(String format, Object...args) {
-        if (GraalOptions.TraceRegisterAllocation) {
-            TTY.println(format, args);
-        }
-        return true;
+    private String logCurrentState() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append("  current lcoations: ");
+        curLocations.forEachLocation(new ValueProcedure() {
+            @Override
+            public CiValue doValue(CiValue value) {
+                sb.append(value).append(" ");
+                return value;
+            }
+        });
+        return sb.toString();
     }
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/ResolveDataFlow.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/ResolveDataFlow.java	Wed Feb 08 18:19:09 2012 -0800
@@ -22,20 +22,19 @@
  */
 package com.oracle.max.graal.alloc.simple;
 
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
+import static com.oracle.max.graal.alloc.util.LocationUtil.*;
 
 import java.util.*;
 
 import com.oracle.max.cri.ci.*;
-import com.oracle.max.criutils.*;
 import com.oracle.max.graal.alloc.util.*;
-import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.cfg.*;
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.compiler.lir.LIRInstruction.ValueProcedure;
 import com.oracle.max.graal.compiler.lir.StandardOp.PhiJumpOp;
 import com.oracle.max.graal.compiler.lir.StandardOp.PhiLabelOp;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.debug.*;
+import com.oracle.max.graal.graph.*;
 
 public abstract class ResolveDataFlow {
     public final LIR lir;
@@ -53,7 +52,7 @@
     public void execute() {
         ValueProcedure locMappingProc = new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return locMapping(value); } };
 
-        assert trace("==== start resolve data flow ====");
+        Debug.log("==== start resolve data flow ====");
         for (Block toBlock : lir.linearScanOrder()) {
             PhiLabelOp phiDefs = null;
             if (toBlock.lir.get(0) instanceof PhiLabelOp) {
@@ -61,7 +60,7 @@
             }
 
             for (Block fromBlock : toBlock.getPredecessors()) {
-                assert trace("start edge %s -> %s", fromBlock, toBlock);
+                Debug.log("start edge %s -> %s", fromBlock, toBlock);
                 findInsertPos(fromBlock, toBlock);
 
                 LocationMap toLocations = locationsForBlockBegin(toBlock);
@@ -77,7 +76,7 @@
                 }
 
                 moveResolver.resolve();
-                assert trace("end edge %s -> %s", fromBlock, toBlock);
+                Debug.log("end edge %s -> %s", fromBlock, toBlock);
             }
 
             if (phiDefs != null) {
@@ -86,7 +85,7 @@
             }
         }
         moveResolver.finish();
-        assert trace("==== end resolve data flow ====");
+        Debug.log("==== end resolve data flow ====");
     }
 
     private CiValue locMapping(CiValue value) {
@@ -115,25 +114,17 @@
             LIRInstruction instr = instructions.get(instructions.size() - 1);
             assert instr instanceof StandardOp.JumpOp : "block does not end with an unconditional jump";
             moveResolver.init(instructions, instructions.size() - 1);
-            assert trace("  insert at end of %s before %d", fromBlock, instructions.size() - 1);
+            Debug.log("  insert at end of %s before %d", fromBlock, instructions.size() - 1);
 
         } else if (toBlock.numberOfPreds() == 1) {
             moveResolver.init(toBlock.lir, 1);
-            assert trace("  insert at beginning of %s before %d", toBlock, 1);
+            Debug.log("  insert at beginning of %s before %d", toBlock, 1);
 
         } else {
-            Util.shouldNotReachHere("Critical edge not split");
+            GraalInternalError.shouldNotReachHere("Critical edge not split");
         }
     }
 
     protected abstract LocationMap locationsForBlockBegin(Block block);
     protected abstract LocationMap locationsForBlockEnd(Block block);
-
-
-    private static boolean trace(String format, Object...args) {
-        if (GraalOptions.TraceRegisterAllocation) {
-            TTY.println(format, args);
-        }
-        return true;
-    }
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/SpillAllAllocator.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/simple/SpillAllAllocator.java	Wed Feb 08 18:19:09 2012 -0800
@@ -23,22 +23,20 @@
 package com.oracle.max.graal.alloc.simple;
 
 import static com.oracle.max.cri.ci.CiValueUtil.*;
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
+import static com.oracle.max.graal.alloc.util.LocationUtil.*;
 
 import java.util.*;
 
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ci.CiRegister.RegisterFlag;
-import com.oracle.max.criutils.*;
 import com.oracle.max.graal.alloc.util.*;
-import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.cfg.*;
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.compiler.lir.LIRInstruction.OperandFlag;
 import com.oracle.max.graal.compiler.lir.LIRInstruction.OperandMode;
 import com.oracle.max.graal.compiler.lir.LIRInstruction.ValueProcedure;
-import com.oracle.max.graal.compiler.util.*;
 import com.oracle.max.graal.debug.*;
+import com.oracle.max.graal.graph.*;
 
 public class SpillAllAllocator {
     private final LIR lir;
@@ -162,12 +160,12 @@
         ValueProcedure spillProc =        new ValueProcedure() { @Override public CiValue doValue(CiValue value, OperandMode mode, EnumSet<OperandFlag> flags) { return spill(value, mode, flags); } };
         ValueProcedure useSlotProc =      new ValueProcedure() { @Override public CiValue doValue(CiValue value) { return useSlot(value); } };
 
-        assert trace("==== start spill all allocation ====");
+        Debug.log("==== start spill all allocation ====");
         curInRegisterState = new Object[maxRegisterNum()];
         curOutRegisterState = new Object[maxRegisterNum()];
         curRegisterLocations = new LocationMap(lir.numVariables());
         for (Block block : lir.linearScanOrder()) {
-            assert trace("start block %s %s", block, block.getLoop());
+            Debug.log("start block %s %s", block, block.getLoop());
             assert checkEmpty(curOutRegisterState);
 
             if (block.getDominator() != null) {
@@ -180,12 +178,12 @@
             } else {
                 curStackLocations = new LocationMap(lir.numVariables());
             }
-            assert traceState();
+            Debug.log(logCurrentState());
 
             for (int opIdx = 0; opIdx < block.lir.size(); opIdx++) {
                 LIRInstruction op = block.lir.get(opIdx);
                 curInstruction = op;
-                assert trace("  op %d %s", op.id(), op);
+                Debug.log("  op %d %s", op.id(), op);
 
                 assert curRegisterLocations.checkEmpty();
 
@@ -220,12 +218,12 @@
             assert locationsFor(block) == null;
             setLocationsFor(block, curStackLocations);
 
-            traceState();
-            assert trace("end block %s", block);
+            logCurrentState();
+            Debug.log("end block %s", block);
         }
 
         moveResolver.finish();
-        assert trace("==== end spill all allocation ====");
+        Debug.log("==== end spill all allocation ====");
     }
 
     private CiValue killNonLive(CiValue value) {
@@ -238,7 +236,7 @@
 
     private CiValue kill(CiValue value, boolean end) {
         if (isVariable(value)) {
-            assert trace("    kill variable %s", value);
+            Debug.log("    kill variable %s", value);
 
             Variable variable = asVariable(value);
             curStackLocations.clear(variable);
@@ -248,7 +246,7 @@
                 killLocation(loc);
                 curRegisterLocations.clear(variable);
 
-                assert trace("      location %s", loc);
+                Debug.log("      location %s", loc);
                 assert isAllocatableRegister(loc.location);
 
                 int regNum = asRegister(loc.location).number;
@@ -258,7 +256,7 @@
             }
 
         } else if (isAllocatableRegister(value)) {
-            assert trace("    kill register %s", value);
+            Debug.log("    kill register %s", value);
             int regNum = asRegister(value).number;
             assert curOutRegisterState[regNum] == null || curOutRegisterState[regNum] instanceof LIRInstruction && curInstruction != null;
 
@@ -267,13 +265,13 @@
             }
 
         } else {
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
         return value;
     }
 
     private CiValue killLocation(CiValue value) {
-        assert trace("    kill location %s", value);
+        Debug.log("    kill location %s", value);
         assert isAllocatableRegister(asLocation(value).location);
 
         int regNum = asRegister(asLocation(value).location).number;
@@ -285,7 +283,7 @@
 
     private CiValue block(CiValue value) {
         if (isAllocatableRegister(value)) {
-            assert trace("    block %s", value);
+            Debug.log("    block %s", value);
             int regNum = asRegister(value).number;
             assert curInstruction != null;
             assert curOutRegisterState[regNum] == null || curOutRegisterState[regNum] instanceof LIRInstruction;
@@ -300,11 +298,11 @@
             return useSlot(value);
         }
         if (isVariable(value)) {
-            assert trace("    load %s", value);
+            Debug.log("    load %s", value);
             Location regLoc = curRegisterLocations.get(asVariable(value));
             if (regLoc != null) {
                 // This variable has already been processed before.
-                assert trace("      found location %s", regLoc);
+                Debug.log("      found location %s", regLoc);
             } else {
                 regLoc = allocateRegister(asVariable(value), curInRegisterState, mode == OperandMode.Alive ? curOutRegisterState : null, mode, flags);
                 Location stackLoc = curStackLocations.get(asVariable(value));
@@ -324,7 +322,7 @@
             return defSlot(value);
         }
         if (isVariable(value)) {
-            assert trace("    spill %s", value);
+            Debug.log("    spill %s", value);
             assert curStackLocations.get(asVariable(value)) == null;
             Location regLoc = allocateRegister(asVariable(value), null, curOutRegisterState, mode, flags);
             if (mode == OperandMode.Output) {
@@ -341,10 +339,10 @@
 
     private CiValue useSlot(CiValue value) {
         if (isVariable(value)) {
-            assert trace("    useSlot %s", value);
+            Debug.log("    useSlot %s", value);
             Location stackLoc = curStackLocations.get(asVariable(value));
             assert stackLoc != null;
-            assert trace("      slot %s", stackLoc);
+            Debug.log("      slot %s", stackLoc);
             return stackLoc;
         } else {
             return value;
@@ -353,11 +351,11 @@
 
     private CiValue defSlot(CiValue value) {
         if (isVariable(value)) {
-            assert trace("    assignSlot %s", value);
+            Debug.log("    assignSlot %s", value);
             Location stackLoc = new Location(asVariable(value), frameMap.allocateSpillSlot(value.kind));
             assert curStackLocations.get(asVariable(value)) == null;
             curStackLocations.put(stackLoc);
-            assert trace("      slot %s", stackLoc);
+            Debug.log("      slot %s", stackLoc);
             return stackLoc;
         } else {
             return value;
@@ -369,7 +367,7 @@
             CiValue result = curInstruction.forEachRegisterHint(variable, mode, new ValueProcedure() {
                 @Override
                 public CiValue doValue(CiValue registerHint) {
-                    assert trace("      registerHint %s", registerHint);
+                    Debug.log("      registerHint %s", registerHint);
                     CiRegister hint = null;
                     if (isRegister(registerHint)) {
                         hint = asRegister(registerHint);
@@ -414,7 +412,7 @@
         }
         assert curRegisterLocations.get(variable) == null;
         curRegisterLocations.put(loc);
-        assert trace("      selected register %s", loc);
+        Debug.log("      selected register %s", loc);
         return loc;
     }
 
@@ -455,25 +453,16 @@
     }
 
 
-    private boolean traceState() {
-        if (GraalOptions.TraceRegisterAllocation) {
-            TTY.print("  curVariableLocations: ");
-            curStackLocations.forEachLocation(new ValueProcedure() {
-                @Override
-                public CiValue doValue(CiValue value) {
-                    TTY.print("%s ", value);
-                    return value;
-                }
-            });
-            TTY.println();
-        }
-        return true;
-    }
-
-    private static boolean trace(String format, Object...args) {
-        if (GraalOptions.TraceRegisterAllocation) {
-            TTY.println(format, args);
-        }
-        return true;
+    private String logCurrentState() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append("  curVariableLocations: ");
+        curStackLocations.forEachLocation(new ValueProcedure() {
+            @Override
+            public CiValue doValue(CiValue value) {
+                sb.append(value).append(" ");
+                return value;
+            }
+        });
+        return sb.toString();
     }
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/IntervalPrinter.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/IntervalPrinter.java	Wed Feb 08 18:19:09 2012 -0800
@@ -23,7 +23,7 @@
 package com.oracle.max.graal.alloc.util;
 
 import static com.oracle.max.cri.ci.CiValueUtil.*;
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
+import static com.oracle.max.graal.alloc.util.LocationUtil.*;
 
 import java.util.*;
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/LocationMap.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/LocationMap.java	Wed Feb 08 18:19:09 2012 -0800
@@ -22,7 +22,7 @@
  */
 package com.oracle.max.graal.alloc.util;
 
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
+import static com.oracle.max.graal.alloc.util.LocationUtil.*;
 
 import java.util.*;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/LocationUtil.java	Wed Feb 08 18:19:09 2012 -0800
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.max.graal.alloc.util;
+
+import com.oracle.max.cri.ci.*;
+import com.oracle.max.graal.compiler.lir.*;
+
+public class LocationUtil extends ValueUtil {
+
+    public static boolean isLocation(CiValue value) {
+        assert value != null;
+        return value instanceof Location;
+    }
+
+    public static Location asLocation(CiValue value) {
+        assert value != null;
+        return (Location) value;
+    }
+}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/MoveResolver.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/MoveResolver.java	Wed Feb 08 18:19:09 2012 -0800
@@ -22,16 +22,16 @@
  */
 package com.oracle.max.graal.alloc.util;
 
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
+import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.max.graal.alloc.util.LocationUtil.*;
 
 import java.util.*;
 
 import com.oracle.max.cri.ci.*;
-import com.oracle.max.criutils.*;
-import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.alloc.*;
 import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.debug.*;
+import com.oracle.max.graal.graph.*;
 
 public abstract class MoveResolver {
     private final LIR lir;
@@ -76,7 +76,7 @@
         assert isLocation(from) || isConstant(from);
         assert from != to;
 
-        assert trace("mr    add mapping from %s to %s", from, to);
+        Debug.log("mr    add mapping from %s to %s", from, to);
         mappingFrom.add(from);
         mappingTo.add(to);
 
@@ -92,12 +92,12 @@
 
         if (mappingFrom.size() == 1) {
             // If there is only one mapping, it is trivial that this mapping is safe to resolve.
-            assert trace("mr    resolve  mappings: %d", mappingFrom.size());
+            Debug.log("mr    resolve  mappings: %d", mappingFrom.size());
             insertMove(mappingFrom.get(0), mappingTo.get(0));
             mappingFrom.remove(0);
             mappingTo.remove(0);
         } else if (mappingFrom.size() > 1) {
-            assert trace("mr    resolve  mappings: %d", mappingFrom.size());
+            Debug.log("mr    resolve  mappings: %d", mappingFrom.size());
             doResolve();
         }
         insertPos = -1;
@@ -264,10 +264,10 @@
     }
 
     private void insertExchange(Location from, Location to) {
-        assert trace("mr      XCHG %s, %s", from, to);
+        Debug.log("mr      XCHG %s, %s", from, to);
         // TODO create XCHG instruction and use it here
         insertionBuffer.append(insertPos, null);
-        throw Util.unimplemented();
+        throw GraalInternalError.unimplemented();
     }
 
     private void insertMove(CiValue src, Location dst) {
@@ -297,7 +297,7 @@
             }
 
         } else {
-            assert trace("mr      MOV %s -> %s", src, dst);
+            Debug.log("mr      MOV %s -> %s", src, dst);
             insertionBuffer.append(insertPos, lir.spillMoveFactory.createMove(dst,  src));
         }
     }
@@ -340,12 +340,4 @@
         }
         return true;
     }
-
-
-    private static boolean trace(String format, Object...args) {
-        if (GraalOptions.TraceRegisterAllocation) {
-            TTY.println(format, args);
-        }
-        return true;
-    }
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/RegisterVerifier.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/RegisterVerifier.java	Wed Feb 08 18:19:09 2012 -0800
@@ -23,17 +23,18 @@
 package com.oracle.max.graal.alloc.util;
 
 import static com.oracle.max.cri.ci.CiValueUtil.*;
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
+import static com.oracle.max.graal.alloc.util.LocationUtil.*;
 
 import java.util.*;
 
 import com.oracle.max.cri.ci.*;
-import com.oracle.max.criutils.*;
-import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.cfg.*;
 import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.lir.LIRInstruction.*;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.compiler.lir.LIRInstruction.OperandFlag;
+import com.oracle.max.graal.compiler.lir.LIRInstruction.OperandMode;
+import com.oracle.max.graal.compiler.lir.LIRInstruction.ValueProcedure;
+import com.oracle.max.graal.debug.*;
+import com.oracle.max.graal.graph.*;
 
 public final class RegisterVerifier {
     private final FrameMap frameMap;
@@ -94,17 +95,17 @@
         setStateFor(startBlock, curInputState);
         addToWorkList(startBlock);
 
-        assert trace("==== start verify register allocation ====");
+        Debug.log("==== start verify register allocation ====");
         do {
             Block block = workList.remove(0);
 
             // Must copy state because it is modified.
             curInputState = copy(stateFor(block));
-            assert trace("start block %s %s", block, block.getLoop());
-            assert traceState();
+            Debug.log("start block %s %s", block, block.getLoop());
+            Debug.log(logCurrentState());
 
             for (LIRInstruction op : block.lir) {
-                assert trace("  op %d %s", op.id(), op);
+                Debug.log("  op %d %s", op.id(), op);
 
                 op.forEachInput(useProc);
                 if (op.hasCall()) {
@@ -120,23 +121,23 @@
                 processSuccessor(succ);
             }
 
-            assert trace("end block %s", block);
+            Debug.log("end block %s", block);
         } while (!workList.isEmpty());
-        assert trace("==== end verify register allocation ====");
+        Debug.log("==== end verify register allocation ====");
     }
 
     private void processSuccessor(Block succ) {
         Map<Object, CiValue> savedState = stateFor(succ);
         if (savedState == null) {
             // Block was not processed before, so set initial inputState.
-            assert trace("  successor %s: initial visit", succ);
+            Debug.log("  successor %s: initial visit", succ);
             setStateFor(succ, copy(curInputState));
             addToWorkList(succ);
 
         } else {
             // This block was already processed before.
             // Check if new inputState is consistent with savedState.
-            assert trace("  successor %s: state present", succ);
+            Debug.log("  successor %s: state present", succ);
             Iterator<Map.Entry<Object, CiValue>> iter = savedState.entrySet().iterator();
             while (iter.hasNext()) {
                 Map.Entry<Object, CiValue> entry = iter.next();
@@ -146,7 +147,7 @@
                 if (savedValue != inputValue) {
                     // Current inputState and previous savedState assume a different value in this register.
                     // Assume that this register is invalid and remove it from the saved state.
-                    assert trace("    invalididating %s because it is inconsistent with %s", savedValue, inputValue);
+                    Debug.log("    invalididating %s because it is inconsistent with %s", savedValue, inputValue);
                     iter.remove();
                     // Must re-visit this block.
                     addToWorkList(succ);
@@ -161,7 +162,7 @@
         while (iter.hasNext()) {
             Object value1 = iter.next();
             if (value1 instanceof CiRegister && frameMap.registerConfig.getAttributesMap()[((CiRegister) value1).number].isCallerSave) {
-                assert trace("    remove caller save register %s", value1);
+                Debug.log("    remove caller save register %s", value1);
                 iter.remove();
             }
         }
@@ -180,7 +181,7 @@
         } else if (isStackSlot(value)) {
             return Integer.valueOf(frameMap.offsetForStackSlot(asStackSlot(value)));
         } else {
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -194,9 +195,9 @@
             if (actual == null && flags.contains(OperandFlag.Uninitialized)) {
                 // OK, since uninitialized values are allowed explicitly.
             } else if (value != actual) {
-                TTY.println("!! Error in register allocation: %s != %s for key %s", value, actual, key(value));
-                traceState();
-                throw Util.shouldNotReachHere();
+                Debug.log("Error in register allocation: %s != %s for key %s", value, actual, key(value));
+                Debug.log(logCurrentState());
+                throw GraalInternalError.shouldNotReachHere();
             }
         }
         return value;
@@ -204,7 +205,7 @@
 
     private CiValue temp(CiValue value) {
         if (!isConstant(value) && value != CiValue.IllegalValue && !isIgnoredRegister(value)) {
-            assert trace("    temp %s -> remove key %s", value, key(value));
+            Debug.log("    temp %s -> remove key %s", value, key(value));
             curInputState.remove(key(value));
         }
         return value;
@@ -212,48 +213,38 @@
 
     private CiValue output(CiValue value) {
         if (value != CiValue.IllegalValue && !isIgnoredRegister(value)) {
-            assert trace("    output %s -> set key %s", value, key(value));
+            Debug.log("    output %s -> set key %s", value, key(value));
             curInputState.put(key(value), value);
         }
         return value;
     }
 
 
-    private boolean traceState() {
-        if (GraalOptions.TraceRegisterAllocation) {
-            ArrayList<Object> keys = new ArrayList<>(curInputState.keySet());
-            Collections.sort(keys, new Comparator<Object>() {
-                @Override
-                public int compare(Object o1, Object o2) {
-                    if (o1 instanceof CiRegister) {
-                        if (o2 instanceof CiRegister) {
-                            return ((CiRegister) o1).number - ((CiRegister) o2).number;
-                        } else {
-                            return -1;
-                        }
+    private String logCurrentState() {
+        ArrayList<Object> keys = new ArrayList<>(curInputState.keySet());
+        Collections.sort(keys, new Comparator<Object>() {
+            @Override
+            public int compare(Object o1, Object o2) {
+                if (o1 instanceof CiRegister) {
+                    if (o2 instanceof CiRegister) {
+                        return ((CiRegister) o1).number - ((CiRegister) o2).number;
                     } else {
-                        if (o2 instanceof CiRegister) {
-                            return 1;
-                        } else {
-                            return ((Integer) o1).intValue() - ((Integer) o2).intValue();
-                        }
+                        return -1;
+                    }
+                } else {
+                    if (o2 instanceof CiRegister) {
+                        return 1;
+                    } else {
+                        return ((Integer) o1).intValue() - ((Integer) o2).intValue();
                     }
                 }
-            });
+            }
+        });
 
-            TTY.print("    state: ");
-            for (Object key : keys) {
-                TTY.print("%s=%s  ", key, curInputState.get(key));
-            }
-            TTY.println();
+        StringBuilder sb = new StringBuilder("    state: ");
+        for (Object key : keys) {
+            sb.append(key).append("=").append(curInputState.get(key)).append(" ");
         }
-        return true;
-    }
-
-    private static boolean trace(String format, Object...args) {
-        if (GraalOptions.TraceRegisterAllocation) {
-            TTY.println(format, args);
-        }
-        return true;
+        return sb.toString();
     }
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/ValueUtil.java	Wed Feb 08 15:36:41 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.graal.alloc.util;
-
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.graal.compiler.lir.*;
-
-public class ValueUtil extends CiValueUtil {
-
-    public static boolean isVariable(CiValue value) {
-        assert value != null;
-        return value instanceof Variable;
-    }
-
-    public static Variable asVariable(CiValue value) {
-        assert value != null;
-        return (Variable) value;
-    }
-
-
-    public static boolean isLocation(CiValue value) {
-        assert value != null;
-        return value instanceof Location;
-    }
-
-    public static Location asLocation(CiValue value) {
-        assert value != null;
-        return (Location) value;
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java	Wed Feb 08 18:19:09 2012 -0800
@@ -29,7 +29,6 @@
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ri.*;
 import com.oracle.max.cri.xir.*;
-import com.oracle.max.criutils.*;
 import com.oracle.max.graal.alloc.simple.*;
 import com.oracle.max.graal.compiler.alloc.*;
 import com.oracle.max.graal.compiler.asm.*;
@@ -232,9 +231,6 @@
                 }
 
                 Debug.dump(lir, "After LIR generation");
-                if (GraalOptions.PrintLIR && !TTY.isSuppressed()) {
-                    LIR.printLIR(lir.linearScanOrder());
-                }
             }
         });
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/Interval.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/Interval.java	Wed Feb 08 18:19:09 2012 -0800
@@ -22,7 +22,7 @@
  */
 package com.oracle.max.graal.compiler.alloc;
 
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
+import static com.oracle.max.graal.alloc.util.LocationUtil.*;
 
 import java.util.*;
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java	Wed Feb 08 18:19:09 2012 -0800
@@ -24,7 +24,7 @@
 
 import static com.oracle.max.cri.ci.CiUtil.*;
 import static com.oracle.max.cri.ci.CiValueUtil.*;
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
+import static com.oracle.max.graal.alloc.util.LocationUtil.*;
 
 import java.util.*;
 
@@ -1589,7 +1589,7 @@
                 }
 
                 default: {
-                    throw Util.shouldNotReachHere();
+                    throw GraalInternalError.shouldNotReachHere();
                 }
             }
         }
@@ -1902,14 +1902,6 @@
     }
 
     void printLir(String label, @SuppressWarnings("unused") boolean hirValid) {
-        // TODO(tw): Fix printing.
-        if (GraalOptions.TraceLinearScanLevel >= 1 && !TTY.isSuppressed()) {
-            TTY.println();
-            TTY.println(label);
-            LIR.printLIR(ir.linearScanOrder());
-            TTY.println();
-        }
-
         Debug.dump(ir, label);
     }
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScanWalker.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScanWalker.java	Wed Feb 08 18:19:09 2012 -0800
@@ -23,7 +23,7 @@
 package com.oracle.max.graal.compiler.alloc;
 
 import static com.oracle.max.cri.ci.CiUtil.*;
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
+import static com.oracle.max.graal.alloc.util.LocationUtil.*;
 
 import java.util.*;
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/asm/ExceptionInfo.java	Wed Feb 08 15:36:41 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.graal.compiler.asm;
-
-import com.oracle.max.graal.compiler.lir.*;
-
-public class ExceptionInfo {
-
-    public final int codeOffset;
-    public final LabelRef exceptionEdge;
-    public final int bci;
-
-    public ExceptionInfo(int pcOffset, LabelRef exceptionEdge, int bci) {
-        this.codeOffset = pcOffset;
-        this.exceptionEdge = exceptionEdge;
-        this.bci = bci;
-    }
-}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/asm/TargetMethodAssembler.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/asm/TargetMethodAssembler.java	Wed Feb 08 18:19:09 2012 -0800
@@ -29,15 +29,23 @@
 import com.oracle.max.asm.*;
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ri.*;
-import com.oracle.max.criutils.*;
-import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.compiler.lir.LIR.SlowPath;
-import com.oracle.max.graal.compiler.util.*;
 import com.oracle.max.graal.debug.*;
+import com.oracle.max.graal.graph.*;
 
 public class TargetMethodAssembler {
 
+    private static class ExceptionInfo {
+        public final int codeOffset;
+        public final LabelRef exceptionEdge;
+
+        public ExceptionInfo(int pcOffset, LabelRef exceptionEdge) {
+            this.codeOffset = pcOffset;
+            this.exceptionEdge = exceptionEdge;
+        }
+    }
+
     public final AbstractAssembler asm;
     public final CiTargetMethod targetMethod;
     public final CiTarget target;
@@ -47,6 +55,7 @@
 
     private List<ExceptionInfo> exceptionInfoList;
     private int lastSafepointPos;
+
     public TargetMethodAssembler(CiTarget target, RiRuntime runtime, FrameMap frameMap, List<SlowPath> slowPaths, AbstractAssembler asm) {
         this.target = target;
         this.runtime = runtime;
@@ -88,6 +97,8 @@
         Debug.metric("DataPatches").add(targetMethod.dataReferences.size());
         Debug.metric("ExceptionHandlersEmitted").add(targetMethod.exceptionHandlers.size());
 
+        Debug.log("Finished target method %s, isStub %d", name, isStub);
+/*
         if (GraalOptions.PrintAssembly && !TTY.isSuppressed() && !isStub) {
             Util.printSection("Target Method", Util.SECTION_CHARACTER);
             TTY.println("Name: " + name);
@@ -128,6 +139,7 @@
                 TTY.println(x.toString());
             }
         }
+*/
 
         return targetMethod;
     }
@@ -138,7 +150,7 @@
                 if (exceptionInfoList == null) {
                     exceptionInfoList = new ArrayList<>(4);
                 }
-                exceptionInfoList.add(new ExceptionInfo(pcOffset, info.exceptionEdge, info.topFrame.bci));
+                exceptionInfoList.add(new ExceptionInfo(pcOffset, info.exceptionEdge));
             }
         }
     }
@@ -196,7 +208,7 @@
         assert (value.kind.stackKind() == CiKind.Int || value.kind == CiKind.Jsr || value.kind == CiKind.Long) && isConstant(value);
         long c = ((CiConstant) value).asLong();
         if (!(NumUtil.isInt(c))) {
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
         return (int) c;
     }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/cfg/ControlFlowGraph.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/cfg/ControlFlowGraph.java	Wed Feb 08 18:19:09 2012 -0800
@@ -24,7 +24,6 @@
 
 import java.util.*;
 
-import com.oracle.max.graal.compiler.util.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
 
@@ -150,7 +149,7 @@
                 block.id = reversePostOrderId;
                 reversePostOrderId--;
             } else {
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
             }
         } while (!stack.isEmpty());
         assert reversePostOrderId == -1;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java	Wed Feb 08 18:19:09 2012 -0800
@@ -26,7 +26,7 @@
 import static com.oracle.max.cri.ci.CiValue.*;
 import static com.oracle.max.cri.ci.CiValueUtil.*;
 import static com.oracle.max.cri.util.MemoryBarriers.*;
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
+import static com.oracle.max.graal.compiler.lir.ValueUtil.*;
 
 import java.lang.reflect.*;
 import java.util.*;
@@ -191,7 +191,7 @@
             case Double:
                 return new Variable(stackKind, lir.nextVariable(), CiRegister.RegisterFlag.FPU);
             default:
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -770,7 +770,7 @@
         } else if (node instanceof IsTypeNode) {
             emitTypeBranch((IsTypeNode) node, trueSuccessor, falseSuccessor, info);
         } else {
-            throw Util.unimplemented(node.toString());
+            throw GraalInternalError.unimplemented(node.toString());
         }
     }
 
@@ -832,7 +832,7 @@
         } else if (node instanceof ConstantNode) {
             return emitConstantConditional(((ConstantNode) node).asConstant().asBoolean(), trueValue, falseValue);
         } else {
-            throw Util.unimplemented(node.toString());
+            throw GraalInternalError.unimplemented(node.toString());
         }
     }
 
@@ -964,7 +964,7 @@
             } else if (isStackSlot(value)) {
                 return CiStackSlot.get(value.kind.stackKind(), asStackSlot(value).rawOffset(), asStackSlot(value).rawAddFrameSize());
             } else {
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
             }
         }
         return value;
@@ -988,7 +988,7 @@
                 argList.add(operand);
 
             } else {
-                throw Util.shouldNotReachHere("I thought we no longer have null entries for two-slot types...");
+                throw GraalInternalError.shouldNotReachHere("I thought we no longer have null entries for two-slot types...");
             }
         }
         return argList;
@@ -1194,7 +1194,7 @@
         } else if (op instanceof XirTemp) {
             return newVariable(op.kind);
         } else {
-            Util.shouldNotReachHere();
+            GraalInternalError.shouldNotReachHere();
             return null;
         }
     }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/PhiResolver.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/PhiResolver.java	Wed Feb 08 18:19:09 2012 -0800
@@ -23,7 +23,7 @@
 package com.oracle.max.graal.compiler.gen;
 
 import static com.oracle.max.cri.ci.CiValue.*;
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
+import static com.oracle.max.graal.compiler.lir.ValueUtil.*;
 
 import java.util.*;
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/FrameMap.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/FrameMap.java	Wed Feb 08 18:19:09 2012 -0800
@@ -29,7 +29,6 @@
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ci.CiCallingConvention.Type;
 import com.oracle.max.cri.ri.*;
-import com.oracle.max.graal.compiler.util.*;
 
 /**
  * This class is used to build the stack frame layout for a compiled method.
@@ -224,6 +223,10 @@
         return CiStackSlot.get(kind, -spillSize + additionalOffset, true);
     }
 
+    private static int roundUp(int number, int mod) {
+        return ((number + mod - 1) / mod) * mod;
+    }
+
     /**
      * Reserves a spill slot in the frame of the method being compiled. The returned slot is aligned on its natural alignment,
      * i.e., an 8-byte spill slot is aligned at an 8-byte boundary.
@@ -233,7 +236,7 @@
     public CiStackSlot allocateSpillSlot(CiKind kind) {
         assert frameSize == -1 : "frame size must not yet be fixed";
         int size = target.sizeInBytes(kind);
-        spillSize = Util.roundUp(spillSize + size, size);
+        spillSize = roundUp(spillSize + size, size);
         return getSlot(kind, 0);
     }
 
@@ -251,7 +254,7 @@
         if (size == 0) {
             return null;
         }
-        spillSize = Util.roundUp(spillSize + size, target.wordSize);
+        spillSize = roundUp(spillSize + size, target.wordSize);
 
         if (refs) {
             assert size % target.wordSize == 0;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIR.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIR.java	Wed Feb 08 18:19:09 2012 -0800
@@ -25,11 +25,9 @@
 import java.util.*;
 
 import com.oracle.max.cri.ci.*;
-import com.oracle.max.criutils.*;
-import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.asm.*;
 import com.oracle.max.graal.compiler.cfg.*;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
 
 /**
@@ -119,10 +117,6 @@
     }
 
     public void emitCode(TargetMethodAssembler tasm) {
-        if (GraalOptions.PrintLIR && !TTY.isSuppressed()) {
-            printLIR(codeEmittingOrder());
-        }
-
         for (Block b : codeEmittingOrder()) {
             emitBlock(tasm, b);
         }
@@ -139,30 +133,17 @@
         emitSlowPath(tasm, methodEndMarker);
     }
 
-    private void emitBlock(TargetMethodAssembler tasm, Block block) {
-        if (GraalOptions.PrintLIRWithAssembly) {
-            TTY.println(block.toString());
-        }
-
-        if (GraalOptions.CommentedAssembly) {
+    private static void emitBlock(TargetMethodAssembler tasm, Block block) {
+        if (Debug.isDumpEnabled()) {
             tasm.blockComment(String.format("block B%d %s", block.getId(), block.getLoop()));
         }
 
         for (LIRInstruction op : block.lir) {
-            if (GraalOptions.CommentedAssembly) {
+            if (Debug.isDumpEnabled()) {
                 tasm.blockComment(String.format("%d %s", op.id(), op));
             }
-            if (GraalOptions.PrintLIRWithAssembly && !TTY.isSuppressed()) {
-                // print out the LIR operation followed by the resulting assembly
-                TTY.println(op.toStringWithIdPrefix());
-                TTY.println();
-            }
 
             emitOp(tasm, op);
-
-            if (GraalOptions.PrintLIRWithAssembly) {
-                printAssembly(tasm);
-            }
         }
     }
 
@@ -181,12 +162,13 @@
     }
 
     private static void emitSlowPath(TargetMethodAssembler tasm, SlowPath sp) {
-        if (GraalOptions.CommentedAssembly) {
+        if (Debug.isDumpEnabled()) {
             tasm.blockComment(String.format("slow case %s", sp.getClass().getName()));
         }
         sp.emitCode(tasm);
     }
 
+/*
     private int lastDecodeStart;
 
     private void printAssembly(TargetMethodAssembler tasm) {
@@ -254,4 +236,5 @@
             TTY.println();
         }
     }
+*/
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRDebugInfo.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRDebugInfo.java	Wed Feb 08 18:19:09 2012 -0800
@@ -23,7 +23,7 @@
 package com.oracle.max.graal.compiler.lir;
 
 import static com.oracle.max.graal.compiler.lir.LIRInstruction.*;
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
+import static com.oracle.max.graal.compiler.lir.ValueUtil.*;
 
 import java.util.*;
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRInstruction.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRInstruction.java	Wed Feb 08 18:19:09 2012 -0800
@@ -22,12 +22,13 @@
  */
 package com.oracle.max.graal.compiler.lir;
 
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
+import static com.oracle.max.cri.ci.CiValueUtil.*;
+
 import java.util.*;
 
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.graal.compiler.asm.*;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.graph.*;
 
 /**
  * The {@code LIRInstruction} class definition.
@@ -49,7 +50,7 @@
          * @return The new value to replace the value that was passed in.
          */
         protected CiValue doValue(CiValue value) {
-            throw Util.shouldNotReachHere("One of the doValue() methods must be overwritten");
+            throw GraalInternalError.shouldNotReachHere("One of the doValue() methods must be overwritten");
         }
 
         /**
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRVerifier.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRVerifier.java	Wed Feb 08 18:19:09 2012 -0800
@@ -23,7 +23,7 @@
 package com.oracle.max.graal.compiler.lir;
 
 import static com.oracle.max.cri.ci.CiValueUtil.*;
-import static com.oracle.max.graal.alloc.util.ValueUtil.*;
+import static com.oracle.max.graal.compiler.lir.ValueUtil.*;
 
 import java.util.*;
 
@@ -33,7 +33,7 @@
 import com.oracle.max.graal.compiler.lir.LIRInstruction.OperandFlag;
 import com.oracle.max.graal.compiler.lir.LIRInstruction.OperandMode;
 import com.oracle.max.graal.compiler.lir.LIRInstruction.ValueProcedure;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.graph.*;
 
 public final class LIRVerifier {
     private final LIR lir;
@@ -167,7 +167,7 @@
                     TTY.println("definition of %s: %s", value, variableDefinitions[variableIdx]);
                 }
                 TTY.println("ERROR: Use of variable %s that is not defined in dominator", value);
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
             }
 
         } else if (isAllocatableRegister(value)) {
@@ -180,7 +180,7 @@
                 TTY.println("block %s  instruction %s", curBlock, curInstruction);
                 TTY.println("live registers: %s", Arrays.toString(curRegistersLive));
                 TTY.println("ERROR: Use of fixed register %s that is not defined in this block", value);
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
             }
         }
         return value;
@@ -198,7 +198,7 @@
                 TTY.println("live variables: %s", curVariablesLive);
                 TTY.println("definition of %s: %s", value, variableDefinitions[variableIdx]);
                 TTY.println("ERROR: Variable %s defined multiple times", value);
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
             }
             assert curInstruction != null;
             variableDefinitions[variableIdx] = curInstruction;
@@ -212,7 +212,7 @@
             if (curRegistersDefined.get(regNum)) {
                 TTY.println("block %s  instruction %s", curBlock, curInstruction);
                 TTY.println("ERROR: Same register defined twice in the same instruction: %s", value);
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
             }
             curRegistersDefined.set(regNum);
 
@@ -238,6 +238,6 @@
         TTY.println("instruction %s", op);
         TTY.println("mode: %s  flags: %s", mode, flags);
         TTY.println("Unexpected value: %s %s", value.getClass().getSimpleName(), value);
-        throw Util.shouldNotReachHere();
+        throw GraalInternalError.shouldNotReachHere();
     }
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRXirInstruction.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRXirInstruction.java	Wed Feb 08 18:19:09 2012 -0800
@@ -28,7 +28,7 @@
 
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.xir.*;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.graph.*;
 
 public abstract class LIRXirInstruction extends LIRInstruction {
 
@@ -73,7 +73,7 @@
         } else if (mode == OperandMode.Output && index == 0) {
             return EnumSet.of(OperandFlag.Register);
         }
-        throw Util.shouldNotReachHere();
+        throw GraalInternalError.shouldNotReachHere();
     }
 
     public CiValue[] getOperands() {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/StandardOp.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/StandardOp.java	Wed Feb 08 18:19:09 2012 -0800
@@ -27,7 +27,7 @@
 import com.oracle.max.asm.*;
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.graal.compiler.asm.*;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.graph.*;
 
 /**
  * A collection of machine-independent LIR operations, as well as interfaces to be implemented for specific kinds or LIR
@@ -70,7 +70,7 @@
 
         @Override
         protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
 
         public Label getLabel() {
@@ -88,7 +88,7 @@
             if (mode == OperandMode.Output) {
                 return EnumSet.of(OperandFlag.Register, OperandFlag.Stack);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
 
         public void markResolved() {
@@ -131,7 +131,7 @@
 
         @Override
         protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
 
         public LabelRef destination() {
@@ -149,7 +149,7 @@
             if (mode == OperandMode.Alive) {
                 return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
 
         public void markResolved() {
@@ -205,7 +205,7 @@
             if (mode == OperandMode.Output) {
                 return EnumSet.of(OperandFlag.Register, OperandFlag.Stack);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/ValueUtil.java	Wed Feb 08 18:19:09 2012 -0800
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.max.graal.compiler.lir;
+
+import com.oracle.max.cri.ci.*;
+
+public class ValueUtil extends CiValueUtil {
+
+    public static boolean isVariable(CiValue value) {
+        assert value != null;
+        return value instanceof Variable;
+    }
+
+    public static Variable asVariable(CiValue value) {
+        assert value != null;
+        return (Variable) value;
+    }
+}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java	Wed Feb 08 18:19:09 2012 -0800
@@ -193,7 +193,7 @@
         } else if (GraalOptions.InliningPolicy == 1) {
             return new SizeBasedInliningPolicy();
         } else {
-            Util.shouldNotReachHere();
+            GraalInternalError.shouldNotReachHere();
             return null;
         }
     }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Arithmetic.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Arithmetic.java	Wed Feb 08 18:19:09 2012 -0800
@@ -32,7 +32,7 @@
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.graal.compiler.asm.*;
 import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.graph.*;
 
 public enum AMD64Arithmetic {
     IADD, ISUB, IMUL, IDIV, IREM, IUDIV, IUREM, IAND, IOR, IXOR, ISHL, ISHR, IUSHR,
@@ -67,7 +67,7 @@
             } else if (mode == OperandMode.Output && index == 0) {
                 return EnumSet.of(OperandFlag.Register);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -92,7 +92,7 @@
             } else if (mode == OperandMode.Output && index == 0) {
                 return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -120,7 +120,7 @@
             } else if (mode == OperandMode.Output && index == 0) {
                 return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
 
         @Override
@@ -159,7 +159,7 @@
             } else if (mode == OperandMode.Output && index == 0) {
                 return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
 
         @Override
@@ -202,7 +202,7 @@
             } else if (mode == OperandMode.Output && index == 0) {
                 return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
 
         @Override
@@ -240,7 +240,7 @@
             } else if (mode == OperandMode.Output && index == 0) {
                 return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
 
         @Override
@@ -281,7 +281,7 @@
             } else if (mode == OperandMode.Output && index == 0) {
                 return EnumSet.of(OperandFlag.Register);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
 
         @Override
@@ -309,7 +309,7 @@
             case I2B:  masm.signExtendByte(asIntReg(result)); break;
             case I2C:  masm.andl(asIntReg(result), 0xFFFF); break;
             case I2S:  masm.signExtendShort(asIntReg(result)); break;
-            default:   throw Util.shouldNotReachHere();
+            default:   throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -424,7 +424,7 @@
                     masm.divq(asRegister(src));
                     break;
                 default:
-                    throw Util.shouldNotReachHere();
+                    throw GraalInternalError.shouldNotReachHere();
             }
         } else if (isConstant(src)) {
             switch (opcode) {
@@ -463,7 +463,7 @@
                 case DAND: masm.andpd(asDoubleReg(dst), tasm.asDoubleConstRef(src, 16)); break;
                 case DOR:  masm.orpd(asDoubleReg(dst),  tasm.asDoubleConstRef(src, 16)); break;
                 case DXOR: masm.xorpd(asDoubleReg(dst), tasm.asDoubleConstRef(src, 16)); break;
-                default:   throw Util.shouldNotReachHere();
+                default:   throw GraalInternalError.shouldNotReachHere();
             }
         } else {
             switch (opcode) {
@@ -488,7 +488,7 @@
                 case DSUB: masm.subsd(asDoubleReg(dst), tasm.asDoubleAddr(src)); break;
                 case DMUL: masm.mulsd(asDoubleReg(dst), tasm.asDoubleAddr(src)); break;
                 case DDIV: masm.divsd(asDoubleReg(dst), tasm.asDoubleAddr(src)); break;
-                default:   throw Util.shouldNotReachHere();
+                default:   throw GraalInternalError.shouldNotReachHere();
             }
         }
 
@@ -504,7 +504,7 @@
         switch (result.kind) {
             case Int:  masm.cmpl(asIntReg(result),  Integer.MIN_VALUE); break;
             case Long: masm.cmpq(asLongReg(result), tasm.asLongConstRef(CiConstant.forLong(java.lang.Long.MIN_VALUE))); break;
-            default:   throw Util.shouldNotReachHere();
+            default:   throw GraalInternalError.shouldNotReachHere();
         }
         masm.jcc(ConditionFlag.equal, slowPath.start);
         masm.bind(slowPath.continuation);
@@ -527,7 +527,7 @@
             switch (x.kind) {
                 case Float:  masm.ucomiss(asFloatReg(x),  tasm.asFloatConstRef(CiConstant.FLOAT_0)); break;
                 case Double: masm.ucomisd(asDoubleReg(x), tasm.asDoubleConstRef(CiConstant.DOUBLE_0)); break;
-                default:     throw Util.shouldNotReachHere();
+                default:     throw GraalInternalError.shouldNotReachHere();
             }
             Label nan = new Label();
             masm.jcc(ConditionFlag.parity, nan);
@@ -538,7 +538,7 @@
             switch (result.kind) {
                 case Int:  masm.decrementl(asIntReg(result),  1); break;
                 case Long: masm.decrementq(asLongReg(result), 1); break;
-                default:   throw Util.shouldNotReachHere();
+                default:   throw GraalInternalError.shouldNotReachHere();
             }
             masm.jmp(continuation);
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Call.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Call.java	Wed Feb 08 18:19:09 2012 -0800
@@ -33,7 +33,7 @@
 import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.asm.*;
 import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.graph.*;
 
 public class AMD64Call {
 
@@ -63,7 +63,7 @@
             } else if (mode == OperandMode.Output) {
                 return EnumSet.of(OperandFlag.Register, OperandFlag.Illegal);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -103,7 +103,7 @@
             } else if (mode == OperandMode.Output) {
                 return EnumSet.of(OperandFlag.Register, OperandFlag.Illegal);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Compare.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Compare.java	Wed Feb 08 18:19:09 2012 -0800
@@ -30,7 +30,7 @@
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.graal.compiler.asm.*;
 import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.graph.*;
 
 public enum AMD64Compare {
     ICMP, LCMP, ACMP, FCMP, DCMP;
@@ -54,7 +54,7 @@
             } else if (mode == OperandMode.Input && index == 1) {
                 return EnumSet.of(OperandFlag.Register, OperandFlag.Stack, OperandFlag.Constant);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
 
         @Override
@@ -80,7 +80,7 @@
                 case ACMP: masm.cmpptr(asObjectReg(x), asObjectReg(y)); break;
                 case FCMP: masm.ucomiss(asFloatReg(x), asFloatReg(y)); break;
                 case DCMP: masm.ucomisd(asDoubleReg(x), asDoubleReg(y)); break;
-                default:   throw Util.shouldNotReachHere();
+                default:   throw GraalInternalError.shouldNotReachHere();
             }
         } else if (isConstant(y)) {
             switch (opcode) {
@@ -90,11 +90,11 @@
                     if (((CiConstant) y).isNull()) {
                         masm.cmpq(asObjectReg(x), 0); break;
                     } else {
-                        throw Util.shouldNotReachHere("Only null object constants are allowed in comparisons");
+                        throw GraalInternalError.shouldNotReachHere("Only null object constants are allowed in comparisons");
                     }
                 case FCMP: masm.ucomiss(asFloatReg(x), tasm.asFloatConstRef(y)); break;
                 case DCMP: masm.ucomisd(asDoubleReg(x), tasm.asDoubleConstRef(y)); break;
-                default:   throw Util.shouldNotReachHere();
+                default:   throw GraalInternalError.shouldNotReachHere();
             }
         } else {
             switch (opcode) {
@@ -103,7 +103,7 @@
                 case ACMP: masm.cmpptr(asObjectReg(x), tasm.asObjectAddr(y)); break;
                 case FCMP: masm.ucomiss(asFloatReg(x), tasm.asFloatAddr(y)); break;
                 case DCMP: masm.ucomisd(asDoubleReg(x), tasm.asDoubleAddr(y)); break;
-                default:  throw Util.shouldNotReachHere();
+                default:  throw GraalInternalError.shouldNotReachHere();
             }
         }
     }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64CompareToIntOpcode.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64CompareToIntOpcode.java	Wed Feb 08 18:19:09 2012 -0800
@@ -32,7 +32,7 @@
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.graal.compiler.asm.*;
 import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.graph.*;
 
 /**
  * Implementation of the Java bytecodes that compare a long, float, or double value and produce the
@@ -56,7 +56,7 @@
                 if (mode == OperandMode.Output && index == 0) {
                     return EnumSet.of(OperandFlag.Register);
                 }
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
             }
         };
     }
@@ -84,7 +84,7 @@
                 masm.jcc(ConditionFlag.below, low);
                 break;
             default:
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
         }
 
         // equal -> 0
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ControlFlow.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ControlFlow.java	Wed Feb 08 18:19:09 2012 -0800
@@ -34,7 +34,7 @@
 import com.oracle.max.cri.ci.CiTargetMethod.JumpTable;
 import com.oracle.max.graal.compiler.asm.*;
 import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.calc.*;
 
 public class AMD64ControlFlow {
@@ -54,7 +54,7 @@
             if (mode == OperandMode.Input && index == 0) {
                 return EnumSet.of(OperandFlag.Register, OperandFlag.Illegal);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -92,7 +92,7 @@
 
         @Override
         protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -159,7 +159,7 @@
             } else if (mode == OperandMode.Temp && index == 0) {
                 return EnumSet.of(OperandFlag.Register);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -186,7 +186,7 @@
             } else if (mode == OperandMode.Output && index == 0) {
                 return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
 
         @Override
@@ -225,7 +225,7 @@
             } else if (mode == OperandMode.Output && index == 0) {
                 return EnumSet.of(OperandFlag.Register);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -321,13 +321,13 @@
             switch (other.kind) {
                 case Int:  masm.cmovl(cond, asRegister(result), asRegister(other)); break;
                 case Long: masm.cmovq(cond, asRegister(result), asRegister(other)); break;
-                default:   throw Util.shouldNotReachHere();
+                default:   throw GraalInternalError.shouldNotReachHere();
             }
         } else {
             switch (other.kind) {
                 case Int:  masm.cmovl(cond, asRegister(result), tasm.asAddress(other)); break;
                 case Long: masm.cmovq(cond, asRegister(result), tasm.asAddress(other)); break;
-                default:   throw Util.shouldNotReachHere();
+                default:   throw GraalInternalError.shouldNotReachHere();
             }
         }
     }
@@ -346,7 +346,7 @@
             case BT: return ConditionFlag.below;
             case OF: return ConditionFlag.overflow;
             case NOF: return ConditionFlag.noOverflow;
-            default: throw Util.shouldNotReachHere();
+            default: throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -358,7 +358,7 @@
             case BE: return ConditionFlag.belowEqual;
             case AE: return ConditionFlag.aboveEqual;
             case AT: return ConditionFlag.above;
-            default: throw Util.shouldNotReachHere();
+            default: throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -377,7 +377,7 @@
             case noOverflow:
                 return true;
             default:
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
         }
     }
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64DeoptimizationStub.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64DeoptimizationStub.java	Wed Feb 08 18:19:09 2012 -0800
@@ -30,7 +30,7 @@
 import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.asm.*;
 import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.DeoptimizeNode.DeoptAction;
 
 public class AMD64DeoptimizationStub extends AMD64SlowPath {
@@ -79,7 +79,7 @@
                 code = 4;
                 break;
             default:
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
         }
         masm.movq(scratch, code);
         // TODO Why use scratch register here? Is it an implicit calling convention that the runtime function reads this register?
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java	Wed Feb 08 18:19:09 2012 -0800
@@ -222,7 +222,7 @@
             case Object: append(new BranchOp(cond, label, info)); break;
             case Float:
             case Double: append(new FloatBranchOp(cond, unorderedIsTrue, label, info)); break;
-            default: throw Util.shouldNotReachHere("" + left.kind);
+            default: throw GraalInternalError.shouldNotReachHere("" + left.kind);
         }
     }
 
@@ -253,7 +253,7 @@
             case Object: append(new CompareOp(ACMP, left, right)); break;
             case Float: append(new CompareOp(FCMP, left, right)); break;
             case Double: append(new CompareOp(DCMP, left, right)); break;
-            default: throw Util.shouldNotReachHere();
+            default: throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -265,7 +265,7 @@
             case Long:   append(new Op1Stack(LNEG, result, input)); break;
             case Float:  append(new Op2Reg(FXOR, result, input, CiConstant.forFloat(Float.intBitsToFloat(0x80000000)))); break;
             case Double: append(new Op2Reg(DXOR, result, input, CiConstant.forDouble(Double.longBitsToDouble(0x8000000000000000L)))); break;
-            default: throw Util.shouldNotReachHere();
+            default: throw GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -278,7 +278,7 @@
             case Long:   append(new Op2Stack(LADD, result, a, loadNonConst(b))); break;
             case Float:  append(new Op2Stack(FADD, result, a, loadNonConst(b))); break;
             case Double: append(new Op2Stack(DADD, result, a, loadNonConst(b))); break;
-            default:     throw Util.shouldNotReachHere();
+            default:     throw GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -291,7 +291,7 @@
             case Long:   append(new Op2Stack(LSUB, result, a, loadNonConst(b))); break;
             case Float:  append(new Op2Stack(FSUB, result, a, loadNonConst(b))); break;
             case Double: append(new Op2Stack(DSUB, result, a, loadNonConst(b))); break;
-            default:     throw Util.shouldNotReachHere();
+            default:     throw GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -304,7 +304,7 @@
             case Long:   append(new Op2Reg(LMUL, result, a, loadNonConst(b))); break;
             case Float:  append(new Op2Stack(FMUL, result, a, loadNonConst(b))); break;
             case Double: append(new Op2Stack(DMUL, result, a, loadNonConst(b))); break;
-            default:     throw Util.shouldNotReachHere();
+            default:     throw GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -331,7 +331,7 @@
                 return result;
             }
             default:
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -351,7 +351,7 @@
             case Double:
                 return emitCallToRuntime(CiRuntimeCall.ArithmeticDrem, false, a, b);
             default:
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -367,7 +367,7 @@
                 append(new DivOp(LUDIV, RAX_L, RAX_L, load(b), state()));
                 return emitMove(RAX_L);
             default:
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -383,7 +383,7 @@
                 append(new DivOp(LUREM, RDX_L, RAX_L, load(b), state()));
                 return emitMove(RDX_L);
             default:
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -394,7 +394,7 @@
         switch(a.kind) {
             case Int:    append(new Op2Stack(IAND, result, a, loadNonConst(b))); break;
             case Long:   append(new Op2Stack(LAND, result, a, loadNonConst(b))); break;
-            default:     throw Util.shouldNotReachHere();
+            default:     throw GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -405,7 +405,7 @@
         switch(a.kind) {
             case Int:    append(new Op2Stack(IOR, result, a, loadNonConst(b))); break;
             case Long:   append(new Op2Stack(LOR, result, a, loadNonConst(b))); break;
-            default:     throw Util.shouldNotReachHere();
+            default:     throw GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -416,7 +416,7 @@
         switch(a.kind) {
             case Int:    append(new Op2Stack(IXOR, result, a, loadNonConst(b))); break;
             case Long:   append(new Op2Stack(LXOR, result, a, loadNonConst(b))); break;
-            default:     throw Util.shouldNotReachHere();
+            default:     throw GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -428,7 +428,7 @@
         switch (a.kind) {
             case Int:    append(new ShiftOp(ISHL, result, a, loadShiftCount(b))); break;
             case Long:   append(new ShiftOp(LSHL, result, a, loadShiftCount(b))); break;
-            default: Util.shouldNotReachHere();
+            default: GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -439,7 +439,7 @@
         switch (a.kind) {
             case Int:    append(new ShiftOp(ISHR, result, a, loadShiftCount(b))); break;
             case Long:   append(new ShiftOp(LSHR, result, a, loadShiftCount(b))); break;
-            default: Util.shouldNotReachHere();
+            default: GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -450,7 +450,7 @@
         switch (a.kind) {
             case Int:    append(new ShiftOp(IUSHR, result, a, loadShiftCount(b))); break;
             case Long:   append(new ShiftOp(LUSHR, result, a, loadShiftCount(b))); break;
-            default: Util.shouldNotReachHere();
+            default: GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -489,7 +489,7 @@
             case MOV_L2D: append(new Op1Reg(MOV_L2D, result, input)); break;
             case MOV_F2I: append(new Op1Reg(MOV_F2I, result, input)); break;
             case MOV_D2L: append(new Op1Reg(MOV_D2L, result, input)); break;
-            default: throw Util.shouldNotReachHere();
+            default: throw GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -618,7 +618,7 @@
                 append(CMP2INT.create(result));
                 break;
             default:
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
         }
         setResult(x, result);
     }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Move.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Move.java	Wed Feb 08 18:19:09 2012 -0800
@@ -34,6 +34,7 @@
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.compiler.lir.StandardOp.MoveOp;
 import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.graph.*;
 
 public class AMD64Move {
 
@@ -63,7 +64,7 @@
             } else if (mode == OperandMode.Output && index == 0) {
                 return EnumSet.of(OperandFlag.Register, OperandFlag.Stack);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -94,7 +95,7 @@
             } else if (mode == OperandMode.Output && index == 0) {
                 return EnumSet.of(OperandFlag.Register, OperandFlag.RegisterHint);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -125,7 +126,7 @@
             } else if (mode == OperandMode.Output && index == 0) {
                 return EnumSet.of(OperandFlag.Register, OperandFlag.Stack);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -147,7 +148,7 @@
             } else if (mode == OperandMode.Output && index == 0) {
                 return EnumSet.of(OperandFlag.Register);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -169,7 +170,7 @@
             } else if (mode == OperandMode.Input && index == 1) {
                 return EnumSet.of(OperandFlag.Register, OperandFlag.Constant);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -191,7 +192,7 @@
             } else if (mode == OperandMode.Output && index == 0) {
                 return EnumSet.of(OperandFlag.Register);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -211,7 +212,7 @@
 
         @Override
         protected EnumSet<OperandFlag> flagsFor(OperandMode mode, int index) {
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -232,7 +233,7 @@
             if (mode == OperandMode.Input && index == 0) {
                 return EnumSet.of(OperandFlag.Register);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -258,7 +259,7 @@
             } else if (mode == OperandMode.Output && index == 0) {
                 return EnumSet.of(OperandFlag.Register);
             }
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -270,13 +271,13 @@
             } else if (isStackSlot(result)) {
                 reg2stack(tasm, masm, result, input);
             } else {
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
             }
         } else if (isStackSlot(input)) {
             if (isRegister(result)) {
                 stack2reg(tasm, masm, result, input);
             } else {
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
             }
         } else if (isConstant(input)) {
             if (isRegister(result)) {
@@ -284,10 +285,10 @@
             } else if (isStackSlot(result)) {
                 const2stack(tasm, masm, result, (CiConstant) input);
             } else {
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
             }
         } else {
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -302,7 +303,7 @@
             case Float:  masm.movflt(asFloatReg(result),  asFloatReg(input)); break;
             case Double: masm.movdbl(asDoubleReg(result), asDoubleReg(input)); break;
             case Object: masm.movq(asRegister(result),    asRegister(input)); break;
-            default:     throw Util.shouldNotReachHere("kind=" + result.kind);
+            default:     throw GraalInternalError.shouldNotReachHere("kind=" + result.kind);
         }
     }
 
@@ -314,7 +315,7 @@
             case Float:  masm.movflt(tasm.asAddress(result), asFloatReg(input)); break;
             case Double: masm.movsd(tasm.asAddress(result),  asDoubleReg(input)); break;
             case Object: masm.movq(tasm.asAddress(result),   asRegister(input)); break;
-            default:     throw Util.shouldNotReachHere();
+            default:     throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -326,7 +327,7 @@
             case Float:  masm.movflt(asFloatReg(result),  tasm.asAddress(input)); break;
             case Double: masm.movdbl(asDoubleReg(result), tasm.asAddress(input)); break;
             case Object: masm.movq(asRegister(result),    tasm.asAddress(input)); break;
-            default:     throw Util.shouldNotReachHere();
+            default:     throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -375,7 +376,7 @@
                 }
                 break;
             default:
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -390,11 +391,11 @@
                 if (c.isNull()) {
                     masm.movlong(tasm.asAddress(result), 0L);
                 } else {
-                    throw Util.shouldNotReachHere("Non-null object constants must be in register");
+                    throw GraalInternalError.shouldNotReachHere("Non-null object constants must be in register");
                 }
                 break;
             default:
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -413,7 +414,7 @@
             case Float:  masm.movflt(asFloatReg(result),  loadAddr); break;
             case Double: masm.movdbl(asDoubleReg(result), loadAddr); break;
             case Object: masm.movq(asRegister(result),    loadAddr); break;
-            default:     throw Util.shouldNotReachHere();
+            default:     throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -433,7 +434,7 @@
                 case Float:  masm.movflt(storeAddr, asFloatReg(input)); break;
                 case Double: masm.movsd(storeAddr,  asDoubleReg(input)); break;
                 case Object: masm.movq(storeAddr,   asRegister(input)); break;
-                default:     throw Util.shouldNotReachHere();
+                default:     throw GraalInternalError.shouldNotReachHere();
             }
         } else if (isConstant(input)) {
             CiConstant c = (CiConstant) input;
@@ -448,24 +449,24 @@
                     if (Util.isInt(c.asLong())) {
                         masm.movslq(storeAddr, (int) c.asLong());
                     } else {
-                        throw Util.shouldNotReachHere("Cannot store 64-bit constants to memory");
+                        throw GraalInternalError.shouldNotReachHere("Cannot store 64-bit constants to memory");
                     }
                     break;
                 case Float:  masm.movl(storeAddr, floatToRawIntBits(c.asFloat())); break;
-                case Double: throw Util.shouldNotReachHere("Cannot store 64-bit constants to memory");
+                case Double: throw GraalInternalError.shouldNotReachHere("Cannot store 64-bit constants to memory");
                 case Object:
                     if (c.isNull()) {
                         masm.movptr(storeAddr, 0);
                     } else {
-                        throw Util.shouldNotReachHere("Cannot store 64-bit constants to memory");
+                        throw GraalInternalError.shouldNotReachHere("Cannot store 64-bit constants to memory");
                     }
                     break;
                 default:
-                    throw Util.shouldNotReachHere();
+                    throw GraalInternalError.shouldNotReachHere();
             }
 
         } else {
-            throw Util.shouldNotReachHere();
+            throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -479,7 +480,7 @@
             case Int:    masm.cmpxchgl(asRegister(newValue), address); break;
             case Long:
             case Object: masm.cmpxchgq(asRegister(newValue), address); break;
-            default:     throw Util.shouldNotReachHere();
+            default:     throw GraalInternalError.shouldNotReachHere();
         }
     }
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64XirOp.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64XirOp.java	Wed Feb 08 18:19:09 2012 -0800
@@ -41,7 +41,7 @@
 import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.asm.*;
 import com.oracle.max.graal.compiler.lir.*;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.graph.*;
 
 public class AMD64XirOp extends LIRXirInstruction {
     public AMD64XirOp(XirSnippet snippet, CiValue[] operands, CiValue outputOperand, CiValue[] inputs, CiValue[] temps, int[] inputOperandIndices, int[] tempOperandIndices, int outputOperandIndex,
@@ -480,7 +480,7 @@
                     break;
                 }
                 default:
-                    throw Util.shouldNotReachHere("Unknown XIR operation " + inst.op);
+                    throw GraalInternalError.shouldNotReachHere("Unknown XIR operation " + inst.op);
             }
         }
     }
@@ -493,7 +493,7 @@
             case Long: code = longOp; break;
             case Float: code = floatOp; break;
             case Double: code = doubleOp; break;
-            default: throw Util.shouldNotReachHere();
+            default: throw GraalInternalError.shouldNotReachHere();
         }
         assert left == result;
         if (isRegister(right) && right.kind != result.kind) {
@@ -514,7 +514,7 @@
             case Object: code = AMD64Compare.ACMP; break;
             case Float: code = AMD64Compare.FCMP; break;
             case Double: code = AMD64Compare.DCMP; break;
-            default: throw Util.shouldNotReachHere();
+            default: throw GraalInternalError.shouldNotReachHere();
         }
         AMD64Compare.emit(tasm, masm, code, x, y);
         masm.jcc(cflag, label);
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/Util.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/Util.java	Wed Feb 08 18:19:09 2012 -0800
@@ -42,22 +42,6 @@
     public static final char SUB_SECTION_CHARACTER = '=';
     public static final char SEPERATOR_CHARACTER = '-';
 
-    public static RuntimeException unimplemented() {
-        throw new GraalInternalError("unimplemented");
-    }
-
-    public static RuntimeException unimplemented(String msg, Object... args) {
-        throw new GraalInternalError("unimplemented: " + msg, args);
-    }
-
-    public static RuntimeException shouldNotReachHere() {
-        throw new GraalInternalError("should not reach here");
-    }
-
-    public static RuntimeException shouldNotReachHere(String msg, Object... args) {
-        throw new GraalInternalError("should not reach here: " + msg, args);
-    }
-
     public static <T> boolean replaceInList(T a, T b, List<T> list) {
         final int max = list.size();
         for (int i = 0; i < max; i++) {
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/GraalInternalError.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/GraalInternalError.java	Wed Feb 08 18:19:09 2012 -0800
@@ -30,13 +30,30 @@
 public class GraalInternalError extends Error {
 
     /**
-     * 
+     *
      */
     private static final long serialVersionUID = 8776065085829593278L;
     private Node node;
     private Graph graph;
     private final ArrayList<String> context = new ArrayList<>();
 
+    public static RuntimeException unimplemented() {
+        throw new GraalInternalError("unimplemented");
+    }
+
+    public static RuntimeException unimplemented(String msg) {
+        throw new GraalInternalError("unimplemented: %s", msg);
+    }
+
+    public static RuntimeException shouldNotReachHere() {
+        throw new GraalInternalError("should not reach here");
+    }
+
+    public static RuntimeException shouldNotReachHere(String msg) {
+        throw new GraalInternalError("should not reach here: %s", msg);
+    }
+
+
     /**
      * This constructor creates a {@link GraalInternalError} with a message assembled via {@link String#format(String, Object...)}.
      * It always uses the ENGLISH locale in order to always generate the same output.
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotRegisterConfig.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotRegisterConfig.java	Wed Feb 08 18:19:09 2012 -0800
@@ -28,10 +28,10 @@
 
 import com.oracle.max.asm.target.amd64.*;
 import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiCallingConvention.*;
-import com.oracle.max.cri.ci.CiRegister.*;
+import com.oracle.max.cri.ci.CiCallingConvention.Type;
+import com.oracle.max.cri.ci.CiRegister.RegisterFlag;
 import com.oracle.max.cri.ri.*;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.hotspot.*;
 
 public class HotSpotRegisterConfig implements RiRegisterConfig {
@@ -146,7 +146,7 @@
                     }
                     break;
                 default:
-                    throw Util.shouldNotReachHere();
+                    throw GraalInternalError.shouldNotReachHere();
             }
 
             if (locations[i] == null) {
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotTypePrimitive.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/ri/HotSpotTypePrimitive.java	Wed Feb 08 18:19:09 2012 -0800
@@ -26,7 +26,7 @@
 
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ri.*;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.hotspot.Compiler;
 
 /**
@@ -74,7 +74,7 @@
 
     @Override
     public CiConstant getEncoding(Representation r) {
-        throw Util.unimplemented("HotSpotTypePrimitive.getEncoding");
+        throw GraalInternalError.unimplemented("HotSpotTypePrimitive.getEncoding");
     }
 
     @Override
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/target/amd64/AMD64TailcallOp.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/target/amd64/AMD64TailcallOp.java	Wed Feb 08 18:19:09 2012 -0800
@@ -31,7 +31,7 @@
 import com.oracle.max.graal.compiler.asm.*;
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.compiler.target.amd64.*;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.graph.*;
 
 /**
  * Performs a hard-coded tail call to the specified target, which normally should be an RiCompiledCode instance.
@@ -72,6 +72,6 @@
         } else if (mode == OperandMode.Temp) {
             return EnumSet.of(OperandFlag.Register);
         }
-        throw Util.shouldNotReachHere();
+        throw GraalInternalError.shouldNotReachHere();
     }
 }
--- a/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.java/src/com/oracle/max/graal/java/GraphBuilderPhase.java	Wed Feb 08 18:19:09 2012 -0800
@@ -499,7 +499,7 @@
                 break;
             }
             default:
-                throw Util.shouldNotReachHere();
+                throw GraalInternalError.shouldNotReachHere();
         }
 
     }
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/nodes/MathIntrinsicNode.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/nodes/MathIntrinsicNode.java	Wed Feb 08 18:19:09 2012 -0800
@@ -28,7 +28,7 @@
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.compiler.target.amd64.AMD64Arithmetic.Op2Reg;
 import com.oracle.max.graal.compiler.target.amd64.*;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
 import com.oracle.max.graal.nodes.calc.*;
 import com.oracle.max.graal.nodes.spi.*;
@@ -71,7 +71,7 @@
             case SIN:   gen.append(new AMD64MathIntrinsicOp(AMD64MathIntrinsicOp.Opcode.SIN, result, input)); break;
             case COS:   gen.append(new AMD64MathIntrinsicOp(AMD64MathIntrinsicOp.Opcode.COS, result, input)); break;
             case TAN:   gen.append(new AMD64MathIntrinsicOp(AMD64MathIntrinsicOp.Opcode.TAN, result, input)); break;
-            default:    throw Util.shouldNotReachHere();
+            default:    throw GraalInternalError.shouldNotReachHere();
         }
         gen.setResult(this, result);
     }
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/target/amd64/AMD64MathIntrinsicOp.java	Wed Feb 08 15:36:41 2012 -0800
+++ b/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/target/amd64/AMD64MathIntrinsicOp.java	Wed Feb 08 18:19:09 2012 -0800
@@ -31,7 +31,7 @@
 import com.oracle.max.graal.compiler.asm.*;
 import com.oracle.max.graal.compiler.lir.*;
 import com.oracle.max.graal.compiler.target.amd64.*;
-import com.oracle.max.graal.compiler.util.*;
+import com.oracle.max.graal.graph.*;
 
 public class AMD64MathIntrinsicOp extends AMD64LIRInstruction {
     public enum Opcode  {
@@ -57,7 +57,7 @@
             case SIN:   masm.fsin(asDoubleReg(result), asDoubleReg(input)); break;
             case COS:   masm.fcos(asDoubleReg(result), asDoubleReg(input)); break;
             case TAN:   masm.ftan(asDoubleReg(result), asDoubleReg(input)); break;
-            default:    throw Util.shouldNotReachHere();
+            default:    throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -68,6 +68,6 @@
         } else if (mode == OperandMode.Output && index == 0) {
             return EnumSet.of(OperandFlag.Register);
         }
-        throw Util.shouldNotReachHere();
+        throw GraalInternalError.shouldNotReachHere();
     }
 }