Commit cd33eefd authored by ian@well-typed.com's avatar ian@well-typed.com
Browse files

Some alpha renaming

Mostly d -> g (matching DynFlag -> GeneralFlag).
Also renamed if* to when*, matching the Haskell if/when names
parent 6759e5a4
......@@ -466,7 +466,7 @@ pprExternal sty uniq mod occ name is_wired is_builtin
| otherwise = pprModulePrefix sty mod name <> ppr_occ_name occ
where
pp_mod = sdocWithDynFlags $ \dflags ->
if dopt Opt_SuppressModulePrefixes dflags
if gopt Opt_SuppressModulePrefixes dflags
then empty
else ppr mod <> dot
......@@ -496,7 +496,7 @@ pprModulePrefix :: PprStyle -> Module -> Name -> SDoc
-- Print the "M." part of a name, based on whether it's in scope or not
-- See Note [Printing original names] in HscTypes
pprModulePrefix sty mod name = sdocWithDynFlags $ \dflags ->
if dopt Opt_SuppressModulePrefixes dflags
if gopt Opt_SuppressModulePrefixes dflags
then empty
else
case qualName sty name of -- See Outputable.QualifyName:
......@@ -511,7 +511,7 @@ ppr_underscore_unique :: Unique -> SDoc
-- But suppress it if we aren't printing the uniques anyway
ppr_underscore_unique uniq
= sdocWithDynFlags $ \dflags ->
if dopt Opt_SuppressUniques dflags
if gopt Opt_SuppressUniques dflags
then empty
else char '_' <> pprUnique uniq
......
......@@ -272,7 +272,7 @@ pprOccName (OccName sp occ)
| otherwise = empty
pp_occ = sdocWithDynFlags $ \dflags ->
if dopt Opt_SuppressUniques dflags
if gopt Opt_SuppressUniques dflags
then text (strip_th_unique (unpackFS occ))
else ftext occ
......
......@@ -215,7 +215,7 @@ After CoreTidy, top-level LocalIds are turned into GlobalIds
instance Outputable Var where
ppr var = ppr (varName var) <+> ifPprDebug (brackets (ppr_debug var))
-- Printing the type on every occurrence is too much!
-- <+> if (not (dopt Opt_SuppressVarKinds dflags))
-- <+> if (not (gopt Opt_SuppressVarKinds dflags))
-- then ifPprDebug (text "::" <+> ppr (tyVarKind var) <+> text ")")
-- else empty
......
......@@ -819,7 +819,7 @@ labelDynamic :: DynFlags -> PackageId -> CLabel -> Bool
labelDynamic dflags this_pkg lbl =
case lbl of
-- is the RTS in a DLL or not?
RtsLabel _ -> not (dopt Opt_Static dflags) && (this_pkg /= rtsPackageId)
RtsLabel _ -> not (gopt Opt_Static dflags) && (this_pkg /= rtsPackageId)
IdLabel n _ _ -> isDllName dflags this_pkg n
......@@ -827,7 +827,7 @@ labelDynamic dflags this_pkg lbl =
-- its own shared library.
CmmLabel pkg _ _
| os == OSMinGW32 ->
not (dopt Opt_Static dflags) && (this_pkg /= pkg)
not (gopt Opt_Static dflags) && (this_pkg /= pkg)
| otherwise ->
True
......@@ -845,14 +845,14 @@ labelDynamic dflags this_pkg lbl =
-- When compiling in the "dyn" way, each package is to be
-- linked into its own DLL.
ForeignLabelInPackage pkgId ->
(not (dopt Opt_Static dflags)) && (this_pkg /= pkgId)
(not (gopt Opt_Static dflags)) && (this_pkg /= pkgId)
else -- On Mac OS X and on ELF platforms, false positives are OK,
-- so we claim that all foreign imports come from dynamic
-- libraries
True
PlainModuleInitLabel m -> not (dopt Opt_Static dflags) && this_pkg /= (modulePackageId m)
PlainModuleInitLabel m -> not (gopt Opt_Static dflags) && this_pkg /= (modulePackageId m)
-- Note that DynamicLinkerLabels do NOT require dynamic linking themselves.
_ -> False
......
......@@ -366,7 +366,7 @@ mkStdInfoTable dflags (type_descr, closure_descr) cl_type srt_len layout_lit
where
prof_info
| dopt Opt_SccProfilingOn dflags = [type_descr, closure_descr]
| gopt Opt_SccProfilingOn dflags = [type_descr, closure_descr]
| otherwise = []
type_lit = packHalfWordsCLit dflags (toStgHalfWord dflags (fromIntegral cl_type)) srt_len
......
......@@ -1018,7 +1018,7 @@ pushStackFrame fields body = do
withUpdFrameOff new_updfr_off body
profilingInfo dflags desc_str ty_str
= if not (dopt Opt_SccProfilingOn dflags)
= if not (gopt Opt_SccProfilingOn dflags)
then NoProfilingInfo
else ProfilingInfo (stringToWord8s desc_str)
(stringToWord8s ty_str)
......
......@@ -85,7 +85,7 @@ cpsTop hsc_env proc =
return call_pps
let noncall_pps = proc_points `setDifference` call_pps
when (not (setNull noncall_pps) && dopt Opt_D_dump_cmmz dflags) $
when (not (setNull noncall_pps) && gopt Opt_D_dump_cmmz dflags) $
pprTrace "Non-call proc points: " (ppr noncall_pps) $ return ()
----------- Sink and inline assignments *before* stack layout -----------
......@@ -163,7 +163,7 @@ cpsTop hsc_env proc =
= mapM_ (dumpWith dflags flag name)
condPass flag pass g dumpflag dumpname =
if dopt flag dflags
if gopt flag dflags
then do
g <- return $ pass g
dump dumpflag dumpname g
......@@ -186,7 +186,7 @@ runUniqSM m = do
dumpGraph :: DynFlags -> GeneralFlag -> String -> CmmGraph -> IO ()
dumpGraph dflags flag name g = do
when (dopt Opt_DoCmmLinting dflags) $ do_lint g
when (gopt Opt_DoCmmLinting dflags) $ do_lint g
dumpWith dflags flag name g
where
do_lint g = case cmmLintGraph dflags g of
......@@ -201,6 +201,6 @@ dumpWith dflags flag txt g = do
-- them into files." Also, -ddump-cmmz doesn't play nicely
-- with -ddump-to-file, since the headers get omitted.
dumpIfSet_dyn dflags flag txt (ppr g)
when (not (dopt flag dflags)) $
when (not (gopt flag dflags)) $
dumpIfSet_dyn dflags Opt_D_dump_cmmz txt (ppr g)
......@@ -61,7 +61,7 @@ pprCs dflags cmms
= pprCode CStyle (vcat $ map (\c -> split_marker $$ pprC c) cmms)
where
split_marker
| dopt Opt_SplitObjs dflags = ptext (sLit "__STG_SPLIT_MARKER")
| gopt Opt_SplitObjs dflags = ptext (sLit "__STG_SPLIT_MARKER")
| otherwise = empty
writeCs :: DynFlags -> Handle -> [RawCmmGroup] -> IO ()
......
......@@ -267,7 +267,7 @@ fixedHdrSize dflags = sTD_HDR_SIZE dflags + profHdrSize dflags
-- (StgProfHeader in includes/rts/storage/Closures.h)
profHdrSize :: DynFlags -> WordOff
profHdrSize dflags
| dopt Opt_SccProfilingOn dflags = pROF_HDR_SIZE dflags
| gopt Opt_SccProfilingOn dflags = pROF_HDR_SIZE dflags
| otherwise = 0
-- | The garbage collector requires that every closure is at least as
......
......@@ -164,7 +164,7 @@ constructSlowCall amodes
slowArgs :: DynFlags -> [(CgRep,CmmExpr)] -> [(CgRep,CmmExpr)]
slowArgs _ [] = []
slowArgs dflags amodes
| dopt Opt_SccProfilingOn dflags = save_cccs ++ this_pat ++ slowArgs dflags rest
| gopt Opt_SccProfilingOn dflags = save_cccs ++ this_pat ++ slowArgs dflags rest
| otherwise = this_pat ++ slowArgs dflags rest
where
(arg_pat, args, rest) = matchSlowPattern amodes
......
......@@ -653,7 +653,7 @@ saveCurrentCostCentre ::
saveCurrentCostCentre
= do dflags <- getDynFlags
if not (dopt Opt_SccProfilingOn dflags)
if not (gopt Opt_SccProfilingOn dflags)
then returnFC (Nothing, noStmts)
else do slot <- allocPrimStack PtrArg
sp_rel <- getSpRelOffset slot
......
......@@ -482,8 +482,8 @@ emitBlackHoleCode is_single_entry = do
-- Note the eager-blackholing check is here rather than in blackHoleOnEntry,
-- because emitBlackHoleCode is called from CmmParse.
let eager_blackholing = not (dopt Opt_SccProfilingOn dflags)
&& dopt Opt_EagerBlackHoling dflags
let eager_blackholing = not (gopt Opt_SccProfilingOn dflags)
&& gopt Opt_EagerBlackHoling dflags
-- Profiling needs slop filling (to support LDV
-- profiling), so currently eager blackholing doesn't
-- work with profiling.
......@@ -515,8 +515,8 @@ setupUpdate closure_info code
tickyPushUpdateFrame
dflags <- getDynFlags
if blackHoleOnEntry closure_info &&
not (dopt Opt_SccProfilingOn dflags) &&
dopt Opt_EagerBlackHoling dflags
not (gopt Opt_SccProfilingOn dflags) &&
gopt Opt_EagerBlackHoling dflags
then pushBHUpdateFrame (CmmReg nodeReg) code
else pushUpdateFrame (CmmReg nodeReg) code
......
......@@ -185,7 +185,7 @@ because they don't support cross package data references well.
buildDynCon' dflags platform binder _ con [arg_amode]
| maybeIntLikeCon con
, platformOS platform /= OSMinGW32 || not (dopt Opt_PIC dflags)
, platformOS platform /= OSMinGW32 || not (gopt Opt_PIC dflags)
, (_, CmmLit (CmmInt val _)) <- arg_amode
, let val_int = (fromIntegral val) :: Int
, val_int <= mAX_INTLIKE dflags && val_int >= mIN_INTLIKE dflags
......@@ -197,7 +197,7 @@ buildDynCon' dflags platform binder _ con [arg_amode]
buildDynCon' dflags platform binder _ con [arg_amode]
| maybeCharLikeCon con
, platformOS platform /= OSMinGW32 || not (dopt Opt_PIC dflags)
, platformOS platform /= OSMinGW32 || not (gopt Opt_PIC dflags)
, (_, CmmLit (CmmInt val _)) <- arg_amode
, let val_int = (fromIntegral val) :: Int
, val_int <= mAX_CHARLIKE dflags && val_int >= mIN_CHARLIKE dflags
......@@ -324,7 +324,7 @@ cgReturnDataCon con amodes = do
if isUnboxedTupleCon con then returnUnboxedTuple amodes
-- when profiling we can't shortcut here, we have to enter the closure
-- for it to be marked as "used" for LDV profiling.
else if dopt Opt_SccProfilingOn dflags then build_it_then (enter_it dflags)
else if gopt Opt_SccProfilingOn dflags then build_it_then (enter_it dflags)
else ASSERT( amodes `lengthIs` dataConRepRepArity con )
do { EndOfBlockInfo _ sequel <- getEndOfBlockInfo
; case sequel of
......
......@@ -396,7 +396,7 @@ mkRhsClosure dflags bndr cc bi
&& all isFollowableArg (map idCgRep fvs)
&& isUpdatable upd_flag
&& arity <= mAX_SPEC_AP_SIZE dflags
&& not (dopt Opt_SccProfilingOn dflags)
&& not (gopt Opt_SccProfilingOn dflags)
-- not when profiling: we don't want to
-- lose information about this particular
-- thunk (e.g. its type) (#949)
......
......@@ -215,7 +215,7 @@ emitSaveThreadState = do
(stack_SP dflags)) stgSp
emitCloseNursery
-- and save the current cost centre stack in the TSO when profiling:
when (dopt Opt_SccProfilingOn dflags) $
when (gopt Opt_SccProfilingOn dflags) $
stmtC (CmmStore (cmmOffset dflags stgCurrentTSO (tso_CCCS dflags)) curCCS)
-- CurrentNursery->free = Hp+1;
......@@ -246,7 +246,7 @@ emitLoadThreadState = do
]
emitOpenNursery
-- and load the current cost centre stack from the TSO when profiling:
when (dopt Opt_SccProfilingOn dflags) $
when (gopt Opt_SccProfilingOn dflags) $
stmtC $ storeCurCCS $
CmmLoad (cmmOffset dflags (CmmReg (CmmLocal tso)) (tso_CCCS dflags)) (bWord dflags)
......
......@@ -74,7 +74,7 @@ mkCmmInfo cl_info
cit_prof = prof dflags,
cit_srt = closureSRT cl_info })
where
prof dflags | not (dopt Opt_SccProfilingOn dflags) = NoProfilingInfo
prof dflags | not (gopt Opt_SccProfilingOn dflags) = NoProfilingInfo
| otherwise = ProfilingInfo ty_descr_w8 val_descr_w8
ty_descr_w8 = stringToWord8s (closureTypeDescr cl_info)
val_descr_w8 = stringToWord8s (closureValDescr cl_info)
......@@ -254,7 +254,7 @@ stdInfoTableSizeW dflags
= size_fixed + size_prof
where
size_fixed = 2 -- layout, type
size_prof | dopt Opt_SccProfilingOn dflags = 2
size_prof | gopt Opt_SccProfilingOn dflags = 2
| otherwise = 0
stdInfoTableSizeB :: DynFlags -> ByteOff
......
......@@ -40,7 +40,7 @@ doGranAllocate :: CmmExpr -> Code
-- macro DO_GRAN_ALLOCATE
doGranAllocate _hp
= do dflags <- getDynFlags
when (dopt Opt_GranMacros dflags) $ panic "doGranAllocate"
when (gopt Opt_GranMacros dflags) $ panic "doGranAllocate"
......@@ -52,7 +52,7 @@ granFetchAndReschedule :: [(Id,GlobalReg)] -- Live registers
granFetchAndReschedule regs node_reqd
= do dflags <- getDynFlags
let liveness = mkRegLiveness dflags regs 0 0
when (dopt Opt_GranMacros dflags &&
when (gopt Opt_GranMacros dflags &&
(node `elem` map snd regs || node_reqd)) $
do fetch
reschedule liveness node_reqd
......@@ -90,7 +90,7 @@ granYield :: [(Id,GlobalReg)] -- Live registers
granYield regs node_reqd
= do dflags <- getDynFlags
let liveness = mkRegLiveness dflags regs 0 0
when (dopt Opt_GranMacros dflags && node_reqd) $ yield liveness
when (gopt Opt_GranMacros dflags && node_reqd) $ yield liveness
yield :: StgWord -> Code
yield _liveness = panic "granYield"
......
......@@ -159,7 +159,7 @@ emitPrimOp dflags [res] GetCCSOfOp [arg] _live
= stmtC (CmmAssign (CmmLocal res) val)
where
val
| dopt Opt_SccProfilingOn dflags = costCentreFrom dflags (cmmUntag dflags arg)
| gopt Opt_SccProfilingOn dflags = costCentreFrom dflags (cmmUntag dflags arg)
| otherwise = CmmLit (zeroCLit dflags)
emitPrimOp _ [res] GetCurrentCCSOp [_dummy_arg] _live
......
......@@ -139,11 +139,11 @@ enterCostCentreFun ccs closure vols =
ifProfiling :: Code -> Code
ifProfiling code
= do dflags <- getDynFlags
if dopt Opt_SccProfilingOn dflags then code else nopC
if gopt Opt_SccProfilingOn dflags then code else nopC
ifProfilingL :: DynFlags -> [a] -> [a]
ifProfilingL dflags xs
| dopt Opt_SccProfilingOn dflags = xs
| gopt Opt_SccProfilingOn dflags = xs
| otherwise = []
-- ---------------------------------------------------------------------------
......@@ -220,7 +220,7 @@ sizeof_ccs_words dflags
emitSetCCC :: CostCentre -> Bool -> Bool -> Code
emitSetCCC cc tick push
= do dflags <- getDynFlags
if dopt Opt_SccProfilingOn dflags
if gopt Opt_SccProfilingOn dflags
then do tmp <- newTemp (bWord dflags) -- TODO FIXME NOW
pushCostCentre tmp curCCS cc
when tick $ stmtC (bumpSccCount dflags (CmmReg (CmmLocal tmp)))
......
......@@ -197,7 +197,7 @@ performTailCall fun_info arg_amodes pending_assts
-- Test if closure is a constructor
maybeSwitchOnCons dflags enterClosure eob
| EndOfBlockInfo _ (CaseAlts lbl _ _) <- eob,
not (dopt Opt_SccProfilingOn dflags)
not (gopt Opt_SccProfilingOn dflags)
-- we can't shortcut when profiling is on, because we have
-- to enter a closure to mark it as "used" for LDV profiling
= do { is_constr <- newLabelC
......
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