[commit: ghc] wip/tdammers-7258: Performance improvements linear regAlloc (#7258) (19a2ba3)
git at git.haskell.org
git at git.haskell.org
Tue Oct 17 06:51:16 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/tdammers-7258
Link : http://ghc.haskell.org/trac/ghc/changeset/19a2ba3ea436b60466fc4022f53a6631e41b87a5/ghc
>---------------------------------------------------------------
commit 19a2ba3ea436b60466fc4022f53a6631e41b87a5
Author: Tobias Dammers <tdammers at gmail.com>
Date: Mon Oct 16 14:27:40 2017 +0200
Performance improvements linear regAlloc (#7258)
>---------------------------------------------------------------
19a2ba3ea436b60466fc4022f53a6631e41b87a5
compiler/nativeGen/RegAlloc/Linear/Main.hs | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/compiler/nativeGen/RegAlloc/Linear/Main.hs b/compiler/nativeGen/RegAlloc/Linear/Main.hs
index 171ce88..6171d8d 100644
--- a/compiler/nativeGen/RegAlloc/Linear/Main.hs
+++ b/compiler/nativeGen/RegAlloc/Linear/Main.hs
@@ -809,27 +809,29 @@ allocRegsAndSpill_spill reading keep spills alloc r rs assig spill_loc
-- case (3): we need to push something out to free up a register
[] ->
- do let keep' = map getUnique keep
+ do let inRegOrBoth (InReg _) = True
+ inRegOrBoth (InBoth _ _) = True
+ inRegOrBoth _ = False
+ let candidates' =
+ flip delListFromUFM keep $
+ filterUFM inRegOrBoth $
+ assig
+ -- This is non-deterministic but we do not
+ -- currently support deterministic code-generation.
+ -- See Note [Unique Determinism and code generation]
+ let candidates = nonDetUFMToList candidates'
-- the vregs we could kick out that are already in a slot
let candidates_inBoth
= [ (temp, reg, mem)
- | (temp, InBoth reg mem) <- nonDetUFMToList assig
- -- This is non-deterministic but we do not
- -- currently support deterministic code-generation.
- -- See Note [Unique Determinism and code generation]
- , temp `notElem` keep'
+ | (temp, InBoth reg mem) <- candidates
, targetClassOfRealReg platform reg == classOfVirtualReg r ]
-- the vregs we could kick out that are only in a reg
-- this would require writing the reg to a new slot before using it.
let candidates_inReg
= [ (temp, reg)
- | (temp, InReg reg) <- nonDetUFMToList assig
- -- This is non-deterministic but we do not
- -- currently support deterministic code-generation.
- -- See Note [Unique Determinism and code generation]
- , temp `notElem` keep'
+ | (temp, InReg reg) <- candidates
, targetClassOfRealReg platform reg == classOfVirtualReg r ]
let result
More information about the ghc-commits
mailing list