[project @ 2004-08-13 10:45:16 by simonmar]
[ghc-hetmet.git] / ghc / compiler / nativeGen / StixMacro.lhs
index 17068b1..be32d65 100644 (file)
@@ -22,7 +22,7 @@ import UniqSupply     ( returnUs, thenUs, UniqSM )
 import CLabel          ( mkBlackHoleInfoTableLabel, mkIndStaticInfoLabel,
                          mkIndInfoLabel, mkUpdInfoLabel, mkRtsGCEntryLabel )
 \end{code}
-
+--------------------------------------------------------------------------------
 The @ARGS_CHK_A{_LOAD_NODE}@ macros check for sufficient arguments on
 the A stack, and perform a tail call to @UpdatePAP@ if the arguments are
 not there.  The @_LOAD_NODE@ version also loads R1 with an appropriate
@@ -31,7 +31,7 @@ closure address.
 \begin{code}
 macroCode
     :: CStmtMacro          -- statement macro
-    -> [CAddrMode]         -- args
+    -> [StixExpr]          -- args
     -> UniqSM StixStmtList
 \end{code}
 
@@ -42,9 +42,8 @@ Updating a CAF
 adding an indirection.
 
 \begin{code}
-macroCode UPD_CAF args
+macroCode UPD_CAF [cafptr,bhptr]
   = let
-       [cafptr,bhptr] = map amodeToStix args
        new_caf = StVoidable (StCall (Left FSLIT("newCAF")) CCallConv VoidRep [cafptr])
        a1 = StAssignMem PtrRep (StIndex PtrRep cafptr fixedHS) bhptr
        a2 = StAssignMem PtrRep cafptr ind_static_info
@@ -74,7 +73,7 @@ macroCode UPD_BH_UPDATABLE args = returnUs id
 macroCode UPD_BH_SINGLE_ENTRY args = returnUs id
 {-
   = let
-       update = StAssign PtrRep (StInd PtrRep (amodeToStix arg)) bh_info
+       update = StAssign PtrRep (StInd PtrRep arg) bh_info
     in
     returnUs (\xs -> update : xs)
 -}
@@ -86,9 +85,8 @@ Update frames
 Push an update frame on the stack.
 
 \begin{code}
-macroCode PUSH_UPD_FRAME args
+macroCode PUSH_UPD_FRAME [bhptr, _{-0-}]
   = let
-       [bhptr, _{-0-}] = map amodeToStix args
        frame n = StIndex PtrRep (StReg stgSp) (StInt (toInteger (n-uF_SIZE)))
 
         -- HWL: these values are *wrong* in a GranSim setup; ToDo: fix
@@ -109,7 +107,7 @@ macroCode SET_TAG [tag]
        Right baseRegAddr 
           -> returnUs id
        Left  realreg 
-          -> let a1 = StAssignReg IntRep (StixMagicId tagreg) (amodeToStix tag)
+          -> let a1 = StAssignReg IntRep (StixMagicId tagreg) tag
              in returnUs ( \xs -> a1 : xs )
 \end{code}
 
@@ -118,7 +116,7 @@ macroCode SET_TAG [tag]
 \begin{code}
 macroCode REGISTER_IMPORT [arg]
    = returnUs (
-       \xs -> StAssignMem WordRep (StReg stgSp) (amodeToStix arg)
+       \xs -> StAssignMem WordRep (StReg stgSp) arg
             : StAssignReg PtrRep  stgSp (StMachOp MO_Nat_Add [StReg stgSp, StInt 4])
             : xs
      )
@@ -127,7 +125,7 @@ macroCode REGISTER_FOREIGN_EXPORT [arg]
    = returnUs (
        \xs -> StVoidable (
                   StCall (Left FSLIT("getStablePtr")) CCallConv VoidRep 
-                         [amodeToStix arg]
+                         [arg]
                )
             : xs
      )
@@ -145,11 +143,10 @@ Let's make sure that these CAFs are lifted out, shall we?
 \begin{code}
 -- Some common labels
 
-bh_info, ind_static_info, ind_info :: StixExpr
+bh_info, ind_static_info :: StixExpr
 
 bh_info        = StCLbl mkBlackHoleInfoTableLabel
 ind_static_info        = StCLbl mkIndStaticInfoLabel
-ind_info       = StCLbl mkIndInfoLabel
 upd_frame_info = StCLbl mkUpdInfoLabel
 
 -- Some common call trees
@@ -164,7 +161,7 @@ checkCode macro args assts
   = getUniqLabelNCG            `thenUs` \ ulbl_fail ->
     getUniqLabelNCG            `thenUs` \ ulbl_pass ->
 
-    let args_stix        = map amodeToStix args
+    let        args_stix        = map amodeToStix args
        newHp wds        = StIndex PtrRep (StReg stgHp) wds
        assign_hp wds    = StAssignReg PtrRep stgHp (newHp wds)
        hp_alloc wds     = StAssignReg IntRep stgHpAlloc wds
@@ -181,8 +178,7 @@ checkCode macro args assts
        join = StLabel ulbl_pass
 
         -- see includes/StgMacros.h for explaination of these magic consts
-        aLL_NON_PTRS
-           = IF_ARCH_alpha(16383,65535)
+        aLL_NON_PTRS = 0xff
 
         assign_liveness ptr_regs 
            = StAssignReg WordRep stgR9