[project @ 1998-12-18 17:40:31 by simonpj]
[ghc-hetmet.git] / ghc / compiler / nativeGen / AsmCodeGen.lhs
index 1edfe9a..1e297ad 100644 (file)
@@ -1,5 +1,5 @@
 %
-% (c) The AQUA Project, Glasgow University, 1993-1996
+% (c) The AQUA Project, Glasgow University, 1993-1998
 %
 
 \begin{code}
@@ -19,10 +19,9 @@ import AbsCSyn               ( AbstractC, MagicId )
 import AsmRegAlloc     ( runRegAllocate )
 import OrdList         ( OrdList )
 import PrimOp          ( commutableOp, PrimOp(..) )
-import PrimRep         ( PrimRep{-instance Eq-} )
 import RegAllocInfo    ( mkMRegsState, MRegsState )
-import Stix            ( StixTree(..), StixReg(..), CodeSegment )
-import UniqSupply      ( returnUs, thenUs, mapUs, UniqSM, UniqSupply )
+import Stix            ( StixTree(..), StixReg(..) )
+import UniqSupply      ( returnUs, thenUs, mapUs, initUs, UniqSM, UniqSupply )
 import Outputable      
 \end{code}
 
@@ -75,10 +74,11 @@ So, here we go:
 \begin{code}
 writeRealAsm :: Handle -> AbstractC -> UniqSupply -> IO ()
 writeRealAsm handle absC us
-  = _scc_ "writeRealAsm" (printForAsm handle (runNCG absC us))
+  = -- _scc_ "writeRealAsm" 
+    printForAsm handle (initUs us (runNCG absC))
 
 dumpRealAsm :: AbstractC -> UniqSupply -> SDoc
-dumpRealAsm = runNCG
+dumpRealAsm absC us = initUs us (runNCG absC)
 
 runNCG absC
   = genCodeAbstractC absC      `thenUs` \ treelists ->
@@ -156,8 +156,8 @@ genericOpt (StJump addr) = StJump (genericOpt addr)
 genericOpt (StCondJump addr test)
   = StCondJump addr (genericOpt test)
 
-genericOpt (StCall fn pk args)
-  = StCall fn pk (map genericOpt args)
+genericOpt (StCall fn cconv pk args)
+  = StCall fn cconv pk (map genericOpt args)
 \end{code}
 
 Fold indices together when the types match:
@@ -249,7 +249,6 @@ primOpt op args@[x, y@(StInt 0)]
        OrOp     -> x
        XorOp    -> x
        SllOp    -> x
-       SraOp    -> x
        SrlOp    -> x
        ISllOp   -> x
        ISraOp   -> x
@@ -271,10 +270,10 @@ primOpt op args@[x, y@(StInt n)]
   = case op of
        IntMulOp -> case exactLog2 n of
            Nothing -> StPrim op args
-           Just p  -> StPrim SllOp [x, StInt p]
+           Just p  -> StPrim ISllOp [x, StInt p]
        IntQuotOp -> case exactLog2 n of
            Nothing -> StPrim op args
-           Just p  -> StPrim SraOp [x, StInt p]
+           Just p  -> StPrim ISrlOp [x, StInt p]
        _ -> StPrim op args
 \end{code}