summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonmar <unknown>2005-02-01 15:33:14 +0000
committersimonmar <unknown>2005-02-01 15:33:14 +0000
commit1dae2e1f9b0dd71f0f17f644d7983a3db52edbdf (patch)
tree995360918ae3214c22d68441420981c5dc095857
parent8bcb01b5fe1976556ec74f682128fb0a2eb75586 (diff)
downloadhaskell-1dae2e1f9b0dd71f0f17f644d7983a3db52edbdf.tar.gz
[project @ 2005-02-01 15:33:14 by simonmar]
hack upon the hack: confine the hack to -fasm, because gcc is too stupid to optimise away the extra temporary.
-rw-r--r--ghc/compiler/codeGen/CgInfoTbls.hs16
1 files changed, 12 insertions, 4 deletions
diff --git a/ghc/compiler/codeGen/CgInfoTbls.hs b/ghc/compiler/codeGen/CgInfoTbls.hs
index 981b4b0c69..0111a2ae9a 100644
--- a/ghc/compiler/codeGen/CgInfoTbls.hs
+++ b/ghc/compiler/codeGen/CgInfoTbls.hs
@@ -57,7 +57,7 @@ import StgSyn ( SRT(..) )
import Name ( Name )
import DataCon ( DataCon, dataConTag, fIRST_TAG )
import Unique ( Uniquable(..) )
-import CmdLineOpts ( opt_SccProfilingOn )
+import CmdLineOpts ( opt_SccProfilingOn, DynFlags(..), HscTarget(..) )
import ListSetOps ( assocDefault )
import Maybes ( isJust )
import Constants ( wORD_SIZE, sIZEOF_StgFunInfoExtraRev )
@@ -351,9 +351,17 @@ emitVectoredReturnInstr zero_indexed_tag
= do { info_amode <- getSequelAmode
-- 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
+ -- Only do this for the NCG, because gcc is too stupid
+ -- to optimise away the extra tmp (grrr).
+ ; dflags <- getDynFlags
+ ; x <- if hscTarget dflags == HscAsm
+ then do z <- newTemp wordRep
+ stmtC (CmmAssign z info_amode)
+ return (CmmReg z)
+ else
+
+ return info_amode
+ ; let target = retVec x zero_indexed_tag
; stmtC (CmmJump target []) }