From: simonmar Date: Mon, 17 Dec 2001 12:33:45 +0000 (+0000) Subject: [project @ 2001-12-17 12:33:45 by simonmar] X-Git-Tag: Approximately_9120_patches~377 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=f871dbb89cbd96567ad0ea3926f90c67155edeb4;hp=0a831b28a4037047c19aa15ecf140fa56e3c088c;p=ghc-hetmet.git [project @ 2001-12-17 12:33:45 by simonmar] Generate better code for case-of-literal (i.e. just do the assignment). These crop up now that the simplifier is a bit more careful about duplicating literal strings. --- diff --git a/ghc/compiler/codeGen/CgCase.lhs b/ghc/compiler/codeGen/CgCase.lhs index a863c75..8201952 100644 --- a/ghc/compiler/codeGen/CgCase.lhs +++ b/ghc/compiler/codeGen/CgCase.lhs @@ -1,7 +1,7 @@ % % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -% $Id: CgCase.lhs,v 1.55 2001/12/05 17:35:13 sewardj Exp $ +% $Id: CgCase.lhs,v 1.56 2001/12/17 12:33:45 simonmar Exp $ % %******************************************************** %* * @@ -185,7 +185,17 @@ cgCase (StgOpApp op args _) absC (mkAlgAltsCSwitch tag_amode tagged_alts deflt_c) \end{code} -Special case #2: inline PrimOps. +Special case #2: case of literal. + +\begin{code} +cgCase (StgLit lit) live_in_whole_case live_in_alts bndr srt alts = + absC (CAssign (CTemp (getUnique bndr) (idPrimRep bndr)) (CLit lit)) `thenC` + case alts of + StgPrimAlts tycon alts deflt -> cgPrimInlineAlts bndr tycon alts deflt + other -> pprPanic "cgCase: case of literal has strange alts" (pprStgAlts alts) +\end{code} + +Special case #3: inline PrimOps. \begin{code} cgCase (StgOpApp op@(StgPrimOp primop) args _)