merge GHC HEAD
[ghc-hetmet.git] / compiler / nativeGen / SPARC / ShortcutJump.hs
index f560f82..30e48bb 100644 (file)
@@ -1,6 +1,6 @@
 
 module SPARC.ShortcutJump (
-       JumpDest(..),
+       JumpDest(..), getJumpDestBlockId,
        canShortcut,
        shortcutJump,
        shortcutStatic,
@@ -14,9 +14,10 @@ import SPARC.Imm
 
 import CLabel
 import BlockId
-import Cmm
+import OldCmm
 
 import Panic
+import Unique
 
 
 
@@ -24,6 +25,10 @@ data JumpDest
        = DestBlockId BlockId 
        | DestImm Imm
 
+getJumpDestBlockId :: JumpDest -> Maybe BlockId
+getJumpDestBlockId (DestBlockId bid) = Just bid
+getJumpDestBlockId _                 = Nothing
+
 
 canShortcut :: Instr -> Maybe JumpDest
 canShortcut _ = Nothing
@@ -37,11 +42,11 @@ shortcutStatic :: (BlockId -> Maybe JumpDest) -> CmmStatic -> CmmStatic
 
 shortcutStatic fn (CmmStaticLit (CmmLabel lab))
        | Just uq <- maybeAsmTemp lab 
-       = CmmStaticLit (CmmLabel (shortBlockId fn (BlockId uq)))
+       = CmmStaticLit (CmmLabel (shortBlockId fn (mkBlockId uq)))
 
 shortcutStatic fn (CmmStaticLit (CmmLabelDiffOff lbl1 lbl2 off))
        | Just uq <- maybeAsmTemp lbl1
-       = CmmStaticLit (CmmLabelDiffOff (shortBlockId fn (BlockId uq)) lbl2 off)
+       = CmmStaticLit (CmmLabelDiffOff (shortBlockId fn (mkBlockId uq)) lbl2 off)
 
 -- slightly dodgy, we're ignoring the second label, but this
 -- works with the way we use CmmLabelDiffOff for jump tables now.
@@ -50,9 +55,9 @@ shortcutStatic _ other_static
 
 
 shortBlockId :: (BlockId -> Maybe JumpDest) -> BlockId -> CLabel
-shortBlockId fn blockid@(BlockId uq) =
+shortBlockId fn blockid =
    case fn blockid of
-      Nothing -> mkAsmTempLabel uq
+      Nothing -> mkAsmTempLabel (getUnique blockid)
       Just (DestBlockId blockid')  -> shortBlockId fn blockid'
       Just (DestImm (ImmCLbl lbl)) -> lbl
       _other -> panic "shortBlockId"