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
fi;
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
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.])])[]
......
-- Cmm representations using Hoopl's Graph CmmNode e x.
{-# LANGUAGE GADTs #-}
module Cmm (
module GHC.Cmm (
-- * Cmm top-level datatypes
CmmProgram, CmmGroup, GenCmmGroup,
CmmDecl, GenCmmDecl(..),
......@@ -21,23 +21,23 @@ module Cmm (
ProfilingInfo(..), ConstrDescription,
-- * Statements, expressions and types
module CmmNode,
module CmmExpr,
module GHC.Cmm.Node,
module GHC.Cmm.Expr,
) where
import GhcPrelude
import Id
import CostCentre
import CLabel
import BlockId
import CmmNode
import SMRep
import CmmExpr
import Hoopl.Block
import Hoopl.Collections
import Hoopl.Graph
import Hoopl.Label
import GHC.Cmm.CLabel
import GHC.Cmm.BlockId
import GHC.Cmm.Node
import GHC.Runtime.Layout
import GHC.Cmm.Expr
import GHC.Cmm.Dataflow.Block
import GHC.Cmm.Dataflow.Collections
import GHC.Cmm.Dataflow.Graph
import GHC.Cmm.Dataflow.Label
import Outputable
import Data.ByteString (ByteString)
......@@ -126,7 +126,7 @@ data CmmStackInfo
-- used by the stack allocator later.
updfr_space :: Maybe ByteOff,
-- XXX: this never contains anything useful, but it should.
-- See comment in CmmLayoutStack.
-- See comment in GHC.Cmm.LayoutStack.
do_layout :: Bool
-- Do automatic stack layout for this proc. This is
-- True for all code generated by the code generator,
......@@ -149,13 +149,13 @@ data CmmInfoTable
-- the code generator, because we might want to add SRT
-- entries to them later (for FUNs at least; THUNKs are
-- 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
-- will be finally generated, but it's the only convenient
-- place to convey this information from the code generator to
-- where we build the static closures in
-- CmmBuildInfoTables.doSRTs.
-- GHC.Cmm.Info.Build.doSRTs.
}
data ProfilingInfo
......
......@@ -2,7 +2,7 @@
{-# OPTIONS_GHC -fno-warn-orphans #-}
{- 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
, newBlockId
, blockLbl, infoTblLbl
......@@ -10,13 +10,13 @@ module BlockId
import GhcPrelude
import CLabel
import GHC.Cmm.CLabel
import IdInfo
import Name
import Unique
import UniqSupply
import Hoopl.Label (Label, mkHooplLabel)
import GHC.Cmm.Dataflow.Label (Label, mkHooplLabel)
----------------------------------------------------------------
--- 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)
type BlockId = Label
......
......@@ -8,7 +8,7 @@
{-# LANGUAGE CPP #-}
module CLabel (
module GHC.Cmm.CLabel (
CLabel, -- abstract type
ForeignLabelSource(..),
pprDebugCLabel,
......@@ -115,7 +115,7 @@ import GhcPrelude
import IdInfo
import BasicTypes
import {-# SOURCE #-} BlockId (BlockId, mkBlockId)
import {-# SOURCE #-} GHC.Cmm.BlockId (BlockId, mkBlockId)
import Packages
import Module
import Name
......@@ -746,7 +746,7 @@ hasCAF _ = False
-- Until 14 Feb 2013, every ticky counter was associated with a
-- 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),
-- but it was harmless because the ticky was only used if the closure
-- was also.
......
module CmmCallConv (
module GHC.Cmm.CallConv (
ParamLocation(..),
assignArgumentsPos,
assignStack,
......@@ -7,10 +7,10 @@ module CmmCallConv (
import GhcPrelude
import CmmExpr
import SMRep
import Cmm (Convention(..))
import PprCmm () -- For Outputable instances
import GHC.Cmm.Expr
import GHC.Runtime.Layout
import GHC.Cmm (Convention(..))
import GHC.Cmm.Ppr () -- For Outputable instances
import DynFlags
import GHC.Platform
......
{-# LANGUAGE GADTs, BangPatterns, ScopedTypeVariables #-}
module CmmCommonBlockElim
module GHC.Cmm.CommonBlockElim
( elimCommonBlocks
)
where
......@@ -8,16 +8,16 @@ where
import GhcPrelude hiding (iterate, succ, unzip, zip)
import BlockId
import Cmm
import CmmUtils
import CmmSwitch (eqSwitchTargetWith)
import CmmContFlowOpt
import GHC.Cmm.BlockId
import GHC.Cmm
import GHC.Cmm.Utils
import GHC.Cmm.Switch (eqSwitchTargetWith)
import GHC.Cmm.ContFlowOpt
import Hoopl.Block
import Hoopl.Graph
import Hoopl.Label
import Hoopl.Collections
import GHC.Cmm.Dataflow.Block
import GHC.Cmm.Dataflow.Graph
import GHC.Cmm.Dataflow.Label
import GHC.Cmm.Dataflow.Collections
import Data.Bits
import Data.Maybe (mapMaybe)
import qualified Data.List as List
......
{-# LANGUAGE GADTs #-}
{-# LANGUAGE BangPatterns #-}
{-# OPTIONS_GHC -fno-warn-incomplete-patterns #-}
module CmmContFlowOpt
module GHC.Cmm.ContFlowOpt
( cmmCfgOpts
, cmmCfgOptsProc
, removeUnreachableBlocksProc
......@@ -11,14 +11,14 @@ where
import GhcPrelude hiding (succ, unzip, zip)
import Hoopl.Block
import Hoopl.Collections
import Hoopl.Graph
import Hoopl.Label
import BlockId
import Cmm
import CmmUtils
import CmmSwitch (mapSwitchTargets, switchTargetsToList)
import GHC.Cmm.Dataflow.Block
import GHC.Cmm.Dataflow.Collections
import GHC.Cmm.Dataflow.Graph
import GHC.Cmm.Dataflow.Label
import GHC.Cmm.BlockId
import GHC.Cmm
import GHC.Cmm.Utils
import GHC.Cmm.Switch (mapSwitchTargets, switchTargetsToList)
import Maybes
import Panic
import Util
......
......@@ -17,7 +17,7 @@
-- specialised to the UniqSM monad.
--
module Hoopl.Dataflow
module GHC.Cmm.Dataflow
( C, O, Block
, lastNode, entryLabel
, foldNodesBwdOO
......@@ -36,7 +36,7 @@ where
import GhcPrelude
import Cmm
import GHC.Cmm
import UniqSupply
import Data.Array
......@@ -44,10 +44,10 @@ import Data.Maybe
import Data.IntSet (IntSet)
import qualified Data.IntSet as IntSet
import Hoopl.Block
import Hoopl.Graph
import Hoopl.Collections
import Hoopl.Label
import GHC.Cmm.Dataflow.Block
import GHC.Cmm.Dataflow.Graph
import GHC.Cmm.Dataflow.Collections
import GHC.Cmm.Dataflow.Label
type family Fact (x :: Extensibility) f :: *
type instance Fact C f = FactBase f
......
......@@ -6,7 +6,7 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
module Hoopl.Block
module GHC.Cmm.Dataflow.Block
( Extensibility (..)
, O
, C
......
......@@ -4,7 +4,7 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Hoopl.Collections
module GHC.Cmm.Dataflow.Collections
( IsSet(..)
, setInsertList, setDeleteList, setUnions
, IsMap(..)
......
......@@ -5,7 +5,7 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
module Hoopl.Graph
module GHC.Cmm.Dataflow.Graph
( Body
, Graph
, Graph'(..)
......@@ -23,9 +23,9 @@ module Hoopl.Graph
import GhcPrelude
import Util
import Hoopl.Label
import Hoopl.Block
import Hoopl.Collections
import GHC.Cmm.Dataflow.Label
import GHC.Cmm.Dataflow.Block
import GHC.Cmm.Dataflow.Collections
-- | A (possibly empty) collection of closed/closed blocks
type Body n = LabelMap (Block n C C)
......
......@@ -4,7 +4,7 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Hoopl.Label
module GHC.Cmm.Dataflow.Label
( Label
, LabelMap
, LabelSet
......@@ -18,7 +18,7 @@ import GhcPrelude
import Outputable
-- 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 TrieMap
......
......@@ -10,7 +10,7 @@
--
-----------------------------------------------------------------------------
module Debug (
module GHC.Cmm.DebugBlock (
DebugBlock(..),
cmmDebugGen,
......@@ -25,22 +25,22 @@ module Debug (
import GhcPrelude
import BlockId
import CLabel
import Cmm
import CmmUtils
import GHC.Cmm.BlockId
import GHC.Cmm.CLabel
import GHC.Cmm
import GHC.Cmm.Utils
import CoreSyn
import FastString ( nilFS, mkFastString )
import Module
import Outputable
import PprCmmExpr ( pprExpr )
import GHC.Cmm.Ppr.Expr ( pprExpr )
import SrcLoc
import Util ( seqList )
import Hoopl.Block
import Hoopl.Collections
import Hoopl.Graph
import Hoopl.Label
import GHC.Cmm.Dataflow.Block
import GHC.Cmm.Dataflow.Collections
import GHC.Cmm.Dataflow.Graph
import GHC.Cmm.Dataflow.Label
import Data.Maybe
import Data.List ( minimumBy, nubBy )
......@@ -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
(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
add an `unwind` statement saying this at the beginning of its unwind-annotated
code,
......@@ -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
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.
* The unwind nodes are carried through the sinking pass. Currently this is
......
......@@ -4,7 +4,7 @@
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
module CmmExpr
module GHC.Cmm.Expr
( CmmExpr(..), cmmExprType, cmmExprWidth, cmmExprAlignment, maybeInvertCmmExpr
, CmmReg(..), cmmRegType, cmmRegWidth
, CmmLit(..), cmmLitType
......@@ -25,17 +25,17 @@ module CmmExpr
, regSetToList
, Area(..)
, module CmmMachOp
, module CmmType
, module GHC.Cmm.MachOp
, module GHC.Cmm.Type
)
where
import GhcPrelude
import BlockId
import CLabel
import CmmMachOp
import CmmType
import GHC.Cmm.BlockId
import GHC.Cmm.CLabel
import GHC.Cmm.MachOp
import GHC.Cmm.Type
import DynFlags
import Outputable (panic)
import Unique
......@@ -83,7 +83,7 @@ data CmmReg
data Area
= Old -- See Note [Old Area]
| 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)
{- Note [Old Area]
......@@ -200,7 +200,7 @@ data CmmLit
| CmmBlock {-# UNPACK #-} !BlockId -- Code label
-- 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
-- #bytes of stack space used during a procedure.
......@@ -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
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
equality of STG registers and does not take overlap into
account. However it is still used in UserOfRegs/DefinerOfRegs and
......
{-# LANGUAGE BangPatterns, GADTs #-}
module MkGraph
module GHC.Cmm.Graph
( CmmAGraph, CmmAGraphScoped, CgStmt(..)
, (<*>), catAGraphs
, mkLabel, mkMiddle, mkLast, outOfLine
......@@ -23,19 +23,19 @@ where
import GhcPrelude hiding ( (<*>) ) -- avoid importing (<*>)
import BlockId
import Cmm
import CmmCallConv
import CmmSwitch (SwitchTargets)
import GHC.Cmm.BlockId
import GHC.Cmm
import GHC.Cmm.CallConv
import GHC.Cmm.Switch (SwitchTargets)
import Hoopl.Block
import Hoopl.Graph
import Hoopl.Label
import GHC.Cmm.Dataflow.Block
import GHC.Cmm.Dataflow.Graph
import GHC.Cmm.Dataflow.Label
import DynFlags
import FastString
import ForeignCall
import OrdList
import SMRep (ByteOff)
import GHC.Runtime.Layout (ByteOff)
import UniqSupply
import Util
import Panic
......
{-# LANGUAGE CPP #-}
module CmmInfo (
module GHC.Cmm.Info (
mkEmptyContInfoTable,
cmmToRawCmm,
mkInfoTable,
......@@ -36,14 +36,14 @@ module CmmInfo (
import GhcPrelude
import Cmm
import CmmUtils
import CLabel
import SMRep
import Bitmap
import GHC.Cmm
import GHC.Cmm.Utils
import GHC.Cmm.CLabel
import GHC.Runtime.Layout
import GHC.Data.Bitmap
import Stream (Stream)
import qualified Stream
import Hoopl.Collections
import GHC.Cmm.Dataflow.Collections
import GHC.Platform
import Maybes
......@@ -281,7 +281,7 @@ mkSRTLit dflags _ (Just lbl) = ([CmmLabel lbl], CmmInt 1 (halfWordWidth dflags))
-- | Is the SRT offset field inline in the info table on this platform?
--
-- See the section "Referring to an SRT from the info table" in
-- Note [SRTs] in CmmBuildInfoTables.hs
-- Note [SRTs] in GHC.Cmm.Info.Build
inlineSRT :: DynFlags -> Bool
inlineSRT dflags = platformArch (targetPlatform dflags) == ArchX86_64
&& tablesNextToCode dflags
......
{-# LANGUAGE GADTs, BangPatterns, RecordWildCards,
GeneralizedNewtypeDeriving, NondecreasingIndentation, TupleSections #-}
module CmmBuildInfoTables
module GHC.Cmm.Info.Build
( CAFSet, CAFEnv, cafAnal
, doSRTs, ModuleSRTInfo, emptySRT
) where
......@@ -9,22 +9,22 @@ module CmmBuildInfoTables
import GhcPrelude hiding (succ)
import Id
import BlockId
import Hoopl.Block
import Hoopl.Graph
import Hoopl.Label
import Hoopl.Collections
import Hoopl.Dataflow
import GHC.Cmm.BlockId
import GHC.Cmm.Dataflow.Block
import GHC.Cmm.Dataflow.Graph
import GHC.Cmm.Dataflow.Label
import GHC.Cmm.Dataflow.Collections
import GHC.Cmm.Dataflow
import Module
import GHC.Platform
import Digraph
import CLabel
import Cmm
import CmmUtils
import GHC.Cmm.CLabel
import GHC.Cmm
import GHC.Cmm.Utils
import DynFlags
import Maybes
import Outputable
import SMRep
import GHC.Runtime.Layout
import UniqSupply
import CostCentre
import GHC.StgToCmm.Heap
......
{-# LANGUAGE BangPatterns, RecordWildCards, GADTs #-}
module CmmLayoutStack (
module GHC.Cmm.LayoutStack (
cmmLayoutStack, setInfoTableStackMap
) where
......@@ -9,21 +9,21 @@ import GHC.StgToCmm.Utils ( callerSaveVolatileRegs, newTemp ) -- XXX layer
import GHC.StgToCmm.Foreign ( saveThreadState, loadThreadState ) -- XXX layering violation
import BasicTypes
import Cmm
import CmmInfo
import BlockId
import CLabel
import CmmUtils
import MkGraph
import GHC.Cmm
import GHC.Cmm.Info
import GHC.Cmm.BlockId
import GHC.Cmm.CLabel
import GHC.Cmm.Utils
import GHC.Cmm.Graph
import ForeignCall
import CmmLive
import CmmProcPoint
import SMRep
import Hoopl.Block
import Hoopl.Collections
import Hoopl.Dataflow
import Hoopl.Graph
import Hoopl.Label
import GHC.Cmm.Liveness
import GHC.Cmm.ProcPoint
import GHC.Runtime.Layout
import GHC.Cmm.Dataflow.Block
import GHC.Cmm.Dataflow.Collections
import GHC.Cmm.Dataflow
import GHC.Cmm.Dataflow.Graph
import GHC.Cmm.Dataflow.Label
import UniqSupply
import Maybes
import UniqFM
......
......@@ -11,16 +11,16 @@
-----------------------------------------------------------------------------
{
module CmmLex (
module GHC.Cmm.Lexer (
CmmToken(..), cmmlex,
) where
import GhcPrelude
import CmmExpr
import GHC.Cmm.Expr
import Lexer
import CmmMonad