----------------------------------------------------------------------------- -- -- Sequel type for Stg to C-- code generation -- -- (c) The University of Glasgow 2004-2006 -- -- This module is just a bucket of types used in StgToCmm.Monad and -- StgToCmm.Closure. Its sole purpose is to break a cyclic dependency between -- StgToCmm.Monad and StgToCmm.Closure which derives from coupling around -- the BlockId and LocalReg types ----------------------------------------------------------------------------- module GHC.StgToCmm.Sequel ( Sequel(..) , SelfLoopInfo ) where import GHC.Cmm.BlockId import GHC.Cmm import GHC.Types.Id import GHC.Utils.Outputable import GHC.Prelude -------------------------------------------------------------------------------- -- | A Sequel tells what to do with the result of this expression data Sequel = Return -- ^ Return result(s) to continuation found on the stack. | AssignTo [LocalReg] -- ^ Put result(s) in these regs and fall through -- NB: no void arguments here -- Bool -- ^ Should we adjust the heap pointer back to recover -- space that's unused on this path? We need to do this -- only if the expression may allocate (e.g. it's a -- foreign call or allocating primOp) instance Outputable Sequel where ppr :: Sequel -> SDoc ppr Sequel Return = String -> SDoc forall doc. IsLine doc => String -> doc text String "Return" ppr (AssignTo [LocalReg] regs Bool b) = String -> SDoc forall doc. IsLine doc => String -> doc text String "AssignTo" SDoc -> SDoc -> SDoc forall doc. IsLine doc => doc -> doc -> doc <+> [LocalReg] -> SDoc forall a. Outputable a => a -> SDoc ppr [LocalReg] regs SDoc -> SDoc -> SDoc forall doc. IsLine doc => doc -> doc -> doc <+> Bool -> SDoc forall a. Outputable a => a -> SDoc ppr Bool b type SelfLoopInfo = (Id, BlockId, [LocalReg]) --------------------------------------------------------------------------------