[commit: ghc] wip/T10137: Handle the two-branch-case in StgCmmUtils already (165dbd9)

git at git.haskell.org git at git.haskell.org
Sun Mar 8 19:30:32 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/T10137
Link       : http://ghc.haskell.org/trac/ghc/changeset/165dbd92febd638a48b30797316c23b1723508db/ghc

>---------------------------------------------------------------

commit 165dbd92febd638a48b30797316c23b1723508db
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Sun Mar 8 20:20:23 2015 +0100

    Handle the two-branch-case in StgCmmUtils already


>---------------------------------------------------------------

165dbd92febd638a48b30797316c23b1723508db
 compiler/codeGen/StgCmmUtils.hs | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/compiler/codeGen/StgCmmUtils.hs b/compiler/codeGen/StgCmmUtils.hs
index e21b52d..b3cafc6 100644
--- a/compiler/codeGen/StgCmmUtils.hs
+++ b/compiler/codeGen/StgCmmUtils.hs
@@ -506,6 +506,12 @@ mk_switch tag_expr [(tag,lbl)] (Just deflt) _ _
             -- so there must be a default
        return (mkCbranch cond deflt lbl)
 
+-- TWO BRANCHES, NO DEFAULT: simply do it here
+mk_switch tag_expr [(tag1,lbl1), (_tag2,lbl2)] Nothing _ _
+  = do dflags <- getDynFlags
+       let cond =  cmmNeWord dflags tag_expr (mkIntExpr dflags tag1)
+       return (mkCbranch cond lbl2 lbl1)
+
 -- SOMETHING MORE COMPLICATED: defer to CmmCreateSwitchPlans
 mk_switch tag_expr branches mb_deflt lo_tag hi_tag
   = do let



More information about the ghc-commits mailing list