Commit 1500f089 authored by Sylvain Henry's avatar Sylvain Henry Committed by Marge Bot

Modules: Llvm (#13009)

parent 192caf58
...@@ -3,19 +3,25 @@ ...@@ -3,19 +3,25 @@
-- ----------------------------------------------------------------------------- -- -----------------------------------------------------------------------------
-- | This is the top-level module in the LLVM code generator. -- | This is the top-level module in the LLVM code generator.
-- --
module LlvmCodeGen ( LlvmVersion, llvmVersionList, llvmCodeGen, llvmFixupAsm ) where module GHC.CmmToLlvm
( LlvmVersion
, llvmVersionList
, llvmCodeGen
, llvmFixupAsm
)
where
#include "HsVersions.h" #include "HsVersions.h"
import GhcPrelude import GhcPrelude
import Llvm import GHC.Llvm
import LlvmCodeGen.Base import GHC.CmmToLlvm.Base
import LlvmCodeGen.CodeGen import GHC.CmmToLlvm.CodeGen
import LlvmCodeGen.Data import GHC.CmmToLlvm.Data
import LlvmCodeGen.Ppr import GHC.CmmToLlvm.Ppr
import LlvmCodeGen.Regs import GHC.CmmToLlvm.Regs
import LlvmMangler import GHC.CmmToLlvm.Mangler
import GHC.StgToCmm.CgUtils ( fixStgRegisters ) import GHC.StgToCmm.CgUtils ( fixStgRegisters )
import GHC.Cmm import GHC.Cmm
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
-- Contains functions useful through out the code generator. -- Contains functions useful through out the code generator.
-- --
module LlvmCodeGen.Base ( module GHC.CmmToLlvm.Base (
LlvmCmmDecl, LlvmBasicBlock, LlvmCmmDecl, LlvmBasicBlock,
LiveGlobalRegs, LiveGlobalRegs,
...@@ -43,8 +43,8 @@ module LlvmCodeGen.Base ( ...@@ -43,8 +43,8 @@ module LlvmCodeGen.Base (
import GhcPrelude import GhcPrelude
import Llvm import GHC.Llvm
import LlvmCodeGen.Regs import GHC.CmmToLlvm.Regs
import GHC.Cmm.CLabel import GHC.Cmm.CLabel
import GHC.Platform.Regs ( activeStgRegs ) import GHC.Platform.Regs ( activeStgRegs )
......
...@@ -4,15 +4,15 @@ ...@@ -4,15 +4,15 @@
-- ---------------------------------------------------------------------------- -- ----------------------------------------------------------------------------
-- | Handle conversion of CmmProc to LLVM code. -- | Handle conversion of CmmProc to LLVM code.
-- --
module LlvmCodeGen.CodeGen ( genLlvmProc ) where module GHC.CmmToLlvm.CodeGen ( genLlvmProc ) where
#include "HsVersions.h" #include "HsVersions.h"
import GhcPrelude import GhcPrelude
import Llvm import GHC.Llvm
import LlvmCodeGen.Base import GHC.CmmToLlvm.Base
import LlvmCodeGen.Regs import GHC.CmmToLlvm.Regs
import GHC.Cmm.BlockId import GHC.Cmm.BlockId
import GHC.Platform.Regs ( activeStgRegs ) import GHC.Platform.Regs ( activeStgRegs )
...@@ -422,8 +422,8 @@ genCall target res args = runStmtsDecls $ do ...@@ -422,8 +422,8 @@ genCall target res args = runStmtsDecls $ do
_ -> CC_Ccc _ -> CC_Ccc
CCallConv -> CC_Ccc CCallConv -> CC_Ccc
CApiConv -> CC_Ccc CApiConv -> CC_Ccc
PrimCallConv -> panic "LlvmCodeGen.CodeGen.genCall: PrimCallConv" PrimCallConv -> panic "GHC.CmmToLlvm.CodeGen.genCall: PrimCallConv"
JavaScriptCallConv -> panic "LlvmCodeGen.CodeGen.genCall: JavaScriptCallConv" JavaScriptCallConv -> panic "GHC.CmmToLlvm.CodeGen.genCall: JavaScriptCallConv"
PrimTarget _ -> CC_Ccc PrimTarget _ -> CC_Ccc
...@@ -1927,10 +1927,10 @@ toIWord dflags = mkIntLit (llvmWord dflags) ...@@ -1927,10 +1927,10 @@ toIWord dflags = mkIntLit (llvmWord dflags)
-- | Error functions -- | Error functions
panic :: String -> a panic :: String -> a
panic s = Outputable.panic $ "LlvmCodeGen.CodeGen." ++ s panic s = Outputable.panic $ "GHC.CmmToLlvm.CodeGen." ++ s
pprPanic :: String -> SDoc -> a pprPanic :: String -> SDoc -> a
pprPanic s d = Outputable.pprPanic ("LlvmCodeGen.CodeGen." ++ s) d pprPanic s d = Outputable.pprPanic ("GHC.CmmToLlvm.CodeGen." ++ s) d
-- | Returns TBAA meta data by unique -- | Returns TBAA meta data by unique
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
-- | Handle conversion of CmmData to LLVM code. -- | Handle conversion of CmmData to LLVM code.
-- --
module LlvmCodeGen.Data ( module GHC.CmmToLlvm.Data (
genLlvmData, genData genLlvmData, genData
) where ) where
...@@ -11,8 +11,8 @@ module LlvmCodeGen.Data ( ...@@ -11,8 +11,8 @@ module LlvmCodeGen.Data (
import GhcPrelude import GhcPrelude
import Llvm import GHC.Llvm
import LlvmCodeGen.Base import GHC.CmmToLlvm.Base
import GHC.Cmm.BlockId import GHC.Cmm.BlockId
import GHC.Cmm.CLabel import GHC.Cmm.CLabel
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
-- instructions require 32-byte alignment. -- instructions require 32-byte alignment.
-- --
module LlvmMangler ( llvmFixupAsm ) where module GHC.CmmToLlvm.Mangler ( llvmFixupAsm ) where
import GhcPrelude import GhcPrelude
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
-- ---------------------------------------------------------------------------- -- ----------------------------------------------------------------------------
-- | Pretty print helpers for the LLVM Code generator. -- | Pretty print helpers for the LLVM Code generator.
-- --
module LlvmCodeGen.Ppr ( module GHC.CmmToLlvm.Ppr (
pprLlvmCmmDecl, pprLlvmData, infoSection pprLlvmCmmDecl, pprLlvmData, infoSection
) where ) where
...@@ -11,9 +11,9 @@ module LlvmCodeGen.Ppr ( ...@@ -11,9 +11,9 @@ module LlvmCodeGen.Ppr (
import GhcPrelude import GhcPrelude
import Llvm import GHC.Llvm
import LlvmCodeGen.Base import GHC.CmmToLlvm.Base
import LlvmCodeGen.Data import GHC.CmmToLlvm.Data
import GHC.Cmm.CLabel import GHC.Cmm.CLabel
import GHC.Cmm import GHC.Cmm
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
-- | Deal with Cmm registers -- | Deal with Cmm registers
-- --
module LlvmCodeGen.Regs ( module GHC.CmmToLlvm.Regs (
lmGlobalRegArg, lmGlobalRegVar, alwaysLive, lmGlobalRegArg, lmGlobalRegVar, alwaysLive,
stgTBAA, baseN, stackN, heapN, rxN, topN, tbaa, getTBAA stgTBAA, baseN, stackN, heapN, rxN, topN, tbaa, getTBAA
) where ) where
...@@ -13,7 +13,7 @@ module LlvmCodeGen.Regs ( ...@@ -13,7 +13,7 @@ module LlvmCodeGen.Regs (
import GhcPrelude import GhcPrelude
import Llvm import GHC.Llvm
import GHC.Cmm.Expr import GHC.Cmm.Expr
import DynFlags import DynFlags
...@@ -79,7 +79,7 @@ lmGlobalReg dflags suf reg ...@@ -79,7 +79,7 @@ lmGlobalReg dflags suf reg
ZmmReg 5 -> zmmGlobal $ "ZMM5" ++ suf ZmmReg 5 -> zmmGlobal $ "ZMM5" ++ suf
ZmmReg 6 -> zmmGlobal $ "ZMM6" ++ suf ZmmReg 6 -> zmmGlobal $ "ZMM6" ++ suf
MachSp -> wordGlobal $ "MachSp" ++ suf MachSp -> wordGlobal $ "MachSp" ++ suf
_other -> panic $ "LlvmCodeGen.Reg: GlobalReg (" ++ (show reg) _other -> panic $ "GHC.CmmToLlvm.Reg: GlobalReg (" ++ (show reg)
++ ") not supported!" ++ ") not supported!"
-- LongReg, HpLim, CCSS, CurrentTSO, CurrentNusery, HpAlloc -- LongReg, HpLim, CCSS, CurrentTSO, CurrentNusery, HpAlloc
-- EagerBlackholeInfo, GCEnter1, GCFun, BaseReg, PicBaseReg -- EagerBlackholeInfo, GCEnter1, GCFun, BaseReg, PicBaseReg
...@@ -116,12 +116,12 @@ stgTBAA ...@@ -116,12 +116,12 @@ stgTBAA
-- hierarchy and as of LLVM 4.0 should *only* be referenced by other nodes. It -- hierarchy and as of LLVM 4.0 should *only* be referenced by other nodes. It
-- should never occur in any LLVM instruction statement. -- should never occur in any LLVM instruction statement.
rootN, topN, stackN, heapN, rxN, baseN :: Unique rootN, topN, stackN, heapN, rxN, baseN :: Unique
rootN = getUnique (fsLit "LlvmCodeGen.Regs.rootN") rootN = getUnique (fsLit "GHC.CmmToLlvm.Regs.rootN")
topN = getUnique (fsLit "LlvmCodeGen.Regs.topN") topN = getUnique (fsLit "GHC.CmmToLlvm.Regs.topN")
stackN = getUnique (fsLit "LlvmCodeGen.Regs.stackN") stackN = getUnique (fsLit "GHC.CmmToLlvm.Regs.stackN")
heapN = getUnique (fsLit "LlvmCodeGen.Regs.heapN") heapN = getUnique (fsLit "GHC.CmmToLlvm.Regs.heapN")
rxN = getUnique (fsLit "LlvmCodeGen.Regs.rxN") rxN = getUnique (fsLit "GHC.CmmToLlvm.Regs.rxN")
baseN = getUnique (fsLit "LlvmCodeGen.Regs.baseN") baseN = getUnique (fsLit "GHC.CmmToLlvm.Regs.baseN")
-- | The TBAA metadata identifier -- | The TBAA metadata identifier
tbaa :: LMString tbaa :: LMString
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
-- (EHC) project (<http://www.cs.uu.nl/wiki/Ehc/WebHome>). -- (EHC) project (<http://www.cs.uu.nl/wiki/Ehc/WebHome>).
-- --
module Llvm ( module GHC.Llvm (
-- * Modules, Functions and Blocks -- * Modules, Functions and Blocks
LlvmModule(..), LlvmModule(..),
...@@ -57,8 +57,8 @@ module Llvm ( ...@@ -57,8 +57,8 @@ module Llvm (
) where ) where
import Llvm.AbsSyn import GHC.Llvm.Syntax
import Llvm.MetaData import GHC.Llvm.MetaData
import Llvm.PpLlvm import GHC.Llvm.Ppr
import Llvm.Types import GHC.Llvm.Types
{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Llvm.MetaData where module GHC.Llvm.MetaData where
import GhcPrelude import GhcPrelude
import Llvm.Types import GHC.Llvm.Types
import Outputable import Outputable
-- The LLVM Metadata System. -- The LLVM Metadata System.
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
-- | Pretty print LLVM IR Code. -- | Pretty print LLVM IR Code.
-- --
module Llvm.PpLlvm ( module GHC.Llvm.Ppr (
-- * Top level LLVM objects. -- * Top level LLVM objects.
ppLlvmModule, ppLlvmModule,
...@@ -27,9 +27,9 @@ module Llvm.PpLlvm ( ...@@ -27,9 +27,9 @@ module Llvm.PpLlvm (
import GhcPrelude import GhcPrelude
import Llvm.AbsSyn import GHC.Llvm.Syntax
import Llvm.MetaData import GHC.Llvm.MetaData
import Llvm.Types import GHC.Llvm.Types
import Data.List ( intersperse ) import Data.List ( intersperse )
import Outputable import Outputable
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
-- | The LLVM abstract syntax. -- | The LLVM abstract syntax.
-- --
module Llvm.AbsSyn where module GHC.Llvm.Syntax where
import GhcPrelude import GhcPrelude
import Llvm.MetaData import GHC.Llvm.MetaData
import Llvm.Types import GHC.Llvm.Types
import Unique import Unique
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
-- | The LLVM Type System. -- | The LLVM Type System.
-- --
module Llvm.Types where module GHC.Llvm.Types where
#include "HsVersions.h" #include "HsVersions.h"
...@@ -372,7 +372,7 @@ llvmWidthInBits _ (LMStructU _) = ...@@ -372,7 +372,7 @@ llvmWidthInBits _ (LMStructU _) =
-- It's not trivial to calculate the bit width of the unpacked structs, -- It's not trivial to calculate the bit width of the unpacked structs,
-- since they will be aligned depending on the specified datalayout ( -- since they will be aligned depending on the specified datalayout (
-- http://llvm.org/docs/LangRef.html#data-layout ). One way we could support -- http://llvm.org/docs/LangRef.html#data-layout ). One way we could support
-- this could be to make the LlvmCodeGen.Ppr.moduleLayout be a data type -- this could be to make the GHC.CmmToLlvm.Ppr.moduleLayout be a data type
-- that exposes the alignment information. However, currently the only place -- that exposes the alignment information. However, currently the only place
-- we use unpacked structs is LLVM intrinsics that return them (e.g., -- we use unpacked structs is LLVM intrinsics that return them (e.g.,
-- llvm.sadd.with.overflow.*), so we don't actually need to compute their -- llvm.sadd.with.overflow.*), so we don't actually need to compute their
......
...@@ -165,7 +165,6 @@ Library ...@@ -165,7 +165,6 @@ Library
cmm cmm
coreSyn coreSyn
iface iface
llvmGen
main main
nativeGen nativeGen
parser parser
...@@ -212,18 +211,18 @@ Library ...@@ -212,18 +211,18 @@ Library
Predicate Predicate
Lexeme Lexeme
Literal Literal
Llvm GHC.Llvm
Llvm.AbsSyn GHC.Llvm.Syntax
Llvm.MetaData GHC.Llvm.MetaData
Llvm.PpLlvm GHC.Llvm.Ppr
Llvm.Types GHC.Llvm.Types
LlvmCodeGen GHC.CmmToLlvm
LlvmCodeGen.Base GHC.CmmToLlvm.Base
LlvmCodeGen.CodeGen GHC.CmmToLlvm.CodeGen
LlvmCodeGen.Data GHC.CmmToLlvm.Data
LlvmCodeGen.Ppr GHC.CmmToLlvm.Ppr
LlvmCodeGen.Regs GHC.CmmToLlvm.Regs
LlvmMangler GHC.CmmToLlvm.Mangler
MkId MkId
Module Module
Name Name
......
...@@ -13,7 +13,7 @@ module CodeOutput( codeOutput, outputForeignStubs ) where ...@@ -13,7 +13,7 @@ module CodeOutput( codeOutput, outputForeignStubs ) where
import GhcPrelude import GhcPrelude
import AsmCodeGen ( nativeCodeGen ) import AsmCodeGen ( nativeCodeGen )
import LlvmCodeGen ( llvmCodeGen ) import GHC.CmmToLlvm ( llvmCodeGen )
import UniqSupply ( mkSplitUniqSupply ) import UniqSupply ( mkSplitUniqSupply )
......
...@@ -57,7 +57,7 @@ import StringBuffer ( hGetStringBuffer, hPutStringBuffer ) ...@@ -57,7 +57,7 @@ import StringBuffer ( hGetStringBuffer, hPutStringBuffer )
import BasicTypes ( SuccessFlag(..) ) import BasicTypes ( SuccessFlag(..) )
import Maybes ( expectJust ) import Maybes ( expectJust )
import SrcLoc import SrcLoc
import LlvmCodeGen ( llvmFixupAsm, llvmVersionList ) import GHC.CmmToLlvm ( llvmFixupAsm, llvmVersionList )
import MonadUtils import MonadUtils
import GHC.Platform import GHC.Platform
import TcRnTypes import TcRnTypes
......
...@@ -22,7 +22,7 @@ import System.IO ...@@ -22,7 +22,7 @@ import System.IO
import System.Process import System.Process
import GhcPrelude import GhcPrelude
import LlvmCodeGen.Base (LlvmVersion, llvmVersionStr, supportedLlvmVersion, parseLlvmVersion) import GHC.CmmToLlvm.Base (LlvmVersion, llvmVersionStr, supportedLlvmVersion, parseLlvmVersion)
import SysTools.Process import SysTools.Process
import SysTools.Info import SysTools.Info
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment