[project @ 1998-02-05 12:23:33 by simonm]
[ghc-hetmet.git] / ghc / compiler / nativeGen / StixInfo.lhs
index e827167..cb84530 100644 (file)
@@ -1,24 +1,30 @@
 %
-% (c) The AQUA Project, Glasgow University, 1993-1995
+% (c) The AQUA Project, Glasgow University, 1993-1996
 %
 
 \begin{code}
-#include "HsVersions.h"
-
-module StixInfo (
-       genCodeInfoTable
-    ) where
+module StixInfo ( genCodeInfoTable ) where
 
-import AbsCSyn
-import ClosureInfo
-import MachDesc
-import Maybes          ( maybeToBool, Maybe(..) )
-import SMRep           ( SMRep(..), SMSpecRepKind(..), SMUpdateKind(..) )
-import Stix
-import UniqSupply
-import Unpretty
-import Util
+#include "HsVersions.h"
 
+import AbsCSyn         ( AbstractC(..), CAddrMode, ReturnInfo,
+                         RegRelative, MagicId, CStmtMacro
+                       )
+import ClosureInfo     ( closurePtrsSize, closureSizeWithoutFixedHdr,
+                         closureNonHdrSize, closureSemiTag, maybeSelectorInfo,
+                         closureSMRep, closureLabelFromCI,
+                         infoTableLabelFromCI
+                       )
+import HeapOffs                ( hpRelToInt )
+import Maybes          ( maybeToBool )
+import PrimRep         ( PrimRep(..) )
+import SMRep           ( SMRep(..), SMSpecRepKind(..), SMUpdateKind(..),
+                         isSpecRep
+                       )
+import Stix            -- all of it
+import StixPrim                ( amodeToStix )
+import UniqSupply      ( returnUs, UniqSM )
+import Outputable      ( hcat, ptext, int, char )
 \end{code}
 
 Generating code for info tables (arrays of data).
@@ -36,14 +42,11 @@ data___rtbl = sStLitLbl SLIT("Data___rtbl")
 dyn___rtbl     = sStLitLbl SLIT("Dyn___rtbl")
 
 genCodeInfoTable
-    :: {-Target-}
-       (HeapOffset -> Int)     -- needed bit of Target
-    -> (CAddrMode -> StixTree) -- ditto
-    -> AbstractC
+    :: AbstractC
     -> UniqSM StixTreeList
 
-genCodeInfoTable hp_rel amode2stix (CClosureInfoAndCode cl_info _ _ upd cl_descr _) =
-    returnUs (\xs -> info : lbl : xs)
+genCodeInfoTable (CClosureInfoAndCode cl_info _ _ upd cl_descr _)
+  = returnUs (\xs -> info : lbl : xs)
 
     where
        info = StData PtrRep table
@@ -74,21 +77,21 @@ genCodeInfoTable hp_rel amode2stix (CClosureInfoAndCode cl_info _ _ upd cl_descr
                tag]
 
            SpecialisedRep _ _ _ updatable ->
-               let rtbl = uppBesides (
+               let rtbl = hcat (
                       if is_selector then
-                         [uppPStr SLIT("Select__"),
-                          uppInt select_word,
-                          uppPStr SLIT("_rtbl")]
+                         [ptext SLIT("Select__"),
+                          int select_word,
+                          ptext SLIT("_rtbl")]
                       else
-                         [uppPStr (case updatable of
+                         [ptext (case updatable of
                                    SMNormalForm -> SLIT("Spec_N_")
                                    SMSingleEntry -> SLIT("Spec_S_")
                                    SMUpdatable -> SLIT("Spec_U_")
                                   ),
-                          uppInt size,
-                          uppChar '_',
-                          uppInt ptrs,
-                          uppPStr SLIT("_rtbl")])
+                          int size,
+                          char '_',
+                          int ptrs,
+                          ptext SLIT("_rtbl")])
                in
                    case updatable of
                        SMNormalForm -> [upd_code, StLitLbl rtbl, tag]
@@ -133,11 +136,10 @@ genCodeInfoTable hp_rel amode2stix (CClosureInfoAndCode cl_info _ _ upd cl_descr
 
        size    = if isSpecRep sm_rep
                  then closureNonHdrSize cl_info
-                 else hp_rel (closureSizeWithoutFixedHdr cl_info)
+                 else hpRelToInt (closureSizeWithoutFixedHdr cl_info)
        ptrs    = closurePtrsSize cl_info
 
-       upd_code = amode2stix upd
+       upd_code = amodeToStix upd
 
        info_unused = StInt (-1)
-
 \end{code}