[project @ 1998-08-14 12:00:22 by sof]
[ghc-hetmet.git] / ghc / compiler / nativeGen / AbsCStixGen.lhs
index 9086343..7ad77c8 100644 (file)
@@ -3,22 +3,21 @@
 %
 
 \begin{code}
-#include "HsVersions.h"
-
 module AbsCStixGen ( genCodeAbstractC ) where
 
-import Ubiq{-uitous-}
+#include "HsVersions.h"
+
+import Ratio   ( Rational )
 
 import AbsCSyn
 import Stix
-
 import MachMisc
-import MachRegs
 
 import AbsCUtils       ( getAmodeRep, mixedTypeLocn,
                          nonemptyAbsC, mkAbsCStmts, mkAbsCStmtList
                        )
-import CgCompInfo      ( mIN_UPD_SIZE )
+import Constants       ( mIN_UPD_SIZE )
+import CLabel           ( CLabel )
 import ClosureInfo     ( infoTableLabelFromCI, entryLabelFromCI,
                          fastLabelFromCI, closureUpdReqd
                        )
@@ -31,8 +30,12 @@ import PrimRep               ( isFloatingRep, PrimRep(..) )
 import StixInfo                ( genCodeInfoTable )
 import StixMacro       ( macroCode )
 import StixPrim                ( primCode, amodeToStix, amodeToStix' )
-import UniqSupply      ( returnUs, thenUs, mapUs, getUnique, UniqSM(..) )
+import UniqSupply      ( returnUs, thenUs, mapUs, getUnique, UniqSM )
 import Util            ( naturalMergeSortLe, panic )
+
+#ifdef REALLY_HASKELL_1_3
+ord = fromEnum :: Char -> Int
+#endif
 \end{code}
 
 For each independent chunk of AbstractC code, we generate a list of
@@ -364,7 +367,7 @@ comparison tree.  (Perhaps this could be tuned.)
 \begin{code}
 
  intTag :: Literal -> Integer
- intTag (MachChar c) = toInteger (ord c)
+ intTag (MachChar c)  = fromInt (ord c)
  intTag (MachInt i _) = i
  intTag _ = panic "intTag"
 
@@ -439,12 +442,12 @@ already finish with a jump to the join point.
  mkJumpTable am alts lowTag highTag dflt
   = getUniqLabelNCG                                    `thenUs` \ utlbl ->
     mapUs genLabel alts                                `thenUs` \ branches ->
-    let        cjmpLo = StCondJump dflt (StPrim IntLtOp [am, StInt lowTag])
-       cjmpHi = StCondJump dflt (StPrim IntGtOp [am, StInt highTag])
+    let        cjmpLo = StCondJump dflt (StPrim IntLtOp [am, StInt (toInteger lowTag)])
+       cjmpHi = StCondJump dflt (StPrim IntGtOp [am, StInt (toInteger highTag)])
 
        offset = StPrim IntSubOp [am, StInt lowTag]
-       jump = StJump (StInd PtrRep (StIndex PtrRep (StCLbl utlbl) offset))
 
+       jump = StJump (StInd PtrRep (StIndex PtrRep (StCLbl utlbl) offset))
        tlbl = StLabel utlbl
        table = StData PtrRep (mkTable branches [lowTag..highTag] [])
     in