External Core: print function types correctly, improve newtype pretty-printing
[ghc-hetmet.git] / compiler / cmm / CLabel.hs
index 14009f4..751575b 100644 (file)
@@ -1,3 +1,10 @@
+{-# OPTIONS -w #-}
+-- The above warning supression flag is a temporary kludge.
+-- While working on this module you are encouraged to remove it and fix
+-- any warnings in the module. See
+--     http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings
+-- for details
+
 -----------------------------------------------------------------------------
 --
 -- Object-file symbols (called CLabel for histerical raisins).
@@ -6,13 +13,6 @@
 --
 -----------------------------------------------------------------------------
 
-{-# OPTIONS_GHC -w #-}
--- The above warning supression flag is a temporary kludge.
--- While working on this module you are encouraged to remove it and fix
--- any warnings in the module. See
---     http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions#Warnings
--- for details
-
 module CLabel (
        CLabel, -- abstract type
 
@@ -89,6 +89,7 @@ module CLabel (
        mkRtsApFastLabel,
 
        mkForeignLabel,
+        addLabelSize,
 
        mkCCLabel, mkCCSLabel,
 
@@ -324,7 +325,8 @@ mkAltLabel      uniq tag    = CaseLabel uniq (CaseAlt tag)
 mkDefaultLabel  uniq           = CaseLabel uniq CaseDefault
 
 mkStringLitLabel               = StringLitLabel
-mkAsmTempLabel                         = AsmTempLabel
+mkAsmTempLabel :: Uniquable a => a -> CLabel
+mkAsmTempLabel a               = AsmTempLabel (getUnique a)
 
 mkModuleInitLabel :: Module -> String -> CLabel
 mkModuleInitLabel mod way        = ModuleInitLabel mod way
@@ -364,6 +366,12 @@ mkApEntryLabel upd off             = RtsLabel (RtsApEntry   upd off)
 mkForeignLabel :: FastString -> Maybe Int -> Bool -> CLabel
 mkForeignLabel str mb_sz  is_dynamic = ForeignLabel str mb_sz is_dynamic
 
+addLabelSize :: CLabel -> Int -> CLabel
+addLabelSize (ForeignLabel str _ is_dynamic) sz
+  = ForeignLabel str (Just sz) is_dynamic
+addLabelSize label _
+  = label
+
        -- Cost centres etc.
 
 mkCCLabel      cc              = CC_Label cc