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

Merge branch 'master' of darcs.haskell.org:/srv/darcs//ghc

parents a5bf0d5a 88a6f863
......@@ -183,6 +183,20 @@ cmmMachOpFoldM dflags mop1@(MO_Add{}) [CmmMachOp mop2@(MO_Sub{}) [arg1,arg2], ar
| not (isLit arg1) && not (isPicReg arg1)
= Just (cmmMachOpFold dflags mop1 [arg1, cmmMachOpFold dflags mop2 [arg3,arg2]])
-- special case: (PicBaseReg + lit) + N ==> PicBaseReg + (lit+N)
--
-- this is better because lit+N is a single link-time constant (e.g. a
-- CmmLabelOff), so the right-hand expression needs only one
-- instruction, whereas the left needs two. This happens when pointer
-- tagging gives us label+offset, and PIC turns the label into
-- PicBaseReg + label.
--
cmmMachOpFoldM _ MO_Add{} [ CmmMachOp op@MO_Add{} [pic, CmmLit lit]
, CmmLit (CmmInt n rep) ]
| isPicReg pic
= Just $ CmmMachOp op [pic, CmmLit $ cmmOffsetLit lit off ]
where off = fromIntegral (narrowS rep n)
-- Make a RegOff if we can
cmmMachOpFoldM _ (MO_Add _) [CmmReg reg, CmmLit (CmmInt n rep)]
= Just $ cmmRegOff reg (fromIntegral (narrowS rep n))
......
......@@ -178,7 +178,7 @@ cmmSink dflags graph = ofBlockList (g_entry graph) $ sink mapEmpty $ blocks
drop_if a@(r,rhs,_) live_sets = (should_drop, live_sets')
where
should_drop = conflicts dflags a final_last
|| {- not (isSmall rhs) && -} live_in_multi live_sets r
|| not (isTrivial rhs) && live_in_multi live_sets r
|| r `Set.member` live_in_joins
live_sets' | should_drop = live_sets
......@@ -205,12 +205,12 @@ isSmall (CmmLit _) = True
isSmall (CmmMachOp (MO_Add _) [x,y]) = isTrivial x && isTrivial y
isSmall (CmmRegOff (CmmLocal _) _) = True
isSmall _ = False
-}
isTrivial :: CmmExpr -> Bool
isTrivial (CmmReg (CmmLocal _)) = True
isTrivial (CmmLit _) = True
-- isTrivial (CmmLit _) = True
isTrivial _ = False
-}
--
-- annotate each node with the set of registers live *after* the node
......@@ -365,9 +365,8 @@ tryToInline dflags live node assigs = go usages node [] assigs
go _usages node _skipped [] = (node, [])
go usages node skipped (a@(l,rhs,_) : rest)
| can_inline = inline_and_discard
| False {- isTiny rhs -} = inline_and_keep
-- ^^ seems to make things slightly worse
| can_inline = inline_and_discard
| isTrivial rhs = inline_and_keep
where
inline_and_discard = go usages' node' skipped rest
......
......@@ -1026,7 +1026,10 @@ wayGeneralFlags platform WayDyn =
-- different from the current one.
OSMinGW32 -> [Opt_PIC]
OSDarwin -> [Opt_PIC]
OSLinux -> [Opt_PIC]
OSLinux -> [Opt_PIC] -- This needs to be here for GHCi to work:
-- GHCi links objects into a .so before
-- loading the .so using the system linker.
-- Only PIC objects can be linked into a .so.
_ -> []
wayGeneralFlags _ WayProf = [Opt_SccProfilingOn]
wayGeneralFlags _ WayEventLog = []
......@@ -2550,12 +2553,7 @@ defaultFlags settings
++ [f | (ns,f) <- optLevelFlags, 0 `elem` ns]
-- The default -O0 options
++ (case platformOS platform of
OSDarwin ->
case platformArch platform of
ArchX86_64 -> [Opt_PIC]
_ -> []
_ -> [])
++ default_PIC platform
++ (if pc_dYNAMIC_BY_DEFAULT (sPlatformConstants settings)
then wayGeneralFlags platform WayDyn
......@@ -2563,6 +2561,12 @@ defaultFlags settings
where platform = sTargetPlatform settings
default_PIC :: Platform -> [GeneralFlag]
default_PIC platform =
case (platformOS platform, platformArch platform) of
(OSDarwin, ArchX86_64) -> [Opt_PIC]
_ -> []
impliedFlags :: [(ExtensionFlag, TurnOnFlag, ExtensionFlag)]
impliedFlags
= [ (Opt_RankNTypes, turnOn, Opt_ExplicitForAll)
......@@ -2834,7 +2838,14 @@ addWay w = do upd (\dfs -> dfs { ways = w : ways dfs })
mapM_ setGeneralFlag $ wayGeneralFlags platform w
removeWay :: Way -> DynP ()
removeWay w = upd (\dfs -> dfs { ways = filter (w /=) (ways dfs) })
removeWay w = do
upd (\dfs -> dfs { ways = filter (w /=) (ways dfs) })
dfs <- liftEwM getCmdLineState
let platform = targetPlatform dfs
-- XXX: wayExtras?
mapM_ unSetGeneralFlag $ wayGeneralFlags platform w
-- turn Opt_PIC back on if necessary for this platform:
mapM_ setGeneralFlag $ default_PIC platform
--------------------------
setGeneralFlag, unSetGeneralFlag :: GeneralFlag -> DynP ()
......
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