From 8bcb01b5fe1976556ec74f682128fb0a2eb75586 Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 1 Feb 2005 15:08:06 +0000 Subject: [PATCH] [project @ 2005-02-01 15:08:06 by simonmar] small perf hack in emitVectoredReturnInstr: work around lack of CSE in the NCG by assigning info_amode to a new temporary. --- ghc/compiler/codeGen/CgInfoTbls.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ghc/compiler/codeGen/CgInfoTbls.hs b/ghc/compiler/codeGen/CgInfoTbls.hs index 7692e7d..981b4b0 100644 --- a/ghc/compiler/codeGen/CgInfoTbls.hs +++ b/ghc/compiler/codeGen/CgInfoTbls.hs @@ -44,7 +44,8 @@ import CgCallConv ( isBigLiveness, mkLivenessCLit, buildContLiveness, CtrlReturnConvention(..) ) import CgUtils ( mkStringCLit, packHalfWordsCLit, mkWordCLit, cmmOffsetB, cmmOffsetExprW, cmmLabelOffW, cmmOffsetW, - emitDataLits, emitRODataLits, emitSwitch, cmmNegate ) + emitDataLits, emitRODataLits, emitSwitch, cmmNegate, + newTemp ) import CgMonad import CmmUtils ( mkIntCLit, zeroCLit ) @@ -348,7 +349,11 @@ emitVectoredReturnInstr :: CmmExpr -- *Zero-indexed* constructor tag -> Code emitVectoredReturnInstr zero_indexed_tag = do { info_amode <- getSequelAmode - ; let target = retVec info_amode zero_indexed_tag + -- HACK! assign info_amode to a temp, because retVec + -- uses it twice and the NCG doesn't have any CSE yet. + ; x <- newTemp wordRep + ; stmtC (CmmAssign x info_amode) + ; let target = retVec (CmmReg x) zero_indexed_tag ; stmtC (CmmJump target []) } -- 1.7.10.4