X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FnativeGen%2FNCGMonad.hs;h=98bffb6cb4c6d52732d706e9c5c31eba0be2585a;hb=abaa832f4b580fabaee9c887bb01da379c7e6482;hp=721b6186e309da585502f6f111281b51ace4c63b;hpb=17b297d97d327620ed6bfab942f8992b2446f1bf;p=ghc-hetmet.git diff --git a/compiler/nativeGen/NCGMonad.hs b/compiler/nativeGen/NCGMonad.hs index 721b618..98bffb6 100644 --- a/compiler/nativeGen/NCGMonad.hs +++ b/compiler/nativeGen/NCGMonad.hs @@ -6,13 +6,6 @@ -- -- ----------------------------------------------------------------------------- -{-# OPTIONS_GHC -w #-} --- The above warning supression flag is a temporary kludge. --- While working on this module you are encouraged to remove it and fix --- any warnings in the module. See --- http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions#Warnings --- for details - module NCGMonad ( NatM_State(..), mkNatM_State, @@ -25,10 +18,9 @@ module NCGMonad ( #include "HsVersions.h" -import Cmm ( BlockId(..) ) +import BlockId import CLabel ( CLabel, mkAsmTempLabel ) import MachRegs -import MachOp ( MachRep ) import UniqSupply import Unique ( Unique ) import DynFlags @@ -43,6 +35,7 @@ data NatM_State = NatM_State { newtype NatM result = NatM (NatM_State -> (result, NatM_State)) +unNat :: NatM a -> NatM_State -> (a, NatM_State) unNat (NatM a) = a mkNatM_State :: UniqSupply -> Int -> DynFlags -> NatM_State @@ -68,7 +61,7 @@ mapAccumLNat :: (acc -> x -> NatM (acc, y)) -> [x] -> NatM (acc, [y]) -mapAccumLNat f b [] +mapAccumLNat _ b [] = return (b, []) mapAccumLNat f b (x:xs) = do (b__2, x__2) <- f b x @@ -102,10 +95,10 @@ getBlockIdNat = do u <- getUniqueNat; return (BlockId u) getNewLabelNat :: NatM CLabel getNewLabelNat = do u <- getUniqueNat; return (mkAsmTempLabel u) -getNewRegNat :: MachRep -> NatM Reg +getNewRegNat :: Size -> NatM Reg getNewRegNat rep = do u <- getUniqueNat; return (mkVReg u rep) -getNewRegPairNat :: MachRep -> NatM (Reg,Reg) +getNewRegPairNat :: Size -> NatM (Reg,Reg) getNewRegPairNat rep = do u <- getUniqueNat let lo = mkVReg u rep; hi = getHiVRegFromLo lo @@ -114,7 +107,7 @@ getNewRegPairNat rep = do getPicBaseMaybeNat :: NatM (Maybe Reg) getPicBaseMaybeNat = NatM (\state -> (natm_pic state, state)) -getPicBaseNat :: MachRep -> NatM Reg +getPicBaseNat :: Size -> NatM Reg getPicBaseNat rep = do mbPicBase <- getPicBaseMaybeNat case mbPicBase of