[project @ 1998-12-02 13:17:09 by simonm]
[ghc-hetmet.git] / ghc / compiler / nativeGen / Stix.lhs
index f187e9f..89bb3cc 100644 (file)
@@ -1,27 +1,32 @@
 %
-% (c) The AQUA Project, Glasgow University, 1993-1996
+% (c) The AQUA Project, Glasgow University, 1993-1998
 %
 
 \begin{code}
-#include "HsVersions.h"
-
 module Stix (
-       CodeSegment(..), StixReg(..), StixTree(..), StixTreeList(..),
+       CodeSegment(..), StixReg(..), StixTree(..), StixTreeList,
        sStLitLbl,
 
-       stgBaseReg, stgStkOReg, stgNode, stgTagReg, stgRetReg,
-       stgSpA, stgSuA, stgSpB, stgSuB, stgHp, stgHpLim, stgLivenessReg,
-       stgStdUpdRetVecReg, stgStkStubReg,
-       getUniqLabelNCG
+       stgBaseReg, stgNode, stgSp, stgSu, stgSpLim, stgHp, stgHpLim, stgTagReg,
+       getUniqLabelNCG,
+
+       fixedHS, arrHS
     ) where
 
-import Ubiq{-uitous-}
+#include "HsVersions.h"
+
+import Ratio           ( Rational )
 
-import AbsCSyn         ( node, infoptr, MagicId(..) )
+import AbsCSyn         ( node, tagreg, MagicId(..) )
 import AbsCUtils       ( magicIdPrimRep )
-import CLabel          ( mkAsmTempLabel )
-import UniqSupply      ( returnUs, thenUs, getUnique, UniqSM(..) )
-import Unpretty                ( uppPStr, Unpretty(..) )
+import CallConv                ( CallConv )
+import CLabel          ( mkAsmTempLabel, CLabel )
+import PrimRep          ( PrimRep )
+import PrimOp           ( PrimOp )
+import Unique           ( Unique )
+import SMRep           ( fixedHdrSize, arrHdrSize )
+import UniqSupply      ( returnUs, thenUs, getUniqueUs, UniqSM )
+import Outputable
 \end{code}
 
 Here is the tag at the nodes of our @StixTree@.         Notice its
@@ -38,7 +43,7 @@ data StixTree
   | StInt      Integer     -- ** add Kind at some point
   | StDouble   Rational
   | StString   FAST_STRING
-  | StLitLbl   Unpretty    -- literal labels
+  | StLitLbl   SDoc    -- literal labels
                            -- (will be _-prefixed on some machines)
   | StLitLit   FAST_STRING -- innards from CLitLit
   | StCLbl     CLabel      -- labels that we might index into
@@ -92,14 +97,14 @@ data StixTree
 
     -- Calls to C functions
 
-  | StCall FAST_STRING PrimRep [StixTree]
+  | StCall FAST_STRING CallConv PrimRep [StixTree]
 
     -- Assembly-language comments
 
   | StComment FAST_STRING
 
 sStLitLbl :: FAST_STRING -> StixTree
-sStLitLbl s = StLitLbl (uppPStr s)
+sStLitLbl s = StLitLbl (ptext s)
 \end{code}
 
 Stix registers can have two forms.  They {\em may} or {\em may not}
@@ -125,28 +130,23 @@ type StixTreeList = [StixTree] -> [StixTree]
 
 Stix Trees for STG registers:
 \begin{code}
-stgBaseReg, stgStkOReg, stgNode, stgTagReg, stgRetReg, stgSpA,
-    stgSuA, stgSpB, stgSuB, stgHp, stgHpLim, stgLivenessReg,
-    stgStdUpdRetVecReg, stgStkStubReg :: StixTree
+stgBaseReg, stgNode, stgSp, stgSu, stgSpLim, stgHp, stgHpLim 
+       :: StixTree
 
 stgBaseReg         = StReg (StixMagicId BaseReg)
-stgStkOReg         = StReg (StixMagicId StkOReg)
 stgNode            = StReg (StixMagicId node)
-stgInfoPtr         = StReg (StixMagicId infoptr)
-stgTagReg          = StReg (StixMagicId TagReg)
-stgRetReg          = StReg (StixMagicId RetReg)
-stgSpA                     = StReg (StixMagicId SpA)
-stgSuA                     = StReg (StixMagicId SuA)
-stgSpB                     = StReg (StixMagicId SpB)
-stgSuB                     = StReg (StixMagicId SuB)
+stgTagReg          = StReg (StixMagicId tagreg)
+stgSp              = StReg (StixMagicId Sp)
+stgSu              = StReg (StixMagicId Su)
+stgSpLim           = StReg (StixMagicId SpLim)
 stgHp              = StReg (StixMagicId Hp)
 stgHpLim           = StReg (StixMagicId HpLim)
-stgLivenessReg     = StReg (StixMagicId LivenessReg)
-stgStdUpdRetVecReg  = StReg (StixMagicId StdUpdRetVecReg)
-stgStkStubReg      = StReg (StixMagicId StkStubReg)
 
 getUniqLabelNCG :: UniqSM CLabel
 getUniqLabelNCG
-  = getUnique        `thenUs` \ u ->
+  = getUniqueUs              `thenUs` \ u ->
     returnUs (mkAsmTempLabel u)
+
+fixedHS = StInt (toInteger fixedHdrSize)
+arrHS   = StInt (toInteger arrHdrSize)
 \end{code}