X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fcmm%2FCmm.hs;h=0d1876e0e61068db72f6c8c766dc48b1d08c4a72;hb=d5e821c43df34fa228727e7f4e9453d0fde39fb6;hp=a6c3ec4b83000a6b24bad6ad547fbe1dc01b8aa6;hpb=090bff7e86dbad7c429532994f3f2fe9d4d8b8ea;p=ghc-hetmet.git diff --git a/compiler/cmm/Cmm.hs b/compiler/cmm/Cmm.hs index a6c3ec4..0d1876e 100644 --- a/compiler/cmm/Cmm.hs +++ b/compiler/cmm/Cmm.hs @@ -10,17 +10,17 @@ module Cmm ( GenCmm(..), Cmm, GenCmmTop(..), CmmTop, GenBasicBlock(..), CmmBasicBlock, blockId, blockStmts, - CmmStmt(..), + CmmStmt(..), CmmActuals, CmmFormals, CmmCallTarget(..), CmmStatic(..), Section(..), CmmExpr(..), cmmExprRep, CmmReg(..), cmmRegRep, CmmLit(..), cmmLitRep, LocalReg(..), localRegRep, - BlockId(..), + BlockId(..), BlockEnv, GlobalReg(..), globalRegRep, - node, nodeReg, spReg, hpReg, + node, nodeReg, spReg, hpReg, spLimReg ) where #include "HsVersions.h" @@ -29,6 +29,7 @@ import MachOp import CLabel import ForeignCall import Unique +import UniqFM import FastString import Data.Word @@ -113,8 +114,8 @@ data CmmStmt | CmmCall -- A foreign call, with CmmCallTarget - [(CmmReg,MachHint)] -- zero or more results - [(CmmExpr,MachHint)] -- zero or more arguments + CmmFormals -- zero or more results + CmmActuals -- zero or more arguments (Maybe [GlobalReg]) -- Global regs that may need to be saved -- if they will be clobbered by the call. -- Nothing <=> save *all* globals that @@ -130,8 +131,14 @@ data CmmStmt -- one -> second block etc -- Undefined outside range, and when there's a Nothing - | CmmJump CmmExpr [LocalReg] -- Jump to another function, with these - -- parameters. + | CmmJump CmmExpr -- Jump to another function, + CmmActuals -- with these parameters. + + | CmmReturn -- Return from a function, + CmmActuals -- with these return values. + +type CmmActuals = [(CmmExpr,MachHint)] +type CmmFormals = [(CmmReg,MachHint)] {- Discussion @@ -269,6 +276,8 @@ newtype BlockId = BlockId Unique instance Uniquable BlockId where getUnique (BlockId u) = u +type BlockEnv a = UniqFM {- BlockId -} a + ----------------------------------------------------------------------------- -- Static Data ----------------------------------------------------------------------------- @@ -345,9 +354,10 @@ data GlobalReg ) -- convenient aliases -spReg, hpReg, nodeReg :: CmmReg +spReg, hpReg, spLimReg, nodeReg :: CmmReg spReg = CmmGlobal Sp hpReg = CmmGlobal Hp +spLimReg = CmmGlobal SpLim nodeReg = CmmGlobal node node :: GlobalReg