Commit 6e2d9ee2 authored by Sylvain Henry's avatar Sylvain Henry Committed by Marge Bot

Module hierarchy: Cmm (cf #13009)

parent c3fde723
...@@ -999,7 +999,7 @@ else ...@@ -999,7 +999,7 @@ else
fi; fi;
changequote([, ])dnl changequote([, ])dnl
]) ])
if test ! -f compiler/parser/Parser.hs || test ! -f compiler/cmm/CmmParse.hs if test ! -f compiler/parser/Parser.hs || test ! -f compiler/GHC/Cmm/Parser.hs
then then
FP_COMPARE_VERSIONS([$fptools_cv_happy_version],[-lt],[1.19.10], FP_COMPARE_VERSIONS([$fptools_cv_happy_version],[-lt],[1.19.10],
[AC_MSG_ERROR([Happy version 1.19.10 or later is required to compile GHC.])])[] [AC_MSG_ERROR([Happy version 1.19.10 or later is required to compile GHC.])])[]
......
-- Cmm representations using Hoopl's Graph CmmNode e x. -- Cmm representations using Hoopl's Graph CmmNode e x.
{-# LANGUAGE GADTs #-} {-# LANGUAGE GADTs #-}
module Cmm ( module GHC.Cmm (
-- * Cmm top-level datatypes -- * Cmm top-level datatypes
CmmProgram, CmmGroup, GenCmmGroup, CmmProgram, CmmGroup, GenCmmGroup,
CmmDecl, GenCmmDecl(..), CmmDecl, GenCmmDecl(..),
...@@ -21,23 +21,23 @@ module Cmm ( ...@@ -21,23 +21,23 @@ module Cmm (
ProfilingInfo(..), ConstrDescription, ProfilingInfo(..), ConstrDescription,
-- * Statements, expressions and types -- * Statements, expressions and types
module CmmNode, module GHC.Cmm.Node,
module CmmExpr, module GHC.Cmm.Expr,
) where ) where
import GhcPrelude import GhcPrelude
import Id import Id
import CostCentre import CostCentre
import CLabel import GHC.Cmm.CLabel
import BlockId import GHC.Cmm.BlockId
import CmmNode import GHC.Cmm.Node
import SMRep import GHC.Runtime.Layout
import CmmExpr import GHC.Cmm.Expr
import Hoopl.Block import GHC.Cmm.Dataflow.Block
import Hoopl.Collections import GHC.Cmm.Dataflow.Collections
import Hoopl.Graph import GHC.Cmm.Dataflow.Graph
import Hoopl.Label import GHC.Cmm.Dataflow.Label
import Outputable import Outputable
import Data.ByteString (ByteString) import Data.ByteString (ByteString)
...@@ -126,7 +126,7 @@ data CmmStackInfo ...@@ -126,7 +126,7 @@ data CmmStackInfo
-- used by the stack allocator later. -- used by the stack allocator later.
updfr_space :: Maybe ByteOff, updfr_space :: Maybe ByteOff,
-- XXX: this never contains anything useful, but it should. -- XXX: this never contains anything useful, but it should.
-- See comment in CmmLayoutStack. -- See comment in GHC.Cmm.LayoutStack.
do_layout :: Bool do_layout :: Bool
-- Do automatic stack layout for this proc. This is -- Do automatic stack layout for this proc. This is
-- True for all code generated by the code generator, -- True for all code generated by the code generator,
...@@ -149,13 +149,13 @@ data CmmInfoTable ...@@ -149,13 +149,13 @@ data CmmInfoTable
-- the code generator, because we might want to add SRT -- the code generator, because we might want to add SRT
-- entries to them later (for FUNs at least; THUNKs are -- entries to them later (for FUNs at least; THUNKs are
-- treated the same for consistency). See Note [SRTs] in -- treated the same for consistency). See Note [SRTs] in
-- CmmBuildInfoTables, in particular the [FUN] optimisation. -- GHC.Cmm.Info.Build, in particular the [FUN] optimisation.
-- --
-- This is strictly speaking not a part of the info table that -- This is strictly speaking not a part of the info table that
-- will be finally generated, but it's the only convenient -- will be finally generated, but it's the only convenient
-- place to convey this information from the code generator to -- place to convey this information from the code generator to
-- where we build the static closures in -- where we build the static closures in
-- CmmBuildInfoTables.doSRTs. -- GHC.Cmm.Info.Build.doSRTs.
} }
data ProfilingInfo data ProfilingInfo
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
{-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_GHC -fno-warn-orphans #-}
{- BlockId module should probably go away completely, being superseded by Label -} {- BlockId module should probably go away completely, being superseded by Label -}
module BlockId module GHC.Cmm.BlockId
( BlockId, mkBlockId -- ToDo: BlockId should be abstract, but it isn't yet ( BlockId, mkBlockId -- ToDo: BlockId should be abstract, but it isn't yet
, newBlockId , newBlockId
, blockLbl, infoTblLbl , blockLbl, infoTblLbl
...@@ -10,13 +10,13 @@ module BlockId ...@@ -10,13 +10,13 @@ module BlockId
import GhcPrelude import GhcPrelude
import CLabel import GHC.Cmm.CLabel
import IdInfo import IdInfo
import Name import Name
import Unique import Unique
import UniqSupply import UniqSupply
import Hoopl.Label (Label, mkHooplLabel) import GHC.Cmm.Dataflow.Label (Label, mkHooplLabel)
---------------------------------------------------------------- ----------------------------------------------------------------
--- Block Ids, their environments, and their sets --- Block Ids, their environments, and their sets
......
module BlockId (BlockId, mkBlockId) where module GHC.Cmm.BlockId (BlockId, mkBlockId) where
import Hoopl.Label (Label) import GHC.Cmm.Dataflow.Label (Label)
import Unique (Unique) import Unique (Unique)
type BlockId = Label type BlockId = Label
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
{-# LANGUAGE CPP #-} {-# LANGUAGE CPP #-}
module CLabel ( module GHC.Cmm.CLabel (
CLabel, -- abstract type CLabel, -- abstract type
ForeignLabelSource(..), ForeignLabelSource(..),
pprDebugCLabel, pprDebugCLabel,
...@@ -115,7 +115,7 @@ import GhcPrelude ...@@ -115,7 +115,7 @@ import GhcPrelude
import IdInfo import IdInfo
import BasicTypes import BasicTypes
import {-# SOURCE #-} BlockId (BlockId, mkBlockId) import {-# SOURCE #-} GHC.Cmm.BlockId (BlockId, mkBlockId)
import Packages import Packages
import Module import Module
import Name import Name
...@@ -746,7 +746,7 @@ hasCAF _ = False ...@@ -746,7 +746,7 @@ hasCAF _ = False
-- Until 14 Feb 2013, every ticky counter was associated with a -- Until 14 Feb 2013, every ticky counter was associated with a
-- closure. Thus, ticky labels used IdLabel. It is odd that -- closure. Thus, ticky labels used IdLabel. It is odd that
-- CmmBuildInfoTables.cafTransfers would consider such a ticky label -- GHC.Cmm.Info.Build.cafTransfers would consider such a ticky label
-- reason to add the name to the CAFEnv (and thus eventually the SRT), -- reason to add the name to the CAFEnv (and thus eventually the SRT),
-- but it was harmless because the ticky was only used if the closure -- but it was harmless because the ticky was only used if the closure
-- was also. -- was also.
......
module CmmCallConv ( module GHC.Cmm.CallConv (
ParamLocation(..), ParamLocation(..),
assignArgumentsPos, assignArgumentsPos,
assignStack, assignStack,
...@@ -7,10 +7,10 @@ module CmmCallConv ( ...@@ -7,10 +7,10 @@ module CmmCallConv (
import GhcPrelude import GhcPrelude
import CmmExpr import GHC.Cmm.Expr
import SMRep import GHC.Runtime.Layout
import Cmm (Convention(..)) import GHC.Cmm (Convention(..))
import PprCmm () -- For Outputable instances import GHC.Cmm.Ppr () -- For Outputable instances
import DynFlags import DynFlags
import GHC.Platform import GHC.Platform
......
{-# LANGUAGE GADTs, BangPatterns, ScopedTypeVariables #-} {-# LANGUAGE GADTs, BangPatterns, ScopedTypeVariables #-}
module CmmCommonBlockElim module GHC.Cmm.CommonBlockElim
( elimCommonBlocks ( elimCommonBlocks
) )
where where
...@@ -8,16 +8,16 @@ where ...@@ -8,16 +8,16 @@ where
import GhcPrelude hiding (iterate, succ, unzip, zip) import GhcPrelude hiding (iterate, succ, unzip, zip)
import BlockId import GHC.Cmm.BlockId
import Cmm import GHC.Cmm
import CmmUtils import GHC.Cmm.Utils
import CmmSwitch (eqSwitchTargetWith) import GHC.Cmm.Switch (eqSwitchTargetWith)
import CmmContFlowOpt import GHC.Cmm.ContFlowOpt
import Hoopl.Block import GHC.Cmm.Dataflow.Block
import Hoopl.Graph import GHC.Cmm.Dataflow.Graph
import Hoopl.Label import GHC.Cmm.Dataflow.Label
import Hoopl.Collections import GHC.Cmm.Dataflow.Collections
import Data.Bits import Data.Bits
import Data.Maybe (mapMaybe) import Data.Maybe (mapMaybe)
import qualified Data.List as List import qualified Data.List as List
......
{-# LANGUAGE GADTs #-} {-# LANGUAGE GADTs #-}
{-# LANGUAGE BangPatterns #-} {-# LANGUAGE BangPatterns #-}
{-# OPTIONS_GHC -fno-warn-incomplete-patterns #-} {-# OPTIONS_GHC -fno-warn-incomplete-patterns #-}
module CmmContFlowOpt module GHC.Cmm.ContFlowOpt
( cmmCfgOpts ( cmmCfgOpts
, cmmCfgOptsProc , cmmCfgOptsProc
, removeUnreachableBlocksProc , removeUnreachableBlocksProc
...@@ -11,14 +11,14 @@ where ...@@ -11,14 +11,14 @@ where
import GhcPrelude hiding (succ, unzip, zip) import GhcPrelude hiding (succ, unzip, zip)
import Hoopl.Block import GHC.Cmm.Dataflow.Block
import Hoopl.Collections import GHC.Cmm.Dataflow.Collections
import Hoopl.Graph import GHC.Cmm.Dataflow.Graph
import Hoopl.Label import GHC.Cmm.Dataflow.Label
import BlockId import GHC.Cmm.BlockId
import Cmm import GHC.Cmm
import CmmUtils import GHC.Cmm.Utils
import CmmSwitch (mapSwitchTargets, switchTargetsToList) import GHC.Cmm.Switch (mapSwitchTargets, switchTargetsToList)
import Maybes import Maybes
import Panic import Panic
import Util import Util
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
-- specialised to the UniqSM monad. -- specialised to the UniqSM monad.
-- --
module Hoopl.Dataflow module GHC.Cmm.Dataflow
( C, O, Block ( C, O, Block
, lastNode, entryLabel , lastNode, entryLabel
, foldNodesBwdOO , foldNodesBwdOO
...@@ -36,7 +36,7 @@ where ...@@ -36,7 +36,7 @@ where
import GhcPrelude import GhcPrelude
import Cmm import GHC.Cmm
import UniqSupply import UniqSupply
import Data.Array import Data.Array
...@@ -44,10 +44,10 @@ import Data.Maybe ...@@ -44,10 +44,10 @@ import Data.Maybe
import Data.IntSet (IntSet) import Data.IntSet (IntSet)
import qualified Data.IntSet as IntSet import qualified Data.IntSet as IntSet
import Hoopl.Block import GHC.Cmm.Dataflow.Block
import Hoopl.Graph import GHC.Cmm.Dataflow.Graph
import Hoopl.Collections import GHC.Cmm.Dataflow.Collections
import Hoopl.Label import GHC.Cmm.Dataflow.Label
type family Fact (x :: Extensibility) f :: * type family Fact (x :: Extensibility) f :: *
type instance Fact C f = FactBase f type instance Fact C f = FactBase f
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
module Hoopl.Block module GHC.Cmm.Dataflow.Block
( Extensibility (..) ( Extensibility (..)
, O , O
, C , C
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Hoopl.Collections module GHC.Cmm.Dataflow.Collections
( IsSet(..) ( IsSet(..)
, setInsertList, setDeleteList, setUnions , setInsertList, setDeleteList, setUnions
, IsMap(..) , IsMap(..)
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
{-# LANGUAGE RankNTypes #-} {-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
module Hoopl.Graph module GHC.Cmm.Dataflow.Graph
( Body ( Body
, Graph , Graph
, Graph'(..) , Graph'(..)
...@@ -23,9 +23,9 @@ module Hoopl.Graph ...@@ -23,9 +23,9 @@ module Hoopl.Graph
import GhcPrelude import GhcPrelude
import Util import Util
import Hoopl.Label import GHC.Cmm.Dataflow.Label
import Hoopl.Block import GHC.Cmm.Dataflow.Block
import Hoopl.Collections import GHC.Cmm.Dataflow.Collections
-- | A (possibly empty) collection of closed/closed blocks -- | A (possibly empty) collection of closed/closed blocks
type Body n = LabelMap (Block n C C) type Body n = LabelMap (Block n C C)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Hoopl.Label module GHC.Cmm.Dataflow.Label
( Label ( Label
, LabelMap , LabelMap
, LabelSet , LabelSet
...@@ -18,7 +18,7 @@ import GhcPrelude ...@@ -18,7 +18,7 @@ import GhcPrelude
import Outputable import Outputable
-- TODO: This should really just use GHC's Unique and Uniq{Set,FM} -- TODO: This should really just use GHC's Unique and Uniq{Set,FM}
import Hoopl.Collections import GHC.Cmm.Dataflow.Collections
import Unique (Uniquable(..)) import Unique (Uniquable(..))
import TrieMap import TrieMap
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
-- --
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
module Debug ( module GHC.Cmm.DebugBlock (
DebugBlock(..), DebugBlock(..),
cmmDebugGen, cmmDebugGen,
...@@ -25,22 +25,22 @@ module Debug ( ...@@ -25,22 +25,22 @@ module Debug (
import GhcPrelude import GhcPrelude
import BlockId import GHC.Cmm.BlockId
import CLabel import GHC.Cmm.CLabel
import Cmm import GHC.Cmm
import CmmUtils import GHC.Cmm.Utils
import CoreSyn import CoreSyn
import FastString ( nilFS, mkFastString ) import FastString ( nilFS, mkFastString )
import Module import Module
import Outputable import Outputable
import PprCmmExpr ( pprExpr ) import GHC.Cmm.Ppr.Expr ( pprExpr )
import SrcLoc import SrcLoc
import Util ( seqList ) import Util ( seqList )
import Hoopl.Block import GHC.Cmm.Dataflow.Block
import Hoopl.Collections import GHC.Cmm.Dataflow.Collections
import Hoopl.Graph import GHC.Cmm.Dataflow.Graph
import Hoopl.Label import GHC.Cmm.Dataflow.Label
import Data.Maybe import Data.Maybe
import Data.List ( minimumBy, nubBy ) import Data.List ( minimumBy, nubBy )
...@@ -316,7 +316,7 @@ with a typical C-- procedure as would come from the STG-to-Cmm code generator, ...@@ -316,7 +316,7 @@ with a typical C-- procedure as would come from the STG-to-Cmm code generator,
}, },
Let's consider how this procedure will be decorated with unwind information Let's consider how this procedure will be decorated with unwind information
(largely by CmmLayoutStack). Naturally, when we enter the procedure `entry` the (largely by GHC.Cmm.LayoutStack). Naturally, when we enter the procedure `entry` the
value of Sp is no different from what it was at its call site. Therefore we will value of Sp is no different from what it was at its call site. Therefore we will
add an `unwind` statement saying this at the beginning of its unwind-annotated add an `unwind` statement saying this at the beginning of its unwind-annotated
code, code,
...@@ -369,7 +369,7 @@ The flow of unwinding information through the compiler is a bit convoluted: ...@@ -369,7 +369,7 @@ The flow of unwinding information through the compiler is a bit convoluted:
haven't actually done any register assignment or stack layout yet, so there haven't actually done any register assignment or stack layout yet, so there
is no need for unwind information. is no need for unwind information.
* CmmLayoutStack figures out how to layout each procedure's stack, and produces * GHC.Cmm.LayoutStack figures out how to layout each procedure's stack, and produces
appropriate unwinding nodes for each adjustment of the STG Sp register. appropriate unwinding nodes for each adjustment of the STG Sp register.
* The unwind nodes are carried through the sinking pass. Currently this is * The unwind nodes are carried through the sinking pass. Currently this is
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE UndecidableInstances #-}
module CmmExpr module GHC.Cmm.Expr
( CmmExpr(..), cmmExprType, cmmExprWidth, cmmExprAlignment, maybeInvertCmmExpr ( CmmExpr(..), cmmExprType, cmmExprWidth, cmmExprAlignment, maybeInvertCmmExpr
, CmmReg(..), cmmRegType, cmmRegWidth , CmmReg(..), cmmRegType, cmmRegWidth
, CmmLit(..), cmmLitType , CmmLit(..), cmmLitType
...@@ -25,17 +25,17 @@ module CmmExpr ...@@ -25,17 +25,17 @@ module CmmExpr
, regSetToList , regSetToList
, Area(..) , Area(..)
, module CmmMachOp , module GHC.Cmm.MachOp
, module CmmType , module GHC.Cmm.Type
) )
where where
import GhcPrelude import GhcPrelude
import BlockId import GHC.Cmm.BlockId
import CLabel import GHC.Cmm.CLabel
import CmmMachOp import GHC.Cmm.MachOp
import CmmType import GHC.Cmm.Type
import DynFlags import DynFlags
import Outputable (panic) import Outputable (panic)
import Unique import Unique
...@@ -83,7 +83,7 @@ data CmmReg ...@@ -83,7 +83,7 @@ data CmmReg
data Area data Area
= Old -- See Note [Old Area] = Old -- See Note [Old Area]
| Young {-# UNPACK #-} !BlockId -- Invariant: must be a continuation BlockId | Young {-# UNPACK #-} !BlockId -- Invariant: must be a continuation BlockId
-- See Note [Continuation BlockId] in CmmNode. -- See Note [Continuation BlockId] in GHC.Cmm.Node.
deriving (Eq, Ord) deriving (Eq, Ord)
{- Note [Old Area] {- Note [Old Area]
...@@ -200,7 +200,7 @@ data CmmLit ...@@ -200,7 +200,7 @@ data CmmLit
| CmmBlock {-# UNPACK #-} !BlockId -- Code label | CmmBlock {-# UNPACK #-} !BlockId -- Code label
-- Invariant: must be a continuation BlockId -- Invariant: must be a continuation BlockId
-- See Note [Continuation BlockId] in CmmNode. -- See Note [Continuation BlockId] in GHC.Cmm.Node.
| CmmHighStackMark -- A late-bound constant that stands for the max | CmmHighStackMark -- A late-bound constant that stands for the max
-- #bytes of stack space used during a procedure. -- #bytes of stack space used during a procedure.
...@@ -408,7 +408,7 @@ There are no specific rules about which registers might overlap with ...@@ -408,7 +408,7 @@ There are no specific rules about which registers might overlap with
which other registers, but presumably it's safe to assume that nothing which other registers, but presumably it's safe to assume that nothing
will overlap with special registers like Sp or BaseReg. will overlap with special registers like Sp or BaseReg.
Use CmmUtils.regsOverlap to determine whether two GlobalRegs overlap Use GHC.Cmm.Utils.regsOverlap to determine whether two GlobalRegs overlap
on a particular platform. The instance Eq GlobalReg is syntactic on a particular platform. The instance Eq GlobalReg is syntactic
equality of STG registers and does not take overlap into equality of STG registers and does not take overlap into
account. However it is still used in UserOfRegs/DefinerOfRegs and account. However it is still used in UserOfRegs/DefinerOfRegs and
......
{-# LANGUAGE BangPatterns, GADTs #-} {-# LANGUAGE BangPatterns, GADTs #-}
module MkGraph module GHC.Cmm.Graph
( CmmAGraph, CmmAGraphScoped, CgStmt(..) ( CmmAGraph, CmmAGraphScoped, CgStmt(..)
, (<*>), catAGraphs , (<*>), catAGraphs
, mkLabel, mkMiddle, mkLast, outOfLine , mkLabel, mkMiddle, mkLast, outOfLine
...@@ -23,19 +23,19 @@ where ...@@ -23,19 +23,19 @@ where
import GhcPrelude hiding ( (<*>) ) -- avoid importing (<*>) import GhcPrelude hiding ( (<*>) ) -- avoid importing (<*>)
import BlockId import GHC.Cmm.BlockId
import Cmm import GHC.Cmm
import CmmCallConv import GHC.Cmm.CallConv
import CmmSwitch (SwitchTargets) import GHC.Cmm.Switch (SwitchTargets)
import Hoopl.Block import GHC.Cmm.Dataflow.Block
import Hoopl.Graph import GHC.Cmm.Dataflow.Graph
import Hoopl.Label import GHC.Cmm.Dataflow.Label
import DynFlags import DynFlags
import FastString import FastString
import ForeignCall import ForeignCall
import OrdList import OrdList
import SMRep (ByteOff) import GHC.Runtime.Layout (ByteOff)
import UniqSupply import UniqSupply
import Util import Util
import Panic import Panic
......
{-# LANGUAGE CPP #-} {-# LANGUAGE CPP #-}
module CmmInfo ( module GHC.Cmm.Info (
mkEmptyContInfoTable, mkEmptyContInfoTable,
cmmToRawCmm, cmmToRawCmm,
mkInfoTable, mkInfoTable,
...@@ -36,14 +36,14 @@ module CmmInfo ( ...@@ -36,14 +36,14 @@ module CmmInfo (
import GhcPrelude import GhcPrelude
import Cmm import GHC.Cmm
import CmmUtils import GHC.Cmm.Utils
import CLabel import GHC.Cmm.CLabel
import SMRep import GHC.Runtime.Layout
import Bitmap import GHC.Data.Bitmap
import Stream (Stream) import Stream (Stream)
import qualified Stream