[project @ 1998-02-05 12:23:33 by simonm]
[ghc-hetmet.git] / ghc / compiler / nativeGen / AsmCodeGen.lhs
index d592676..1edfe9a 100644 (file)
@@ -3,12 +3,11 @@
 %
 
 \begin{code}
-#include "HsVersions.h"
-
 module AsmCodeGen ( writeRealAsm, dumpRealAsm ) where
 
-IMP_Ubiq(){-uitous-}
-IMPORT_1_3(IO(Handle))
+#include "HsVersions.h"
+
+import IO              ( Handle )
 
 import MachMisc
 import MachRegs
@@ -23,9 +22,8 @@ import PrimOp         ( commutableOp, PrimOp(..) )
 import PrimRep         ( PrimRep{-instance Eq-} )
 import RegAllocInfo    ( mkMRegsState, MRegsState )
 import Stix            ( StixTree(..), StixReg(..), CodeSegment )
-import UniqSupply      ( returnUs, thenUs, mapUs, SYN_IE(UniqSM), UniqSupply )
-import Outputable      ( printDoc )
-import Pretty          ( Doc, vcat, Mode(..) )
+import UniqSupply      ( returnUs, thenUs, mapUs, UniqSM, UniqSupply )
+import Outputable      
 \end{code}
 
 The 96/03 native-code generator has machine-independent and
@@ -77,9 +75,9 @@ So, here we go:
 \begin{code}
 writeRealAsm :: Handle -> AbstractC -> UniqSupply -> IO ()
 writeRealAsm handle absC us
-  = _scc_ "writeRealAsm" (printDoc LeftMode handle (runNCG absC us))
+  = _scc_ "writeRealAsm" (printForAsm handle (runNCG absC us))
 
-dumpRealAsm :: AbstractC -> UniqSupply -> Doc
+dumpRealAsm :: AbstractC -> UniqSupply -> SDoc
 dumpRealAsm = runNCG
 
 runNCG absC
@@ -92,7 +90,7 @@ runNCG absC
 
 @codeGen@ is the top-level code-generation function:
 \begin{code}
-codeGen :: [[StixTree]] -> UniqSM Doc
+codeGen :: [[StixTree]] -> UniqSM SDoc
 
 codeGen trees
   = mapUs genMachCode trees    `thenUs` \ dynamic_codes ->
@@ -226,6 +224,7 @@ primOpt op args@[StInt x, StInt y]
        IntNeOp -> StInt (if x /= y then 1 else 0)
        IntLtOp -> StInt (if x < y  then 1 else 0)
        IntLeOp -> StInt (if x <= y then 1 else 0)
+       -- ToDo: WordQuotOp, WordRemOp.
        _ -> StPrim op args
 \end{code}
 
@@ -248,6 +247,7 @@ primOpt op args@[x, y@(StInt 0)]
        IntMulOp -> y
        AndOp    -> y
        OrOp     -> x
+       XorOp    -> x
        SllOp    -> x
        SraOp    -> x
        SrlOp    -> x