diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-06-02 19:27:13 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-06-23 22:48:18 -0400 |
commit | 7750bd456f32c3e91b9165587fe290122b9c2444 (patch) | |
tree | 4413a4e945b731aaea00a2e0195d9f546053c5b0 /compiler/GHC/StgToCmm/Utils.hs | |
parent | 809caedffe489931efa8c96a60eaed6d7ff739b9 (diff) | |
download | haskell-7750bd456f32c3e91b9165587fe290122b9c2444.tar.gz |
Cmm: introduce SAVE_REGS/RESTORE_REGS
We don't want to save both Fn and Dn register sets on x86-64 as they are
aliased to the same arch register (XMMn).
Moreover, when SAVE_STGREGS was used in conjunction with `jump foo [*]`
which makes a set of Cmm registers alive so that they cover all arch
registers used to pass parameter, we could have Fn, Dn and XMMn alive at
the same time. It made the LLVM code generator choke (see #17920).
Now `SAVE_REGS/RESTORE_REGS` and `jump foo [*]` use the same set of
registers.
Diffstat (limited to 'compiler/GHC/StgToCmm/Utils.hs')
-rw-r--r-- | compiler/GHC/StgToCmm/Utils.hs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/compiler/GHC/StgToCmm/Utils.hs b/compiler/GHC/StgToCmm/Utils.hs index 2814948189..27c79a8e62 100644 --- a/compiler/GHC/StgToCmm/Utils.hs +++ b/compiler/GHC/StgToCmm/Utils.hs @@ -23,6 +23,7 @@ module GHC.StgToCmm.Utils ( tagToClosure, mkTaggedObjectLoad, callerSaves, callerSaveVolatileRegs, get_GlobalReg_addr, + callerSaveGlobalReg, callerRestoreGlobalReg, cmmAndWord, cmmOrWord, cmmNegate, cmmEqWord, cmmNeWord, cmmUGtWord, cmmSubWord, cmmMulWord, cmmAddWord, cmmUShrWord, @@ -249,8 +250,8 @@ callerSaveVolatileRegs dflags = (caller_save, caller_load) where platform = targetPlatform dflags - caller_save = catAGraphs (map callerSaveGlobalReg regs_to_save) - caller_load = catAGraphs (map callerRestoreGlobalReg regs_to_save) + caller_save = catAGraphs (map (callerSaveGlobalReg dflags) regs_to_save) + caller_load = catAGraphs (map (callerRestoreGlobalReg dflags) regs_to_save) system_regs = [ Sp,SpLim,Hp,HpLim,CCCS,CurrentTSO,CurrentNursery {- ,SparkHd,SparkTl,SparkBase,SparkLim -} @@ -258,12 +259,14 @@ callerSaveVolatileRegs dflags = (caller_save, caller_load) regs_to_save = filter (callerSaves platform) system_regs - callerSaveGlobalReg reg - = mkStore (get_GlobalReg_addr dflags reg) (CmmReg (CmmGlobal reg)) +callerSaveGlobalReg :: DynFlags -> GlobalReg -> CmmAGraph +callerSaveGlobalReg dflags reg + = mkStore (get_GlobalReg_addr dflags reg) (CmmReg (CmmGlobal reg)) - callerRestoreGlobalReg reg - = mkAssign (CmmGlobal reg) - (CmmLoad (get_GlobalReg_addr dflags reg) (globalRegType platform reg)) +callerRestoreGlobalReg :: DynFlags -> GlobalReg -> CmmAGraph +callerRestoreGlobalReg dflags reg + = mkAssign (CmmGlobal reg) + (CmmLoad (get_GlobalReg_addr dflags reg) (globalRegType (targetPlatform dflags) reg)) ------------------------------------------------------------------------- |