Commit 1b1067d1 authored by Sylvain Henry's avatar Sylvain Henry Committed by Marge Bot

Modules: CmmToAsm (#13009)

parent 354e2787
......@@ -15,7 +15,7 @@
{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}
module AsmCodeGen (
module GHC.CmmToAsm (
-- * Module entry point
nativeCodeGen
......@@ -32,43 +32,43 @@ module AsmCodeGen (
import GhcPrelude
import qualified X86.CodeGen
import qualified X86.Regs
import qualified X86.Instr
import qualified X86.Ppr
import qualified GHC.CmmToAsm.X86.CodeGen as X86.CodeGen
import qualified GHC.CmmToAsm.X86.Regs as X86.Regs
import qualified GHC.CmmToAsm.X86.Instr as X86.Instr
import qualified GHC.CmmToAsm.X86.Ppr as X86.Ppr
import qualified SPARC.CodeGen
import qualified SPARC.Regs
import qualified SPARC.Instr
import qualified SPARC.Ppr
import qualified SPARC.ShortcutJump
import qualified SPARC.CodeGen.Expand
import qualified GHC.CmmToAsm.SPARC.CodeGen as SPARC.CodeGen
import qualified GHC.CmmToAsm.SPARC.Regs as SPARC.Regs
import qualified GHC.CmmToAsm.SPARC.Instr as SPARC.Instr
import qualified GHC.CmmToAsm.SPARC.Ppr as SPARC.Ppr
import qualified GHC.CmmToAsm.SPARC.ShortcutJump as SPARC.ShortcutJump
import qualified GHC.CmmToAsm.SPARC.CodeGen.Expand as SPARC.CodeGen.Expand
import qualified PPC.CodeGen
import qualified PPC.Regs
import qualified PPC.RegInfo
import qualified PPC.Instr
import qualified PPC.Ppr
import qualified GHC.CmmToAsm.PPC.CodeGen as PPC.CodeGen
import qualified GHC.CmmToAsm.PPC.Regs as PPC.Regs
import qualified GHC.CmmToAsm.PPC.RegInfo as PPC.RegInfo
import qualified GHC.CmmToAsm.PPC.Instr as PPC.Instr
import qualified GHC.CmmToAsm.PPC.Ppr as PPC.Ppr
import RegAlloc.Liveness
import qualified RegAlloc.Linear.Main as Linear
import GHC.CmmToAsm.Reg.Liveness
import qualified GHC.CmmToAsm.Reg.Linear as Linear
import qualified GraphColor as Color
import qualified RegAlloc.Graph.Main as Color
import qualified RegAlloc.Graph.Stats as Color
import qualified RegAlloc.Graph.TrivColorable as Color
import qualified GraphColor as Color
import qualified GHC.CmmToAsm.Reg.Graph as Color
import qualified GHC.CmmToAsm.Reg.Graph.Stats as Color
import qualified GHC.CmmToAsm.Reg.Graph.TrivColorable as Color
import AsmUtils
import TargetReg
import GHC.CmmToAsm.Reg.Target
import GHC.Platform
import BlockLayout
import GHC.CmmToAsm.BlockLayout as BlockLayout
import Config
import Instruction
import PIC
import Reg
import NCGMonad
import CFG
import Dwarf
import GHC.CmmToAsm.Instr
import GHC.CmmToAsm.PIC
import GHC.Platform.Reg
import GHC.CmmToAsm.Monad
import GHC.CmmToAsm.CFG
import GHC.CmmToAsm.Dwarf
import GHC.Cmm.DebugBlock
import GHC.Cmm.BlockId
......
......@@ -9,16 +9,16 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE FlexibleContexts #-}
module BlockLayout
module GHC.CmmToAsm.BlockLayout
( sequenceTop )
where
#include "HsVersions.h"
import GhcPrelude
import Instruction
import NCGMonad
import CFG
import GHC.CmmToAsm.Instr
import GHC.CmmToAsm.Monad
import GHC.CmmToAsm.CFG
import GHC.Cmm.BlockId
import GHC.Cmm
......
......@@ -10,7 +10,7 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DataKinds #-}
module CFG
module GHC.CmmToAsm.CFG
( CFG, CfgEdge(..), EdgeInfo(..), EdgeWeight(..)
, TransitionSource(..)
......@@ -61,7 +61,7 @@ import Digraph
import Maybes
import Unique
import qualified Dominators as Dom
import qualified GHC.CmmToAsm.CFG.Dominators as Dom
import Data.IntMap.Strict (IntMap)
import Data.IntSet (IntSet)
......
......@@ -25,7 +25,7 @@
Originally taken from the dom-lt package.
-}
module Dominators (
module GHC.CmmToAsm.CFG.Dominators (
Node,Path,Edge
,Graph,Rooted
,idom,ipdom
......
-- | Generating C symbol names emitted by the compiler.
module CPrim
module GHC.CmmToAsm.CPrim
( atomicReadLabel
, atomicWriteLabel
, atomicRMWLabel
......
module Dwarf (
module GHC.CmmToAsm.Dwarf (
dwarfGen
) where
......@@ -16,8 +16,8 @@ import GHC.Platform
import Unique
import UniqSupply
import Dwarf.Constants
import Dwarf.Types
import GHC.CmmToAsm.Dwarf.Constants
import GHC.CmmToAsm.Dwarf.Types
import Control.Arrow ( first )
import Control.Monad ( mfilter )
......
-- | Constants describing the DWARF format. Most of this simply
-- mirrors /usr/include/dwarf.h.
module Dwarf.Constants where
module GHC.CmmToAsm.Dwarf.Constants where
import GhcPrelude
......@@ -10,8 +10,8 @@ import FastString
import GHC.Platform
import Outputable
import Reg
import X86.Regs
import GHC.Platform.Reg
import GHC.CmmToAsm.X86.Regs
import Data.Word
......
module Dwarf.Types
module GHC.CmmToAsm.Dwarf.Types
( -- * Dwarf information
DwarfInfo(..)
, pprDwarfInfo
......@@ -32,11 +32,11 @@ import FastString
import Outputable
import GHC.Platform
import Unique
import Reg
import GHC.Platform.Reg
import SrcLoc
import Util
import Dwarf.Constants
import GHC.CmmToAsm.Dwarf.Constants
import qualified Data.ByteString as BS
import qualified Control.Monad.Trans.State.Strict as S
......
......@@ -8,7 +8,7 @@
-- to have architecture specific formats, and do the overloading
-- properly. eg SPARC doesn't care about FF80.
--
module Format (
module GHC.CmmToAsm.Format (
Format(..),
intFormat,
floatFormat,
......
module Instruction (
module GHC.CmmToAsm.Instr (
RegUsage(..),
noUsage,
GenBasicBlock(..), blockId,
......@@ -16,7 +16,7 @@ where
import GhcPrelude
import Reg
import GHC.Platform.Reg
import GHC.Cmm.BlockId
import GHC.Cmm.Dataflow.Collections
......
......@@ -10,7 +10,7 @@
--
-- -----------------------------------------------------------------------------
module NCGMonad (
module GHC.CmmToAsm.Monad (
NcgImpl(..),
NatM_State(..), mkNatM_State,
......@@ -45,9 +45,9 @@ where
import GhcPrelude
import Reg
import Format
import TargetReg
import GHC.Platform.Reg
import GHC.CmmToAsm.Format
import GHC.CmmToAsm.Reg.Target
import GHC.Cmm.BlockId
import GHC.Cmm.Dataflow.Collections
......@@ -63,10 +63,10 @@ import Module
import Control.Monad ( ap )
import Instruction
import GHC.CmmToAsm.Instr
import Outputable (SDoc, pprPanic, ppr)
import GHC.Cmm (RawCmmDecl, RawCmmStatics)
import CFG
import GHC.CmmToAsm.CFG
data NcgImpl statics instr jumpDest = NcgImpl {
cmmTopCodeGen :: RawCmmDecl -> NatM [NatCmmDecl statics instr],
......
......@@ -33,7 +33,7 @@
that wasn't in the original Cmm code (e.g. floating point literals).
-}
module PIC (
module GHC.CmmToAsm.PIC (
cmmMakeDynamicReference,
CmmMakeDynamicReferenceM(..),
ReferenceKind(..),
......@@ -49,15 +49,14 @@ where
import GhcPrelude
import qualified PPC.Instr as PPC
import qualified PPC.Regs as PPC
import qualified X86.Instr as X86
import qualified GHC.CmmToAsm.PPC.Instr as PPC
import qualified GHC.CmmToAsm.PPC.Regs as PPC
import qualified GHC.CmmToAsm.X86.Instr as X86
import GHC.Platform
import Instruction
import Reg
import NCGMonad
import GHC.CmmToAsm.Instr
import GHC.Platform.Reg
import GHC.CmmToAsm.Monad
import GHC.Cmm.Dataflow.Collections
......
......@@ -12,7 +12,7 @@
-- (a) the sectioning, and (b) the type signatures,
-- the structure should not be too overwhelming.
module PPC.CodeGen (
module GHC.CmmToAsm.PPC.CodeGen (
cmmTopCodeGen,
generateJumpTableForInstr,
InstrBlock
......@@ -26,19 +26,21 @@ where
import GhcPrelude
import GHC.Platform.Regs
import PPC.Instr
import PPC.Cond
import PPC.Regs
import CPrim
import NCGMonad ( NatM, getNewRegNat, getNewLabelNat
, getBlockIdNat, getPicBaseNat, getNewRegPairNat
, getPicBaseMaybeNat )
import Instruction
import PIC
import Format
import RegClass
import Reg
import TargetReg
import GHC.CmmToAsm.PPC.Instr
import GHC.CmmToAsm.PPC.Cond
import GHC.CmmToAsm.PPC.Regs
import GHC.CmmToAsm.CPrim
import GHC.CmmToAsm.Monad
( NatM, getNewRegNat, getNewLabelNat
, getBlockIdNat, getPicBaseNat, getNewRegPairNat
, getPicBaseMaybeNat
)
import GHC.CmmToAsm.Instr
import GHC.CmmToAsm.PIC
import GHC.CmmToAsm.Format
import GHC.Platform.Reg.Class
import GHC.Platform.Reg
import GHC.CmmToAsm.Reg.Target
import GHC.Platform
-- Our intermediate code:
......
module PPC.Cond (
module GHC.CmmToAsm.PPC.Cond (
Cond(..),
condNegate,
condUnsigned,
......
......@@ -12,7 +12,7 @@
#include "HsVersions.h"
module PPC.Instr (
module GHC.CmmToAsm.PPC.Instr (
archWordFormat,
RI(..),
Instr(..),
......@@ -26,13 +26,13 @@ where
import GhcPrelude
import PPC.Regs
import PPC.Cond
import Instruction
import Format
import TargetReg
import RegClass
import Reg
import GHC.CmmToAsm.PPC.Regs
import GHC.CmmToAsm.PPC.Cond
import GHC.CmmToAsm.Instr
import GHC.CmmToAsm.Format
import GHC.CmmToAsm.Reg.Target
import GHC.Platform.Reg.Class
import GHC.Platform.Reg
import GHC.Platform.Regs
import GHC.Cmm.BlockId
......@@ -110,8 +110,8 @@ ppc_mkStackAllocInstr' platform amount
allocMoreStack
:: Platform
-> Int
-> NatCmmDecl statics PPC.Instr.Instr
-> UniqSM (NatCmmDecl statics PPC.Instr.Instr, [(BlockId,BlockId)])
-> NatCmmDecl statics GHC.CmmToAsm.PPC.Instr.Instr
-> UniqSM (NatCmmDecl statics GHC.CmmToAsm.PPC.Instr.Instr, [(BlockId,BlockId)])
allocMoreStack _ _ top@(CmmData _ _) = return (top,[])
allocMoreStack platform slots (CmmProc info lbl live (ListGraph code)) = do
......
......@@ -7,19 +7,19 @@
-----------------------------------------------------------------------------
{-# OPTIONS_GHC -fno-warn-orphans #-}
module PPC.Ppr (pprNatCmmDecl) where
module GHC.CmmToAsm.PPC.Ppr (pprNatCmmDecl) where
import GhcPrelude
import PPC.Regs
import PPC.Instr
import PPC.Cond
import PprBase
import Instruction
import Format
import Reg
import RegClass
import TargetReg
import GHC.CmmToAsm.PPC.Regs
import GHC.CmmToAsm.PPC.Instr
import GHC.CmmToAsm.PPC.Cond
import GHC.CmmToAsm.Ppr
import GHC.CmmToAsm.Instr
import GHC.CmmToAsm.Format
import GHC.Platform.Reg
import GHC.Platform.Reg.Class
import GHC.CmmToAsm.Reg.Target
import GHC.Cmm hiding (topInfoTable)
import GHC.Cmm.Dataflow.Collections
......
......@@ -7,7 +7,7 @@
-- (c) The University of Glasgow 1996-2004
--
-----------------------------------------------------------------------------
module PPC.RegInfo (
module GHC.CmmToAsm.PPC.RegInfo (
JumpDest( DestBlockId ), getJumpDestBlockId,
canShortcut,
shortcutJump,
......@@ -21,7 +21,7 @@ where
import GhcPrelude
import PPC.Instr
import GHC.CmmToAsm.PPC.Instr
import GHC.Cmm.BlockId
import GHC.Cmm
......
......@@ -6,7 +6,7 @@
--
-- -----------------------------------------------------------------------------
module PPC.Regs (
module GHC.CmmToAsm.PPC.Regs (
-- squeeze functions
virtualRegSqueeze,
realRegSqueeze,
......@@ -51,9 +51,9 @@ where
import GhcPrelude
import Reg
import RegClass
import Format
import GHC.Platform.Reg
import GHC.Platform.Reg.Class
import GHC.CmmToAsm.Format
import GHC.Cmm
import GHC.Cmm.CLabel ( CLabel )
......
......@@ -8,7 +8,7 @@
--
-----------------------------------------------------------------------------
module PprBase (
module GHC.CmmToAsm.Ppr (
castFloatToWord8Array,
castDoubleToWord8Array,
floatToBytes,
......
......@@ -2,22 +2,22 @@
{-# LANGUAGE ScopedTypeVariables #-}
-- | Graph coloring register allocator.
module RegAlloc.Graph.Main (
module GHC.CmmToAsm.Reg.Graph (
regAlloc
) where
import GhcPrelude
import qualified GraphColor as Color
import RegAlloc.Liveness
import RegAlloc.Graph.Spill
import RegAlloc.Graph.SpillClean
import RegAlloc.Graph.SpillCost
import RegAlloc.Graph.Stats
import RegAlloc.Graph.TrivColorable
import Instruction
import TargetReg
import RegClass
import Reg
import GHC.CmmToAsm.Reg.Liveness
import GHC.CmmToAsm.Reg.Graph.Spill
import GHC.CmmToAsm.Reg.Graph.SpillClean
import GHC.CmmToAsm.Reg.Graph.SpillCost
import GHC.CmmToAsm.Reg.Graph.Stats
import GHC.CmmToAsm.Reg.Graph.TrivColorable
import GHC.CmmToAsm.Instr
import GHC.CmmToAsm.Reg.Target
import GHC.Platform.Reg.Class
import GHC.Platform.Reg
import Bag
import GHC.Driver.Session
......@@ -27,7 +27,7 @@ import UniqFM
import UniqSet
import UniqSupply
import Util (seqList)
import CFG
import GHC.CmmToAsm.CFG
import Data.Maybe
import Control.Monad
......
......@@ -12,7 +12,7 @@
-- This code is here because we can test the architecture specific code against
-- it.
--
module RegAlloc.Graph.ArchBase (
module GHC.CmmToAsm.Reg.Graph.Base (
RegClass(..),
Reg(..),
RegSub(..),
......
-- | Register coalescing.
module RegAlloc.Graph.Coalesce (
module GHC.CmmToAsm.Reg.Graph.Coalesce (
regCoalesce,
slurpJoinMovs
) where
import GhcPrelude
import RegAlloc.Liveness
import Instruction
import Reg
import GHC.CmmToAsm.Reg.Liveness
import GHC.CmmToAsm.Instr
import GHC.Platform.Reg
import GHC.Cmm
import Bag
......
......@@ -2,16 +2,16 @@
-- | When there aren't enough registers to hold all the vregs we have to spill
-- some of those vregs to slots on the stack. This module is used modify the
-- code to use those slots.
module RegAlloc.Graph.Spill (
module GHC.CmmToAsm.Reg.Graph.Spill (
regSpill,
SpillStats(..),
accSpillSL
) where
import GhcPrelude
import RegAlloc.Liveness
import Instruction
import Reg
import GHC.CmmToAsm.Reg.Liveness
import GHC.CmmToAsm.Instr
import GHC.Platform.Reg
import GHC.Cmm hiding (RegSet)
import GHC.Cmm.BlockId
import GHC.Cmm.Dataflow.Collections
......
......@@ -26,14 +26,14 @@
-- This also works if the reloads in B1\/B2 were spills instead, because
-- spilling %r1 to a slot makes that slot have the same value as %r1.
--
module RegAlloc.Graph.SpillClean (
module GHC.CmmToAsm.Reg.Graph.SpillClean (
cleanSpills
) where
import GhcPrelude
import RegAlloc.Liveness
import Instruction
import Reg
import GHC.CmmToAsm.Reg.Liveness
import GHC.CmmToAsm.Instr
import GHC.Platform.Reg
import GHC.Cmm.BlockId
import GHC.Cmm
......
{-# LANGUAGE ScopedTypeVariables, GADTs, BangPatterns #-}
module RegAlloc.Graph.SpillCost (
module GHC.CmmToAsm.Reg.Graph.SpillCost (
SpillCostRecord,
plusSpillCostRecord,
pprSpillCostRecord,
......@@ -15,10 +15,10 @@ module RegAlloc.Graph.SpillCost (
) where
import GhcPrelude
import RegAlloc.Liveness
import Instruction
import RegClass
import Reg
import GHC.CmmToAsm.Reg.Liveness
import GHC.CmmToAsm.Instr
import GHC.Platform.Reg.Class
import GHC.Platform.Reg
import GraphBase
......@@ -31,7 +31,7 @@ import Digraph (flattenSCCs)
import Outputable
import GHC.Platform
import State
import CFG
import GHC.CmmToAsm.CFG
import Data.List (nub, minimumBy)
import Data.Maybe
......
......@@ -4,7 +4,7 @@
-- | Carries interesting info for debugging / profiling of the
-- graph coloring register allocator.
module RegAlloc.Graph.Stats (
module GHC.CmmToAsm.Reg.Graph.Stats (
RegAllocStats (..),
pprStats,
......@@ -19,14 +19,14 @@ module RegAlloc.Graph.Stats (
import GhcPrelude
import qualified GraphColor as Color
import RegAlloc.Liveness
import RegAlloc.Graph.Spill
import RegAlloc.Graph.SpillCost
import RegAlloc.Graph.TrivColorable
import Instruction
import RegClass
import Reg
import TargetReg
import GHC.CmmToAsm.Reg.Liveness
import GHC.CmmToAsm.Reg.Graph.Spill
import GHC.CmmToAsm.Reg.Graph.SpillCost
import GHC.CmmToAsm.Reg.Graph.TrivColorable
import GHC.CmmToAsm.Instr
import GHC.Platform.Reg.Class
import GHC.Platform.Reg
import GHC.CmmToAsm.Reg.Target
import Outputable
import UniqFM
......
{-# LANGUAGE CPP #-}
module RegAlloc.Graph.TrivColorable (
module GHC.CmmToAsm.Reg.Graph.TrivColorable (
trivColorable,
)
......@@ -10,8 +10,8 @@ where
import GhcPrelude
import RegClass
import Reg
import GHC.Platform.Reg.Class
import GHC.Platform.Reg
import GraphBase
......
......@@ -6,7 +6,7 @@
-- See RegArchBase.hs for the reference.
-- See MachRegs.hs for the actual trivColorable function used in GHC.
--
module RegAlloc.Graph.ArchX86 (
module GHC.CmmToAsm.Reg.Graph.X86 (
classOfReg,
regsOfClass,
regName,
......@@ -17,7 +17,7 @@ module RegAlloc.Graph.ArchX86 (
import GhcPrelude
import RegAlloc.Graph.ArchBase (Reg(..), RegSub(..), RegClass(..))
import GHC.CmmToAsm.Reg.Graph.Base (Reg(..), RegSub(..), RegClass(..))
import UniqSet
import qualified Data.Array as A
......
......@@ -95,10 +95,10 @@ The algorithm is roughly:
-}
module RegAlloc.Linear.Main (
module GHC.CmmToAsm.Reg.Linear (
regAlloc,
module RegAlloc.Linear.Base,
module RegAlloc.Linear.Stats
module GHC.CmmToAsm.Reg.Linear.Base,
module GHC.CmmToAsm.Reg.Linear.Stats
) where
#include "HsVersions.h"
......@@ -106,20 +106,20 @@ module RegAlloc.Linear.Main (
import GhcPrelude
import RegAlloc.Linear.State
import RegAlloc.Linear.Base
import RegAlloc.Linear.StackMap
import RegAlloc.Linear.FreeRegs
import RegAlloc.Linear.Stats
import RegAlloc.Linear.JoinToTargets
import qualified RegAlloc.Linear.PPC.FreeRegs as PPC
import qualified RegAlloc.Linear.SPARC.FreeRegs as SPARC
import qualified RegAlloc.Linear.X86.FreeRegs as X86
import qualified RegAlloc.Linear.X86_64.FreeRegs as X86_64
import TargetReg
import RegAlloc.Liveness
import Instruction
import Reg
import GHC.CmmToAsm.Reg.Linear.State
import GHC.CmmToAsm.Reg.Linear.Base
import GHC.CmmToAsm.Reg.Linear.StackMap
import GHC.CmmToAsm.Reg.Linear.FreeRegs
import GHC.CmmToAsm.Reg.Linear.Stats
import GHC.CmmToAsm.Reg.Linear.JoinToTargets
import qualified GHC.CmmToAsm.Reg.Linear.PPC as PPC