summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2018-11-26 17:21:12 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-03-05 22:22:40 -0500
commit37f257afcd6a52cf4d76c60d766b1aeb520b9f05 (patch)
treeac800e46fbf94c16ce39170f4a720637b07dde06 /compiler
parent646b6dfbe125aa756a935e840979ba11b4a882c0 (diff)
downloadhaskell-37f257afcd6a52cf4d76c60d766b1aeb520b9f05.tar.gz
Rip out object splitting
The splitter is an evil Perl script that processes assembler code. Its job can be done better by the linker's --gc-sections flag. GHC passes this flag to the linker whenever -split-sections is passed on the command line. This is based on @DemiMarie's D2768. Fixes Trac #11315 Fixes Trac #9832 Fixes Trac #8964 Fixes Trac #8685 Fixes Trac #8629
Diffstat (limited to 'compiler')
-rw-r--r--compiler/cmm/CLabel.hs4
-rw-r--r--compiler/codeGen/StgCmm.hs38
-rw-r--r--compiler/codeGen/StgCmmExpr.hs11
-rw-r--r--compiler/codeGen/StgCmmMonad.hs10
-rw-r--r--compiler/ghc.mk7
-rw-r--r--compiler/main/DriverPhases.hs9
-rw-r--r--compiler/main/DriverPipeline.hs166
-rw-r--r--compiler/main/DynFlags.hs25
-rw-r--r--compiler/main/HscMain.hs2
-rw-r--r--compiler/main/SysTools.hs16
-rw-r--r--compiler/main/SysTools/BaseDir.hs2
-rw-r--r--compiler/main/SysTools/Tasks.hs5
-rw-r--r--compiler/nativeGen/AsmCodeGen.hs32
-rw-r--r--compiler/nativeGen/CFG.hs7
-rw-r--r--compiler/nativeGen/PIC.hs2
-rw-r--r--compiler/nativeGen/PPC/Ppr.hs17
-rw-r--r--compiler/nativeGen/RegAlloc/Liveness.hs4
-rw-r--r--compiler/nativeGen/SPARC/Ppr.hs11
-rw-r--r--compiler/nativeGen/X86/Ppr.hs19
19 files changed, 62 insertions, 325 deletions
diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs
index 40b4e70aa0..73ca36c848 100644
--- a/compiler/cmm/CLabel.hs
+++ b/compiler/cmm/CLabel.hs
@@ -39,7 +39,6 @@ module CLabel (
mkAsmTempEndLabel,
mkAsmTempDieLabel,
- mkSplitMarkerLabel,
mkDirty_MUT_VAR_Label,
mkUpdInfoLabel,
mkBHUpdInfoLabel,
@@ -486,7 +485,7 @@ mkBlockInfoTableLabel name c = IdLabel name c BlockInfoTable
-- See Note [Proc-point local block entry-point].
-- Constructing Cmm Labels
-mkDirty_MUT_VAR_Label, mkSplitMarkerLabel, mkUpdInfoLabel,
+mkDirty_MUT_VAR_Label, mkUpdInfoLabel,
mkBHUpdInfoLabel, mkIndStaticInfoLabel, mkMainCapabilityLabel,
mkMAP_FROZEN_CLEAN_infoLabel, mkMAP_FROZEN_DIRTY_infoLabel,
mkMAP_DIRTY_infoLabel,
@@ -496,7 +495,6 @@ mkDirty_MUT_VAR_Label, mkSplitMarkerLabel, mkUpdInfoLabel,
mkSMAP_FROZEN_CLEAN_infoLabel, mkSMAP_FROZEN_DIRTY_infoLabel,
mkSMAP_DIRTY_infoLabel, mkBadAlignmentLabel :: CLabel
mkDirty_MUT_VAR_Label = mkForeignLabel (fsLit "dirty_MUT_VAR") Nothing ForeignLabelInExternalPackage IsFunction
-mkSplitMarkerLabel = CmmLabel rtsUnitId (fsLit "__stg_split_marker") CmmCode
mkUpdInfoLabel = CmmLabel rtsUnitId (fsLit "stg_upd_frame") CmmInfo
mkBHUpdInfoLabel = CmmLabel rtsUnitId (fsLit "stg_bh_upd_frame" ) CmmInfo
mkIndStaticInfoLabel = CmmLabel rtsUnitId (fsLit "stg_IND_STATIC") CmmInfo
diff --git a/compiler/codeGen/StgCmm.hs b/compiler/codeGen/StgCmm.hs
index ff63b555ac..6cdb14880a 100644
--- a/compiler/codeGen/StgCmm.hs
+++ b/compiler/codeGen/StgCmm.hs
@@ -39,7 +39,6 @@ import Id
import IdInfo
import RepType
import DataCon
-import Name
import TyCon
import Module
import Outputable
@@ -120,17 +119,14 @@ variable. -}
cgTopBinding :: DynFlags -> CgStgTopBinding -> FCode ()
cgTopBinding dflags (StgTopLifted (StgNonRec id rhs))
- = do { id' <- maybeExternaliseId dflags id
- ; let (info, fcode) = cgTopRhs dflags NonRecursive id' rhs
+ = do { let (info, fcode) = cgTopRhs dflags NonRecursive id rhs
; fcode
- ; addBindC info -- Add the *un-externalised* Id to the envt,
- -- so we find it when we look up occurrences
+ ; addBindC info
}
cgTopBinding dflags (StgTopLifted (StgRec pairs))
= do { let (bndrs, rhss) = unzip pairs
- ; bndrs' <- Prelude.mapM (maybeExternaliseId dflags) bndrs
- ; let pairs' = zip bndrs' rhss
+ ; let pairs' = zip bndrs rhss
r = unzipWith (cgTopRhs dflags Recursive) pairs'
(infos, fcodes) = unzip r
; addBindsC infos
@@ -138,16 +134,14 @@ cgTopBinding dflags (StgTopLifted (StgRec pairs))
}
cgTopBinding dflags (StgTopStringLit id str)
- = do { id' <- maybeExternaliseId dflags id
- ; let label = mkBytesLabel (idName id')
+ = do { let label = mkBytesLabel (idName id)
; let (lit, decl) = mkByteStringCLit label str
; emitDecl decl
- ; addBindC (litIdInfo dflags id' mkLFStringLit lit)
+ ; addBindC (litIdInfo dflags id mkLFStringLit lit)
}
cgTopRhs :: DynFlags -> RecFlag -> Id -> CgStgRhs -> (CgIdInfo, FCode ())
-- The Id is passed along for setting up a binding...
- -- It's already been externalised if necessary
cgTopRhs dflags _rec bndr (StgRhsCon _cc con args)
= cgTopRhsCon dflags bndr con (assertNonVoidStgArgs args)
@@ -226,25 +220,3 @@ cgDataCon data_con
}
-- The case continuation code expects a tagged pointer
}
-
----------------------------------------------------------------
--- Stuff to support splitting
----------------------------------------------------------------
-
-maybeExternaliseId :: DynFlags -> Id -> FCode Id
-maybeExternaliseId dflags id
- | gopt Opt_SplitObjs dflags, -- See Note [Externalise when splitting]
- -- in StgCmmMonad
- isInternalName name = do { mod <- getModuleName
- ; return (setIdName id (externalise mod)) }
- | otherwise = return id
- where
- externalise mod = mkExternalName uniq mod new_occ loc
- name = idName id
- uniq = nameUnique name
- new_occ = mkLocalOcc uniq (nameOccName name)
- loc = nameSrcSpan name
- -- We want to conjure up a name that can't clash with any
- -- existing name. So we generate
- -- Mod_$L243foo
- -- where 243 is the unique.
diff --git a/compiler/codeGen/StgCmmExpr.hs b/compiler/codeGen/StgCmmExpr.hs
index 7a2340ed5f..5ad2e98abc 100644
--- a/compiler/codeGen/StgCmmExpr.hs
+++ b/compiler/codeGen/StgCmmExpr.hs
@@ -758,19 +758,14 @@ cgIdApp fun_id args = do
dflags <- getDynFlags
fun_info <- getCgIdInfo fun_id
self_loop_info <- getSelfLoop
- let cg_fun_id = cg_id fun_info
- -- NB: use (cg_id fun_info) instead of fun_id, because
- -- the former may be externalised for -split-objs.
- -- See Note [Externalise when splitting] in StgCmmMonad
-
- fun_arg = StgVarArg cg_fun_id
- fun_name = idName cg_fun_id
+ let fun_arg = StgVarArg fun_id
+ fun_name = idName fun_id
fun = idInfoToAmode fun_info
lf_info = cg_lf fun_info
n_args = length args
v_args = length $ filter (isVoidTy . stgArgType) args
node_points dflags = nodeMustPointToIt dflags lf_info
- case getCallMethod dflags fun_name cg_fun_id lf_info n_args v_args (cg_loc fun_info) self_loop_info of
+ case getCallMethod dflags fun_name fun_id lf_info n_args v_args (cg_loc fun_info) self_loop_info of
-- A value in WHNF, so we can just return it.
ReturnIt
| isVoidTy (idType fun_id) -> emitReturn []
diff --git a/compiler/codeGen/StgCmmMonad.hs b/compiler/codeGen/StgCmmMonad.hs
index 9ddd8a3985..b93e0ab6eb 100644
--- a/compiler/codeGen/StgCmmMonad.hs
+++ b/compiler/codeGen/StgCmmMonad.hs
@@ -174,20 +174,10 @@ type CgBindings = IdEnv CgIdInfo
data CgIdInfo
= CgIdInfo
{ cg_id :: Id -- Id that this is the info for
- -- Can differ from the Id at occurrence sites by
- -- virtue of being externalised, for splittable C
- -- See Note [Externalise when splitting]
, cg_lf :: LambdaFormInfo
, cg_loc :: CgLoc -- CmmExpr for the *tagged* value
}
--- Note [Externalise when splitting]
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- If we're splitting the object with -fsplit-objs, we need to
--- externalise *all* the top-level names, and then make sure we only
--- use the externalised one in any C label we use which refers to this
--- name.
-
instance Outputable CgIdInfo where
ppr (CgIdInfo { cg_id = id, cg_loc = loc })
= ppr id <+> text "-->" <+> ppr loc
diff --git a/compiler/ghc.mk b/compiler/ghc.mk
index 6cfa43ac5c..64615a3c9b 100644
--- a/compiler/ghc.mk
+++ b/compiler/ghc.mk
@@ -92,8 +92,6 @@ else ifeq "$(INTEGER_LIBRARY)" "integer-simple"
else ifneq "$(CLEANING)" "YES"
$(error Unknown integer library)
endif
- @echo 'cSupportsSplitObjs :: String' >> $@
- @echo 'cSupportsSplitObjs = "$(SupportsSplitObjs)"' >> $@
@echo 'cGhcWithInterpreter :: String' >> $@
@echo 'cGhcWithInterpreter = "$(GhcWithInterpreter)"' >> $@
@echo 'cGhcWithNativeCodeGen :: String' >> $@
@@ -114,8 +112,6 @@ endif
@echo 'cLeadingUnderscore = "$(LeadingUnderscore)"' >> $@
@echo 'cGHC_UNLIT_PGM :: String' >> $@
@echo 'cGHC_UNLIT_PGM = "$(utils/unlit_dist_PROG)"' >> $@
- @echo 'cGHC_SPLIT_PGM :: String' >> $@
- @echo 'cGHC_SPLIT_PGM = "$(driver/split_dist_PROG)"' >> $@
@echo 'cLibFFI :: Bool' >> $@
ifeq "$(UseLibFFIForAdjustors)" "YES"
@echo 'cLibFFI = True' >> $@
@@ -421,9 +417,6 @@ compiler_PACKAGE = ghc
# Don't do splitting for the GHC package, it takes too long and
# there's not much benefit.
-compiler_stage1_SplitObjs = NO
-compiler_stage2_SplitObjs = NO
-compiler_stage3_SplitObjs = NO
compiler_stage1_SplitSections = NO
compiler_stage2_SplitSections = NO
compiler_stage3_SplitSections = NO
diff --git a/compiler/main/DriverPhases.hs b/compiler/main/DriverPhases.hs
index d923262987..12e12ca321 100644
--- a/compiler/main/DriverPhases.hs
+++ b/compiler/main/DriverPhases.hs
@@ -138,8 +138,6 @@ data Phase
| Cobjc -- Compile Objective-C
| Cobjcxx -- Compile Objective-C++
| HCc -- Haskellised C (as opposed to vanilla C) compilation
- | Splitter -- Assembly file splitter (part of '-split-objs')
- | SplitAs -- Assembler for split assembly files (part of '-split-objs')
| As Bool -- Assembler for regular assembly files (Bool: with-cpp)
| LlvmOpt -- Run LLVM opt tool over llvm assembly
| LlvmLlc -- LLVM bitcode to native assembly
@@ -173,8 +171,6 @@ eqPhase (Hsc _) (Hsc _) = True
eqPhase Cc Cc = True
eqPhase Cobjc Cobjc = True
eqPhase HCc HCc = True
-eqPhase Splitter Splitter = True
-eqPhase SplitAs SplitAs = True
eqPhase (As x) (As y) = x == y
eqPhase LlvmOpt LlvmOpt = True
eqPhase LlvmLlc LlvmLlc = True
@@ -218,11 +214,9 @@ nextPhase dflags p
Cpp sf -> HsPp sf
HsPp sf -> Hsc sf
Hsc _ -> maybeHCc
- Splitter -> SplitAs
LlvmOpt -> LlvmLlc
LlvmLlc -> LlvmMangle
LlvmMangle -> As False
- SplitAs -> MergeForeign
As _ -> MergeForeign
Ccxx -> As False
Cc -> As False
@@ -257,7 +251,6 @@ startPhase "M" = Cobjcxx
startPhase "mm" = Cobjcxx
startPhase "cc" = Ccxx
startPhase "cxx" = Ccxx
-startPhase "split_s" = Splitter
startPhase "s" = As False
startPhase "S" = As True
startPhase "ll" = LlvmOpt
@@ -286,13 +279,11 @@ phaseInputExt Ccxx = "cpp"
phaseInputExt Cobjc = "m"
phaseInputExt Cobjcxx = "mm"
phaseInputExt Cc = "c"
-phaseInputExt Splitter = "split_s"
phaseInputExt (As True) = "S"
phaseInputExt (As False) = "s"
phaseInputExt LlvmOpt = "ll"
phaseInputExt LlvmLlc = "bc"
phaseInputExt LlvmMangle = "lm_s"
-phaseInputExt SplitAs = "split_s"
phaseInputExt CmmCpp = "cmmcpp"
phaseInputExt Cmm = "cmm"
phaseInputExt MergeForeign = "o"
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 5fe2362973..04576e715c 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE CPP, NamedFieldPuns, NondecreasingIndentation, BangPatterns #-}
+{-# LANGUAGE CPP, NamedFieldPuns, NondecreasingIndentation, BangPatterns, MultiWayIf #-}
{-# OPTIONS_GHC -fno-cse #-}
-- -fno-cse is needed for GLOBAL_VAR's to behave properly
@@ -70,7 +70,7 @@ import System.Directory
import System.FilePath
import System.IO
import Control.Monad
-import Data.List ( isInfixOf, isSuffixOf, intercalate )
+import Data.List ( isInfixOf, intercalate )
import Data.Maybe
import Data.Version
import Data.Either ( partitionEithers )
@@ -247,7 +247,7 @@ compileOne' m_tc_result mHscMessage
src_flavour = ms_hsc_src summary
mod_name = ms_mod_name summary
- next_phase = hscPostBackendPhase dflags src_flavour hsc_lang
+ next_phase = hscPostBackendPhase src_flavour hsc_lang
object_filename = ml_obj_file location
-- #8180 - when using TemplateHaskell, switch on -dynamic-too so
@@ -505,7 +505,6 @@ compileFile hsc_env stop_phase (src, mb_phase) = do
let
dflags = hsc_dflags hsc_env
- split = gopt Opt_SplitObjs dflags
mb_o_file = outputFile dflags
ghc_link = ghcLink dflags -- Set by -c or -no-link
@@ -522,11 +521,7 @@ compileFile hsc_env stop_phase (src, mb_phase) = do
-- -o foo applies to the file we are compiling now
| otherwise = Persistent
- stop_phase' = case stop_phase of
- As _ | split -> SplitAs
- _ -> stop_phase
-
- ( _, out_file) <- runPipeline stop_phase' hsc_env
+ ( _, out_file) <- runPipeline stop_phase hsc_env
(src, fmap RealPhase mb_phase) Nothing output
Nothing{-no ModLocation-} []
return out_file
@@ -1085,7 +1080,7 @@ runPhase (HscOut src_flavour mod_name result) _ dflags = do
let o_file = ml_obj_file location -- The real object file
hsc_lang = hscTarget dflags
- next_phase = hscPostBackendPhase dflags src_flavour hsc_lang
+ next_phase = hscPostBackendPhase src_flavour hsc_lang
case result of
HscNotGeneratingCode ->
@@ -1138,7 +1133,7 @@ runPhase (RealPhase Cmm) input_fn dflags
= do
let hsc_lang = hscTarget dflags
- let next_phase = hscPostBackendPhase dflags HsSrcFile hsc_lang
+ let next_phase = hscPostBackendPhase HsSrcFile hsc_lang
output_fn <- phaseOutputFilename next_phase
@@ -1281,40 +1276,9 @@ runPhase (RealPhase cc_phase) input_fn dflags
return (RealPhase next_phase, output_fn)
-----------------------------------------------------------------------------
--- Splitting phase
-
-runPhase (RealPhase Splitter) input_fn dflags
- = do -- tmp_pfx is the prefix used for the split .s files
-
- split_s_prefix <-
- liftIO $ newTempName dflags TFL_CurrentModule "split"
- let n_files_fn = split_s_prefix
-
- liftIO $ SysTools.runSplit dflags
- [ SysTools.FileOption "" input_fn
- , SysTools.FileOption "" split_s_prefix
- , SysTools.FileOption "" n_files_fn
- ]
-
- -- Save the number of split files for future references
- s <- liftIO $ readFile n_files_fn
- let n_files = read s :: Int
- dflags' = dflags { splitInfo = Just (split_s_prefix, n_files) }
-
- setDynFlags dflags'
-
- -- Remember to delete all these files
- liftIO $ addFilesToClean dflags' TFL_CurrentModule $
- [ split_s_prefix ++ "__" ++ show n ++ ".s"
- | n <- [1..n_files]]
-
- return (RealPhase SplitAs,
- "**splitter**") -- we don't use the filename in SplitAs
-
------------------------------------------------------------------------------
-- As, SpitAs phase : Assembler
--- This is for calling the assembler on a regular assembly file (not split).
+-- This is for calling the assembler on a regular assembly file
runPhase (RealPhase (As with_cpp)) input_fn dflags
= do
-- LLVM from version 3.0 onwards doesn't support the OS X system
@@ -1379,96 +1343,6 @@ runPhase (RealPhase (As with_cpp)) input_fn dflags
return (RealPhase next_phase, output_fn)
--- This is for calling the assembler on a split assembly file (so a collection
--- of assembly files)
-runPhase (RealPhase SplitAs) _input_fn dflags
- = do
- -- we'll handle the stub_o file in this phase, so don't MergeForeign,
- -- just jump straight to StopLn afterwards.
- let next_phase = StopLn
- output_fn <- phaseOutputFilename next_phase
-
- let base_o = dropExtension output_fn
- osuf = objectSuf dflags
- split_odir = base_o ++ "_" ++ osuf ++ "_split"
-
- let pic_c_flags = picCCOpts dflags
-
- -- this also creates the hierarchy
- liftIO $ createDirectoryIfMissing True split_odir
-
- -- remove M_split/ *.o, because we're going to archive M_split/ *.o
- -- later and we don't want to pick up any old objects.
- fs <- liftIO $ getDirectoryContents split_odir
- liftIO $ mapM_ removeFile $
- map (split_odir </>) $ filter (osuf `isSuffixOf`) fs
-
- let (split_s_prefix, n) = case splitInfo dflags of
- Nothing -> panic "No split info"
- Just x -> x
-
- let split_s n = split_s_prefix ++ "__" ++ show n <.> "s"
-
- split_obj :: Int -> FilePath
- split_obj n = split_odir </>
- takeFileName base_o ++ "__" ++ show n <.> osuf
-
- let assemble_file n
- = SysTools.runAs dflags (
-
- -- We only support SparcV9 and better because V8 lacks an atomic CAS
- -- instruction so we have to make sure that the assembler accepts the
- -- instruction set. Note that the user can still override this
- -- (e.g., -mcpu=ultrasparc). GCC picks the "best" -mcpu flag
- -- regardless of the ordering.
- --
- -- This is a temporary hack.
- (if platformArch (targetPlatform dflags) == ArchSPARC
- then [SysTools.Option "-mcpu=v9"]
- else []) ++
-
- -- See Note [-fPIC for assembler]
- map SysTools.Option pic_c_flags ++
-
- [ SysTools.Option "-c"
- , SysTools.Option "-o"
- , SysTools.FileOption "" (split_obj n)
- , SysTools.FileOption "" (split_s n)
- ])
-
- liftIO $ mapM_ assemble_file [1..n]
-
- -- Note [pipeline-split-init]
- -- If we have a stub file -- which will be part of foreign_os --
- -- it may contain constructor
- -- functions for initialisation of this module. We can't
- -- simply leave the stub as a separate object file, because it
- -- will never be linked in: nothing refers to it. We need to
- -- ensure that if we ever refer to the data in this module
- -- that needs initialisation, then we also pull in the
- -- initialisation routine.
- --
- -- To that end, we make a DANGEROUS ASSUMPTION here: the data
- -- that needs to be initialised is all in the FIRST split
- -- object. See Note [codegen-split-init].
- --
- -- We also merge in all the foreign objects since we're at it.
-
- PipeState{foreign_os} <- getPipeState
- if null foreign_os
- then return ()
- else liftIO $ do
- tmp_split_1 <- newTempName dflags TFL_CurrentModule osuf
- let split_1 = split_obj 1
- copyFile split_1 tmp_split_1
- removeFile split_1
- joinObjectFiles dflags (tmp_split_1 : foreign_os) split_1
-
- -- join them into a single .o file
- liftIO $ joinObjectFiles dflags (map split_obj [1..n]) output_fn
-
- return (RealPhase next_phase, output_fn)
-
-----------------------------------------------------------------------------
-- LlvmOpt phase
runPhase (RealPhase LlvmOpt) input_fn dflags
@@ -1510,13 +1384,10 @@ runPhase (RealPhase LlvmOpt) input_fn dflags
runPhase (RealPhase LlvmLlc) input_fn dflags
= do
- next_phase <- if fastLlvmPipeline dflags
- then maybeMergeForeign
- -- hidden debugging flag '-dno-llvm-mangler' to skip mangling
- else case gopt Opt_NoLlvmMangler dflags of
- False -> return LlvmMangle
- True | gopt Opt_SplitObjs dflags -> return Splitter
- True -> return (As False)
+ next_phase <- if | fastLlvmPipeline dflags -> maybeMergeForeign
+ -- hidden debugging flag '-dno-llvm-mangler' to skip mangling
+ | gopt Opt_NoLlvmMangler dflags -> return (As False)
+ | otherwise -> return LlvmMangle
output_fn <- phaseOutputFilename next_phase
@@ -1588,7 +1459,7 @@ runPhase (RealPhase LlvmLlc) input_fn dflags
runPhase (RealPhase LlvmMangle) input_fn dflags
= do
- let next_phase = if gopt Opt_SplitObjs dflags then Splitter else As False
+ let next_phase = As False
output_fn <- phaseOutputFilename next_phase
liftIO $ llvmFixupAsm dflags input_fn output_fn
return (RealPhase next_phase, output_fn)
@@ -2271,14 +2142,13 @@ sourceModified dest_file src_timestamp = do
return (t2 <= src_timestamp)
-- | What phase to run after one of the backend code generators has run
-hscPostBackendPhase :: DynFlags -> HscSource -> HscTarget -> Phase
-hscPostBackendPhase _ HsBootFile _ = StopLn
-hscPostBackendPhase _ HsigFile _ = StopLn
-hscPostBackendPhase dflags _ hsc_lang =
+hscPostBackendPhase :: HscSource -> HscTarget -> Phase
+hscPostBackendPhase HsBootFile _ = StopLn
+hscPostBackendPhase HsigFile _ = StopLn
+hscPostBackendPhase _ hsc_lang =
case hsc_lang of
- HscC -> HCc
- HscAsm | gopt Opt_SplitObjs dflags -> Splitter
- | otherwise -> As False
+ HscC -> HCc
+ HscAsm -> As False
HscLlvm -> LlvmOpt
HscNothing -> StopLn
HscInterpreted -> StopLn
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index d29fa4a9f9..b3cfa4860e 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -90,7 +90,7 @@ module DynFlags (
ghcUsagePath, ghciUsagePath, topDir, tmpDir, rawSettings,
versionedAppDir,
extraGccViaCFlags, systemPackageConfig,
- pgm_L, pgm_P, pgm_F, pgm_c, pgm_s, pgm_a, pgm_l, pgm_dll, pgm_T,
+ pgm_L, pgm_P, pgm_F, pgm_c, pgm_a, pgm_l, pgm_dll, pgm_T,
pgm_windres, pgm_libtool, pgm_ar, pgm_ranlib, pgm_lo, pgm_lc,
pgm_lcc, pgm_i, opt_L, opt_P, opt_F, opt_c, opt_a, opt_l, opt_i,
opt_P_signature,
@@ -526,7 +526,6 @@ data GeneralFlag
| Opt_ExcessPrecision
| Opt_EagerBlackHoling
| Opt_NoHsMain
- | Opt_SplitObjs
| Opt_SplitSections
| Opt_StgStats
| Opt_HideAllPackages
@@ -1322,7 +1321,6 @@ data Settings = Settings {
sPgm_P :: (String,[Option]),
sPgm_F :: String,
sPgm_c :: (String,[Option]),
- sPgm_s :: (String,[Option]),
sPgm_a :: (String,[Option]),
sPgm_l :: (String,[Option]),
sPgm_dll :: (String,[Option]),
@@ -1383,8 +1381,6 @@ pgm_F :: DynFlags -> String
pgm_F dflags = sPgm_F (settings dflags)
pgm_c :: DynFlags -> (String,[Option])
pgm_c dflags = sPgm_c (settings dflags)
-pgm_s :: DynFlags -> (String,[Option])
-pgm_s dflags = sPgm_s (settings dflags)
pgm_a :: DynFlags -> (String,[Option])
pgm_a dflags = sPgm_a (settings dflags)
pgm_l :: DynFlags -> (String,[Option])
@@ -1746,13 +1742,10 @@ wayUnsetGeneralFlags :: Platform -> Way -> [GeneralFlag]
wayUnsetGeneralFlags _ (WayCustom {}) = []
wayUnsetGeneralFlags _ WayThreaded = []
wayUnsetGeneralFlags _ WayDebug = []
-wayUnsetGeneralFlags _ WayDyn = [-- There's no point splitting objects
+wayUnsetGeneralFlags _ WayDyn = [-- There's no point splitting
-- when we're going to be dynamically
-- linking. Plus it breaks compilation
-- on OSX x86.
- Opt_SplitObjs,
- -- If splitobjs wasn't useful for this,
- -- assume sections aren't either.
Opt_SplitSections]
wayUnsetGeneralFlags _ WayProf = []
wayUnsetGeneralFlags _ WayEventLog = []
@@ -3015,7 +3008,7 @@ dynamic_flags_deps = [
-- (see Trac #15319)
sGccSupportsNoPie = False})))
, make_ord_flag defFlag "pgms"
- (hasArg (\f -> alterSettings (\s -> s { sPgm_s = (f,[])})))
+ (HasArg (\_ -> addWarn "Object splitting was removed in GHC 8.8"))
, make_ord_flag defFlag "pgma"
(hasArg (\f -> alterSettings (\s -> s { sPgm_a = (f,[])})))
, make_ord_flag defFlag "pgml"
@@ -3056,9 +3049,7 @@ dynamic_flags_deps = [
alterSettings (\s -> s { sOpt_windres = f : sOpt_windres s})))
, make_ord_flag defGhcFlag "split-objs"
- (NoArg (if can_split
- then setGeneralFlag Opt_SplitObjs
- else addWarn "ignoring -split-objs"))
+ (NoArg $ addWarn "ignoring -split-objs")
, make_ord_flag defGhcFlag "split-sections"
(noArgM (\dflags -> do
@@ -5588,12 +5579,6 @@ picPOpts dflags
| otherwise = []
-- -----------------------------------------------------------------------------
--- Splitting
-
-can_split :: Bool
-can_split = cSupportsSplitObjs == "YES"
-
--- -----------------------------------------------------------------------------
-- Compiler Info
compilerInfo :: DynFlags -> [(String, String)]
@@ -5615,7 +5600,7 @@ compilerInfo dflags
("Host platform", cHostPlatformString),
("Target platform", cTargetPlatformString),
("Have interpreter", cGhcWithInterpreter),
- ("Object splitting supported", cSupportsSplitObjs),
+ ("Object splitting supported", showBool False),
("Have native code generator", cGhcWithNativeCodeGen),
("Support SMP", cGhcWithSMP),
("Tables next to code", cGhcEnableTablesNextToCode),
diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs
index bb16ae361d..16c8db94d9 100644
--- a/compiler/main/HscMain.hs
+++ b/compiler/main/HscMain.hs
@@ -1494,7 +1494,7 @@ doCodeGen hsc_env this_mod data_tycons
-- we generate one SRT for the whole module.
let
pipeline_stream
- | gopt Opt_SplitObjs dflags || gopt Opt_SplitSections dflags ||
+ | gopt Opt_SplitSections dflags ||
osSubsectionsViaSymbols (platformOS (targetPlatform dflags))
= {-# SCC "cmmPipeline" #-}
let run_pipeline us cmmgroup = do
diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs
index 9bbce19602..543dd9ce3b 100644
--- a/compiler/main/SysTools.hs
+++ b/compiler/main/SysTools.hs
@@ -139,7 +139,7 @@ initSysTools top_dir
-- NB: top_dir is assumed to be in standard Unix
-- format, '/' separated
mtool_dir <- findToolDir top_dir
- -- see Note [tooldir: How GHC finds mingw and perl on Windows]
+ -- see Note [tooldir: How GHC finds mingw on Windows]
let installed :: FilePath -> FilePath
installed file = top_dir </> file
@@ -212,7 +212,6 @@ initSysTools top_dir
ldSupportsBuildId <- getBooleanSetting "ld supports build-id"
ldSupportsFilelist <- getBooleanSetting "ld supports filelist"
ldIsGnuLd <- getBooleanSetting "ld is GNU ld"
- perl_path <- getToolSetting "perl command"
let pkgconfig_path = installed "package.conf.d"
ghc_usage_msg_path = installed "ghc-usage.txt"
@@ -222,9 +221,6 @@ initSysTools top_dir
-- architecture-specific stuff is done when building Config.hs
unlit_path = libexec cGHC_UNLIT_PGM
- -- split is a Perl script
- split_script = libexec cGHC_SPLIT_PGM
-
windres_path <- getToolSetting "windres command"
libtool_path <- getToolSetting "libtool command"
ar_path <- getToolSetting "ar command"
@@ -234,15 +230,6 @@ initSysTools top_dir
touch_path <- getToolSetting "touch command"
- let -- On Win32 we don't want to rely on #!/bin/perl, so we prepend
- -- a call to Perl to get the invocation of split.
- -- On Unix, scripts are invoked using the '#!' method. Binary
- -- installations of GHC on Unix place the correct line on the
- -- front of the script at installation time, so we don't want
- -- to wire-in our knowledge of $(PERL) on the host system here.
- (split_prog, split_args)
- | isWindowsHost = (perl_path, [Option split_script])
- | otherwise = (split_script, [])
mkdll_prog <- getToolSetting "dllwrap command"
let mkdll_args = []
@@ -297,7 +284,6 @@ initSysTools top_dir
sPgm_P = (cpp_prog, cpp_args),
sPgm_F = "",
sPgm_c = (gcc_prog, gcc_args),
- sPgm_s = (split_prog,split_args),
sPgm_a = (as_prog, as_args),
sPgm_l = (ld_prog, ld_args),
sPgm_dll = (mkdll_prog,mkdll_args),
diff --git a/compiler/main/SysTools/BaseDir.hs b/compiler/main/SysTools/BaseDir.hs
index 786b0e4ee9..d01d5214b4 100644
--- a/compiler/main/SysTools/BaseDir.hs
+++ b/compiler/main/SysTools/BaseDir.hs
@@ -68,7 +68,7 @@ On Windows:
from topdir we can find package.conf, ghc-asm, etc.
-Note [tooldir: How GHC finds mingw and perl on Windows]
+Note [tooldir: How GHC finds mingw on Windows]
GHC has some custom logic on Windows for finding the mingw
toolchain and perl. Depending on whether GHC is built
diff --git a/compiler/main/SysTools/Tasks.hs b/compiler/main/SysTools/Tasks.hs
index a986db2fc0..9e3df26877 100644
--- a/compiler/main/SysTools/Tasks.hs
+++ b/compiler/main/SysTools/Tasks.hs
@@ -131,11 +131,6 @@ askLd dflags args = do
runSomethingWith dflags "gcc" p args2 $ \real_args ->
readCreateProcessWithExitCode' (proc p real_args){ env = mb_env }
-runSplit :: DynFlags -> [Option] -> IO ()
-runSplit dflags args = do
- let (p,args0) = pgm_s dflags
- runSomething dflags "Splitter" p (args0++args)
-
runAs :: DynFlags -> [Option] -> IO ()
runAs dflags args = do
let (p,args0) = pgm_a dflags
diff --git a/compiler/nativeGen/AsmCodeGen.hs b/compiler/nativeGen/AsmCodeGen.hs
index 4672415ec5..b866741995 100644
--- a/compiler/nativeGen/AsmCodeGen.hs
+++ b/compiler/nativeGen/AsmCodeGen.hs
@@ -335,7 +335,7 @@ finishNativeGen :: Instruction instr
finishNativeGen dflags modLoc bufh@(BufHandle _ _ h) us ngs
= do
-- Write debug data and finish
- let emitDw = debugLevel dflags > 0 && not (gopt Opt_SplitObjs dflags)
+ let emitDw = debugLevel dflags > 0
us' <- if not emitDw then return us else do
(dwarf, us') <- dwarfGen dflags modLoc us (ngs_debug ngs)
emitNativeCode dflags bufh dwarf
@@ -406,14 +406,9 @@ cmmNativeGenStream dflags this_mod modLoc ncgImpl h us cmm_stream ngs
| otherwise = []
dbgMap = debugToMap ndbgs
- -- Insert split marker, generate native code
- let splitObjs = gopt Opt_SplitObjs dflags
- split_marker = CmmProc mapEmpty mkSplitMarkerLabel [] $
- ofBlockList (panic "split_marker_entry") []
- cmms' | splitObjs = split_marker : cmms
- | otherwise = cmms
+ -- Generate native code
(ngs',us') <- cmmNativeGens dflags this_mod modLoc ncgImpl h
- dbgMap us cmms' ngs 0
+ dbgMap us cmms ngs 0
-- Link native code information into debug blocks
-- See Note [What is this unwinding business?] in Debug.
@@ -421,23 +416,10 @@ cmmNativeGenStream dflags this_mod modLoc ncgImpl h us cmm_stream ngs
dumpIfSet_dyn dflags Opt_D_dump_debug "Debug Infos"
(vcat $ map ppr ldbgs)
- -- Emit & clear DWARF information when generating split
- -- object files, as we need it to land in the same object file
- -- When using split sections, note that we do not split the debug
- -- info but emit all the info at once in finishNativeGen.
- (ngs'', us'') <-
- if debugFlag && splitObjs
- then do (dwarf, us'') <- dwarfGen dflags modLoc us ldbgs
- emitNativeCode dflags h dwarf
- return (ngs' { ngs_debug = []
- , ngs_dwarfFiles = emptyUFM
- , ngs_labels = [] },
- us'')
- else return (ngs' { ngs_debug = ngs_debug ngs' ++ ldbgs
- , ngs_labels = [] },
- us')
-
- cmmNativeGenStream dflags this_mod modLoc ncgImpl h us''
+ -- Accumulate debug information for emission in finishNativeGen.
+ let ngs'' = ngs' { ngs_debug = ngs_debug ngs' ++ ldbgs, ngs_labels = [] }
+
+ cmmNativeGenStream dflags this_mod modLoc ncgImpl h us'
cmm_stream' ngs''
-- | Do native code generation on all these cmms.
diff --git a/compiler/nativeGen/CFG.hs b/compiler/nativeGen/CFG.hs
index 155e5bcac4..af0c6da455 100644
--- a/compiler/nativeGen/CFG.hs
+++ b/compiler/nativeGen/CFG.hs
@@ -483,12 +483,7 @@ addNodesBetween m updates =
-- | Generate weights for a Cmm proc based on some simple heuristics.
getCfgProc :: D.CfgWeights -> RawCmmDecl -> CFG
getCfgProc _ (CmmData {}) = mapEmpty
--- Sometimes GHC generates dummy procs which don't actually contain code.
--- But they might contain bottoms in some fields so we check for an empty
--- body first. In particular this happens with SplitObjs enabled.
-getCfgProc weights (CmmProc _info _lab _live graph)
- | null (toBlockList graph) = mapEmpty
- | otherwise = getCfg weights graph
+getCfgProc weights (CmmProc _info _lab _live graph) = getCfg weights graph
getCfg :: D.CfgWeights -> CmmGraph -> CFG
getCfg weights graph =
diff --git a/compiler/nativeGen/PIC.hs b/compiler/nativeGen/PIC.hs
index 280a87e786..b4bf8998d1 100644
--- a/compiler/nativeGen/PIC.hs
+++ b/compiler/nativeGen/PIC.hs
@@ -563,8 +563,6 @@ pprGotDeclaration _ _ _
-- For each processor architecture, there are two versions, one for PIC
-- and one for non-PIC.
--
--- Whenever you change something in this assembler output, make sure
--- the splitter in driver/split/ghc-split.pl recognizes the new output
pprImportedSymbol :: DynFlags -> Platform -> CLabel -> SDoc
pprImportedSymbol dflags platform@(Platform { platformArch = ArchX86, platformOS = OSDarwin }) importedLbl
diff --git a/compiler/nativeGen/PPC/Ppr.hs b/compiler/nativeGen/PPC/Ppr.hs
index c54d4430eb..c9d5c2df18 100644
--- a/compiler/nativeGen/PPC/Ppr.hs
+++ b/compiler/nativeGen/PPC/Ppr.hs
@@ -49,17 +49,14 @@ pprNatCmmDecl proc@(CmmProc top_info lbl _ (ListGraph blocks)) =
case topInfoTable proc of
Nothing ->
sdocWithPlatform $ \platform ->
- case blocks of
- [] -> -- special case for split markers:
- pprLabel lbl
- blocks -> -- special case for code without info table:
- pprSectionAlign (Section Text lbl) $$
- (case platformArch platform of
- ArchPPC_64 ELF_V1 -> pprFunctionDescriptor lbl
- ArchPPC_64 ELF_V2 -> pprFunctionPrologue lbl
- _ -> pprLabel lbl) $$ -- blocks guaranteed not null,
+ -- special case for code without info table:
+ pprSectionAlign (Section Text lbl) $$
+ (case platformArch platform of
+ ArchPPC_64 ELF_V1 -> pprFunctionDescriptor lbl
+ ArchPPC_64 ELF_V2 -> pprFunctionPrologue lbl
+ _ -> pprLabel lbl) $$ -- blocks guaranteed not null,
-- so label needed
- vcat (map (pprBasicBlock top_info) blocks)
+ vcat (map (pprBasicBlock top_info) blocks)
Just (Statics info_lbl _) ->
sdocWithPlatform $ \platform ->
diff --git a/compiler/nativeGen/RegAlloc/Liveness.hs b/compiler/nativeGen/RegAlloc/Liveness.hs
index 065231faf3..3ad01c6d7c 100644
--- a/compiler/nativeGen/RegAlloc/Liveness.hs
+++ b/compiler/nativeGen/RegAlloc/Liveness.hs
@@ -504,10 +504,6 @@ stripLive dflags live
in CmmProc info label live
(ListGraph $ map (stripLiveBlock dflags) $ first' : rest')
- -- procs used for stg_split_markers don't contain any blocks, and have no first_id.
- stripCmm (CmmProc (LiveInfo info [] _ _) label live [])
- = CmmProc info label live (ListGraph [])
-
-- If the proc has blocks but we don't know what the first one was, then we're dead.
stripCmm proc
= pprPanic "RegAlloc.Liveness.stripLive: no first_id on proc" (ppr proc)
diff --git a/compiler/nativeGen/SPARC/Ppr.hs b/compiler/nativeGen/SPARC/Ppr.hs
index 42ba13def4..d367b0726a 100644
--- a/compiler/nativeGen/SPARC/Ppr.hs
+++ b/compiler/nativeGen/SPARC/Ppr.hs
@@ -60,13 +60,10 @@ pprNatCmmDecl (CmmData section dats) =
pprNatCmmDecl proc@(CmmProc top_info lbl _ (ListGraph blocks)) =
case topInfoTable proc of
Nothing ->
- case blocks of
- [] -> -- special case for split markers:
- pprLabel lbl
- blocks -> -- special case for code without info table:
- pprSectionAlign (Section Text lbl) $$
- pprLabel lbl $$ -- blocks guaranteed not null, so label needed
- vcat (map (pprBasicBlock top_info) blocks)
+ -- special case for code without info table:
+ pprSectionAlign (Section Text lbl) $$
+ pprLabel lbl $$ -- blocks guaranteed not null, so label needed
+ vcat (map (pprBasicBlock top_info) blocks)
Just (Statics info_lbl _) ->
sdocWithPlatform $ \platform ->
diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs
index 83356758af..2d099f9854 100644
--- a/compiler/nativeGen/X86/Ppr.hs
+++ b/compiler/nativeGen/X86/Ppr.hs
@@ -83,17 +83,14 @@ pprNatCmmDecl proc@(CmmProc top_info lbl _ (ListGraph blocks)) =
pprProcAlignment $$
case topInfoTable proc of
Nothing ->
- case blocks of
- [] -> -- special case for split markers:
- pprLabel lbl
- blocks -> -- special case for code without info table:
- pprSectionAlign (Section Text lbl) $$
- pprProcAlignment $$
- pprLabel lbl $$ -- blocks guaranteed not null, so label needed
- vcat (map (pprBasicBlock top_info) blocks) $$
- (if debugLevel dflags > 0
- then ppr (mkAsmTempEndLabel lbl) <> char ':' else empty) $$
- pprSizeDecl lbl
+ -- special case for code without info table:
+ pprSectionAlign (Section Text lbl) $$
+ pprProcAlignment $$
+ pprLabel lbl $$ -- blocks guaranteed not null, so label needed
+ vcat (map (pprBasicBlock top_info) blocks) $$
+ (if debugLevel dflags > 0
+ then ppr (mkAsmTempEndLabel lbl) <> char ':' else empty) $$
+ pprSizeDecl lbl
Just (Statics info_lbl _) ->
sdocWithPlatform $ \platform ->