RTS tidyup sweep, first phase
[ghc-hetmet.git] / compiler / nativeGen / X86 / Ppr.hs
index ffd839a..c0f4657 100644 (file)
@@ -43,7 +43,9 @@ import Outputable     (panic, Outputable)
 
 import Data.Word
 
-
+#if i386_TARGET_ARCH && darwin_TARGET_OS
+import Data.Bits
+#endif
 
 -- -----------------------------------------------------------------------------
 -- Printing this stuff out
@@ -96,7 +98,13 @@ pprData :: CmmStatic -> Doc
 pprData (CmmAlign bytes)         = pprAlign bytes
 pprData (CmmDataLabel lbl)       = pprLabel lbl
 pprData (CmmString str)          = pprASCII str
+
+#if  darwin_TARGET_OS
+pprData (CmmUninitialised bytes) = ptext (sLit ".space ") <> int bytes
+#else
 pprData (CmmUninitialised bytes) = ptext (sLit ".skip ") <> int bytes
+#endif
+
 pprData (CmmStaticLit lit)       = pprDataItem lit
 
 pprGloblDecl :: CLabel -> Doc
@@ -153,16 +161,6 @@ instance Outputable Instr where
     ppr         instr  = Outputable.docToSDoc $ pprInstr instr
 
 
-
-
-
-
-
-
-
-
-
-
 #if  i386_TARGET_ARCH || x86_64_TARGET_ARCH
 pprUserReg :: Reg -> Doc
 pprUserReg = pprReg IF_ARCH_i386(II32,) IF_ARCH_x86_64(II64,)
@@ -177,11 +175,12 @@ pprReg :: Size -> Reg -> Doc
 
 pprReg s r
   = case r of
-      RealReg i       -> ppr_reg_no s i
-      VirtualRegI  u  -> text "%vI_" <> asmSDoc (pprUnique u)
-      VirtualRegHi u  -> text "%vHi_" <> asmSDoc (pprUnique u)
-      VirtualRegF  u  -> text "%vF_" <> asmSDoc (pprUnique u)
-      VirtualRegD  u  -> text "%vD_" <> asmSDoc (pprUnique u)
+      RegReal    (RealRegSingle i) -> ppr_reg_no s i
+      RegReal    (RealRegPair _ _) -> panic "X86.Ppr: no reg pairs on this arch"
+      RegVirtual (VirtualRegI  u)  -> text "%vI_" <> asmSDoc (pprUnique u)
+      RegVirtual (VirtualRegHi u)  -> text "%vHi_" <> asmSDoc (pprUnique u)
+      RegVirtual (VirtualRegF  u)  -> text "%vF_" <> asmSDoc (pprUnique u)
+      RegVirtual (VirtualRegD  u)  -> text "%vD_" <> asmSDoc (pprUnique u)
   where
 #if i386_TARGET_ARCH
     ppr_reg_no :: Size -> Int -> Doc
@@ -301,6 +300,7 @@ pprSize x
 #elif x86_64_TARGET_ARCH
                FF32  -> sLit "ss"      -- "scalar single-precision float" (SSE2)
                FF64  -> sLit "sd"      -- "scalar double-precision float" (SSE2)
+                _     -> panic "X86.Ppr.pprSize: no match"
 #else
                _     -> panic "X86.Ppr.pprSize: no match"
 #endif
@@ -466,7 +466,7 @@ pprDataItem lit
        -- all such offsets will fit into 32 bits, so we have to stick
        -- to 32-bit offset fields and modify the RTS appropriately
         --
-        -- See Note [x86-64-relative] in includes/InfoTables.h
+        -- See Note [x86-64-relative] in includes/rts/storage/InfoTables.h
        -- 
        ppr_item II64  x 
           | isRelativeReloc x =
@@ -947,7 +947,7 @@ gsp :: Doc
 gsp   = char ' '
 
 gregno :: Reg -> RegNo
-gregno (RealReg i) = i
+gregno (RegReal (RealRegSingle i)) = i
 gregno _           = --pprPanic "gregno" (ppr other)
                      999   -- bogus; only needed for debug printing