Commit 3efd7cd9 authored by Ömer Sinan Ağacan's avatar Ömer Sinan Ağacan

Minor refactoring in CmmUtils.mkLiveness

Test Plan: validate

Reviewers: bgamari, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

Differential Revision: https://phabricator.haskell.org/D4957
parent 1c353623
......@@ -542,7 +542,7 @@ info :: { CmmParse (CLabel, Maybe CmmInfoTable, [LocalReg]) }
live <- sequence $7
let prof = NoProfilingInfo
-- drop one for the info pointer
bitmap = mkLiveness dflags (map Just (drop 1 live))
bitmap = mkLiveness dflags (drop 1 live)
rep = mkRTSRep (fromIntegral $5) $ mkStackRep bitmap
return (mkCmmRetLabel pkg $3,
Just $ CmmInfoTable { cit_lbl = mkCmmRetInfoLabel pkg $3
......
......@@ -456,20 +456,17 @@ regUsedIn dflags = regUsedIn_ where
--
---------------------------------------------
mkLiveness :: DynFlags -> [Maybe LocalReg] -> Liveness
mkLiveness :: DynFlags -> [LocalReg] -> Liveness
mkLiveness _ [] = []
mkLiveness dflags (reg:regs)
= take sizeW bits ++ mkLiveness dflags regs
= bits ++ mkLiveness dflags regs
where
sizeW = case reg of
Nothing -> 1
Just r -> (widthInBytes (typeWidth (localRegType r)) + wORD_SIZE dflags - 1)
`quot` wORD_SIZE dflags
-- number of words, rounded up
bits = repeat $ is_non_ptr reg -- True <=> Non Ptr
is_non_ptr Nothing = True
is_non_ptr (Just reg) = not $ isGcPtrType (localRegType reg)
sizeW = (widthInBytes (typeWidth (localRegType reg)) + wORD_SIZE dflags - 1)
`quot` wORD_SIZE dflags
-- number of words, rounded up
bits = replicate sizeW is_non_ptr -- True <=> Non Ptr
is_non_ptr = not $ isGcPtrType (localRegType reg)
-- ============================================== -
......
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