diff options
author | Simon Marlow <marlowsd@gmail.com> | 2012-08-06 15:28:56 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2012-08-07 15:30:35 +0100 |
commit | 0b75e456b62c9d36e6ce9756278a36db9e1baaaa (patch) | |
tree | 8d3de84bff38544d5f037d6e1b88d7db22875ad4 /compiler/codeGen/StgCmmEnv.hs | |
parent | 8d3e9fd0e660d9b058495c1edf5ba4a70de438ba (diff) | |
download | haskell-0b75e456b62c9d36e6ce9756278a36db9e1baaaa.tar.gz |
Generate one fewer temps per heap allocation
This saves compile time and can make a big difference in some
pathological cases (T4801)
Diffstat (limited to 'compiler/codeGen/StgCmmEnv.hs')
-rw-r--r-- | compiler/codeGen/StgCmmEnv.hs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/compiler/codeGen/StgCmmEnv.hs b/compiler/codeGen/StgCmmEnv.hs index 67953ce95a..4d91451628 100644 --- a/compiler/codeGen/StgCmmEnv.hs +++ b/compiler/codeGen/StgCmmEnv.hs @@ -44,7 +44,7 @@ import CLabel import BlockId import CmmExpr import CmmUtils -import MkGraph (CmmAGraph, mkAssign, (<*>)) +import MkGraph (CmmAGraph, mkAssign) import FastString import Id import VarEnv @@ -103,13 +103,12 @@ lneIdInfo id regs -- register, and store a plain register in the CgIdInfo. We allocate -- a new register in order to keep single-assignment and help out the -- inliner. -- EZY -regIdInfo :: Id -> LambdaFormInfo -> LocalReg -> CmmAGraph -> FCode (CgIdInfo, CmmAGraph) -regIdInfo id lf_info reg init - = do { reg' <- newTemp (localRegType reg) - ; let init' = init <*> mkAssign (CmmLocal reg') - (addDynTag (CmmReg (CmmLocal reg)) - (lfDynTag lf_info)) - ; return (mkCgIdInfo id lf_info (CmmReg (CmmLocal reg')), init') } +regIdInfo :: Id -> LambdaFormInfo -> CmmExpr -> FCode (CgIdInfo, CmmAGraph) +regIdInfo id lf_info expr + = do { reg <- newTemp (cmmExprType expr) + ; let init = mkAssign (CmmLocal reg) + (addDynTag expr (lfDynTag lf_info)) + ; return (mkCgIdInfo id lf_info (CmmReg (CmmLocal reg)), init) } idInfoToAmode :: CgIdInfo -> CmmExpr -- Returns a CmmExpr for the *tagged* pointer |