diff options
author | klebinger.andreas@gmx.at <klebinger.andreas@gmx.at> | 2019-01-26 00:26:02 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-02-08 11:00:15 -0500 |
commit | 03b7abc19c8b0ec5c606cc2da208d2d004807fe9 (patch) | |
tree | e1d779fee191e71aafba557e6e4680d4d6aab60f /compiler/nativeGen/RegAlloc/Graph/Spill.hs | |
parent | 2b90356d26b4699227816ad9424e766eccdb6c36 (diff) | |
download | haskell-03b7abc19c8b0ec5c606cc2da208d2d004807fe9.tar.gz |
Allow resizing the stack for the graph allocator.
The graph allocator now dynamically resizes the number of stack
slots when running into the limit.
This fixes #8657.
Also loop membership of basic blocks is now available
in the register allocator for cost heuristics.
Diffstat (limited to 'compiler/nativeGen/RegAlloc/Graph/Spill.hs')
-rw-r--r-- | compiler/nativeGen/RegAlloc/Graph/Spill.hs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/compiler/nativeGen/RegAlloc/Graph/Spill.hs b/compiler/nativeGen/RegAlloc/Graph/Spill.hs index bce24bdd3c..2e1879926e 100644 --- a/compiler/nativeGen/RegAlloc/Graph/Spill.hs +++ b/compiler/nativeGen/RegAlloc/Graph/Spill.hs @@ -33,6 +33,9 @@ import qualified Data.IntSet as IntSet -- | Spill all these virtual regs to stack slots. -- +-- Bumps the number of required stack slots if required. +-- +-- -- TODO: See if we can split some of the live ranges instead of just globally -- spilling the virtual reg. This might make the spill cleaner's job easier. -- @@ -45,20 +48,22 @@ regSpill => Platform -> [LiveCmmDecl statics instr] -- ^ the code -> UniqSet Int -- ^ available stack slots + -> Int -- ^ current number of spill slots. -> UniqSet VirtualReg -- ^ the regs to spill -> UniqSM ([LiveCmmDecl statics instr] -- code with SPILL and RELOAD meta instructions added. , UniqSet Int -- left over slots + , Int -- slot count in use now. , SpillStats ) -- stats about what happened during spilling -regSpill platform code slotsFree regs +regSpill platform code slotsFree slotCount regs -- Not enough slots to spill these regs. | sizeUniqSet slotsFree < sizeUniqSet regs - = pprPanic "regSpill: out of spill slots!" - ( text " regs to spill = " <> ppr (sizeUniqSet regs) - $$ text " slots left = " <> ppr (sizeUniqSet slotsFree)) + = -- pprTrace "Bumping slot count:" (ppr slotCount <> text " -> " <> ppr (slotCount+512)) $ + let slotsFree' = (addListToUniqSet slotsFree [slotCount+1 .. slotCount+512]) + in regSpill platform code slotsFree' (slotCount+512) regs | otherwise = do @@ -80,6 +85,7 @@ regSpill platform code slotsFree regs return ( code' , minusUniqSet slotsFree (mkUniqSet slots) + , slotCount , makeSpillStats state') |