X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fcmm%2FCmm.hs;h=2d13c45ba71d97114f26ac834ad36c97839c38b0;hp=fef00c76e58c98e736cbd1748450d22e4ad57f01;hb=25628e2771424cae1b3366322e8ce6f8a85440f9;hpb=cd437edc8792e5dbcfaa6a6b9948364e9d9d08f3 diff --git a/compiler/cmm/Cmm.hs b/compiler/cmm/Cmm.hs index fef00c7..2d13c45 100644 --- a/compiler/cmm/Cmm.hs +++ b/compiler/cmm/Cmm.hs @@ -18,11 +18,13 @@ module Cmm ( CmmReturnInfo(..), CmmStmt(..), CmmActual, CmmActuals, CmmFormal, CmmFormals, CmmKind, CmmFormalsWithoutKinds, CmmFormalWithoutKind, + CmmKinded(..), CmmSafety(..), CmmCallTarget(..), CmmStatic(..), Section(..), module CmmExpr, - BlockId(..), + + BlockId(..), mkBlockId, BlockEnv, emptyBlockEnv, lookupBlockEnv, extendBlockEnv, mkBlockEnv, BlockSet, emptyBlockSet, elemBlockSet, extendBlockSet, ) where @@ -40,10 +42,10 @@ import FastString import Data.Word -import ZipCfg ( BlockId(..) - , BlockEnv, emptyBlockEnv, lookupBlockEnv, extendBlockEnv, mkBlockEnv - , BlockSet, emptyBlockSet, elemBlockSet, extendBlockSet - ) +import StackSlot ( BlockId(..), mkBlockId + , BlockEnv, emptyBlockEnv, lookupBlockEnv, extendBlockEnv, mkBlockEnv + , BlockSet, emptyBlockSet, elemBlockSet, extendBlockSet + ) -- A [[BlockId]] is a local label. -- Local labels must be unique within an entire compilation unit, not @@ -239,8 +241,10 @@ data CmmStmt CmmActuals -- with these return values. type CmmKind = MachHint -type CmmActual = (CmmExpr, CmmKind) -type CmmFormal = (LocalReg,CmmKind) +data CmmKinded a = CmmKinded { kindlessCmm :: a, cmmKind :: CmmKind } + deriving (Eq) +type CmmActual = CmmKinded CmmExpr +type CmmFormal = CmmKinded LocalReg type CmmActuals = [CmmActual] type CmmFormals = [CmmFormal] type CmmFormalWithoutKind = LocalReg @@ -249,8 +253,8 @@ type CmmFormalsWithoutKinds = [CmmFormalWithoutKind] data CmmSafety = CmmUnsafe | CmmSafe C_SRT -- | enable us to fold used registers over 'CmmActuals' and 'CmmFormals' -instance UserOfLocalRegs a => UserOfLocalRegs (a, CmmKind) where - foldRegsUsed f set (a, _) = foldRegsUsed f set a +instance UserOfLocalRegs a => UserOfLocalRegs (CmmKinded a) where + foldRegsUsed f set (CmmKinded a _) = foldRegsUsed f set a instance UserOfLocalRegs CmmStmt where foldRegsUsed f set s = stmt s set @@ -270,6 +274,15 @@ instance UserOfLocalRegs CmmCallTarget where foldRegsUsed f set (CmmCallee e _) = foldRegsUsed f set e foldRegsUsed _ set (CmmPrim {}) = set +instance DefinerOfLocalRegs a => DefinerOfLocalRegs (CmmKinded a) where + foldRegsDefd f z (CmmKinded x _) = foldRegsDefd f z x + + +--just look like a tuple, since it was a tuple before +-- ... is that a good idea? --Isaac Dupree +instance (Outputable a) => Outputable (CmmKinded a) where + ppr (CmmKinded a k) = ppr (a, k) + {- Discussion ~~~~~~~~~~ @@ -325,6 +338,7 @@ data CmmCallTarget | CmmPrim -- Call a "primitive" (eg. sin, cos) CallishMachOp -- These might be implemented as inline -- code by the backend. + deriving Eq ----------------------------------------------------------------------------- -- Static Data