Commit 37f257af authored by Ben Gamari's avatar Ben Gamari 🐢 Committed by Marge Bot

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
parent 646b6dfb
Pipeline #3145 passed with stages
in 350 minutes and 29 seconds
......@@ -68,7 +68,6 @@ _darcs/
/driver/ghc/dist/
/driver/haddock/dist/
/driver/ghci/dist/
/driver/split/dist/
/includes/dist-*/
/libffi/dist-install/
/libraries/*/dist-boot/
......
......@@ -476,7 +476,6 @@ AC_DEFUN([FP_SETTINGS],
SettingsLdCommand="\$tooldir/${mingw_bin_prefix}ld.exe"
SettingsArCommand="\$tooldir/${mingw_bin_prefix}ar.exe"
SettingsRanlibCommand="\$tooldir/${mingw_bin_prefix}ranlib.exe"
SettingsPerlCommand='$tooldir/perl/perl.exe'
SettingsDllWrapCommand="\$tooldir/${mingw_bin_prefix}dllwrap.exe"
SettingsWindresCommand="\$tooldir/${mingw_bin_prefix}windres.exe"
SettingsTouchCommand='$topdir/bin/touchy.exe'
......@@ -488,7 +487,6 @@ AC_DEFUN([FP_SETTINGS],
SettingsHaskellCPPFlags="$HaskellCPPArgs"
SettingsLdCommand="$(basename $LdCmd)"
SettingsArCommand="$(basename $ArCmd)"
SettingsPerlCommand="$(basename $PerlCmd)"
SettingsDllWrapCommand="$(basename $DllWrapCmd)"
SettingsWindresCommand="$(basename $WindresCmd)"
SettingsTouchCommand='$topdir/bin/touchy.exe'
......@@ -499,7 +497,6 @@ AC_DEFUN([FP_SETTINGS],
SettingsLdCommand="$LdCmd"
SettingsArCommand="$ArCmd"
SettingsRanlibCommand="$RanlibCmd"
SettingsPerlCommand="$PerlCmd"
if test -z "$DllWrapCmd"
then
SettingsDllWrapCommand="/bin/false"
......@@ -552,7 +549,6 @@ AC_DEFUN([FP_SETTINGS],
AC_SUBST(SettingsLdFlags)
AC_SUBST(SettingsArCommand)
AC_SUBST(SettingsRanlibCommand)
AC_SUBST(SettingsPerlCommand)
AC_SUBST(SettingsDllWrapCommand)
AC_SUBST(SettingsWindresCommand)
AC_SUBST(SettingsLibtoolCommand)
......@@ -1327,22 +1323,6 @@ AC_DEFUN([FP_GCC_SUPPORTS_NO_PIE],
rm -f conftest.c conftest.o conftest
])
dnl Small feature test for perl version. Assumes PerlCmd
dnl contains path to perl binary.
dnl
dnl (Perl versions prior to v5.6 does not contain the string "v5";
dnl instead they display version strings such as "version 5.005".)
dnl
AC_DEFUN([FPTOOLS_CHECK_PERL_VERSION],
[$PerlCmd -v >conftest.out 2>&1
if grep "v5" conftest.out >/dev/null 2>&1; then
:
else
AC_MSG_ERROR([your version of perl probably won't work, try upgrading it.])
fi
rm -fr conftest*
])
# FP_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR,
# [VALUE-IF-NOT-FOUND], [PATH], [REJECT])
......
......@@ -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
......
......@@ -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.
......@@ -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 []
......
......@@ -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
......
......@@ -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
......
......@@ -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"
......
This diff is collapsed.
......@@ -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
......@@ -5587,12 +5578,6 @@ picPOpts dflags
| gopt Opt_PIC dflags = ["-U__PIC__", "-D__PIC__"]
| otherwise = []
-- -----------------------------------------------------------------------------
-- Splitting
can_split :: Bool
can_split = cSupportsSplitObjs == "YES"
-- -----------------------------------------------------------------------------
-- Compiler Info
......@@ -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),
......
......@@ -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
......
......@@ -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),
......
......@@ -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
......
......@@ -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
......
......@@ -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.
......
......@@ -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 =
......
......@@ -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
......
......@@ -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 ->
......
......@@ -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)
......
......@@ -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 ->
......
......@@ -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 ->
......
......@@ -386,20 +386,6 @@ then
fp_prog_ar="${mingwbin}ar.exe"
AC_PATH_PROG([Genlib],[genlib])
# NB. Download the perl binaries if required
if ! test -d inplace/perl ||
test inplace/perl -ot ghc-tarballs/perl/ghc-perl*.tar.gz
then
AC_MSG_NOTICE([Making in-tree perl tree])
rm -rf inplace/perl
mkdir inplace/perl
(
cd inplace/perl &&
tar -zxf ../../ghc-tarballs/perl/ghc-perl*.tar.gz
)
AC_MSG_NOTICE([In-tree perl tree created])
fi
fi
# We don't want to bundle a MinGW-w64 toolchain
......@@ -696,36 +682,6 @@ AC_SUBST([GhcLibsWithUnix])
dnl ** does #! work?
AC_SYS_INTERPRETER()
# Check for split-objs
SplitObjsBroken=NO
dnl ** look for `perl'
case $HostOS_CPP in
cygwin32|mingw32)
if test "$EnableDistroToolchain" = "NO"; then
PerlCmd=$hardtop/inplace/perl/perl
else
AC_PATH_PROG([PerlCmd],[perl])
fi
# because of Trac #15051 SplitObjs is useless on Windows. It regresses
# build times to days for a build, and this effect is also there for end users
# of GHC. So unfortunately we have to disable it, even without having
# split-sections. Though the compile time hit for split-sections should be
# tiny compared to this so maybe we should enable it for x86_64.
SplitObjsBroken=YES
;;
*)
AC_PATH_PROG([PerlCmd],[perl])
if test -z "$PerlCmd"
then
AC_MSG_WARN([No Perl on PATH, disabling split object support])
SplitObjsBroken=YES
else
FPTOOLS_CHECK_PERL_VERSION
fi
;;
esac
AC_SUBST([SplitObjsBroken])
dnl ** look for GCC and find out which version
dnl Figure out which C compiler to use. Gcc is preferred.
dnl If gcc, make sure it's at least 3.0
......@@ -1391,7 +1347,6 @@ echo "\
genlib : $GenlibCmd
Happy : $HappyCmd ($HappyVersion)
Alex : $AlexCmd ($AlexVersion)
Perl : $PerlCmd
sphinx-build : $SPHINXBUILD
xelatex : $XELATEX
......
......@@ -35,7 +35,6 @@ if [ ! -f b1-stamp ]; then
echo "GhcUnregisterised = YES" >> mk/build.mk
echo "GhcLibHcOpts = -O -H32m -fvia-C -keep-hc-files" >> mk/build.mk
echo "GhcLibWays =" >> mk/build.mk
echo "SplitObjs = NO" >> mk/build.mk
# We could optimise slightly by not building hslibs here. Also, building
# the RTS is not necessary (and might not be desirable if we're using
......
......@@ -32,7 +32,6 @@ cat >>mk/build.mk <<END
GhcUnregisterised=YES
GhcWithInterpreter=NO
GhcWithNativeCodeGen=NO
SplitObjs=NO
GhcLibWays=
GhcWithSMP=NO
END
......
......@@ -173,7 +173,6 @@ Installing the GHC is done as follows:
\begin{code}
./fptools/mk vi build.mk
GhcHcOpts = -O -fasm -Rghc-timing
SplitObjs = NO
GhcRtsHcOpts =
GhcRtsCcOpts = -g
STRIP_CMD =:
......
......@@ -92,6 +92,11 @@ Compiler
taking advantage of :extension:`DerivingStrategies`. The warning is supplied at each
``deriving`` site.