summaryrefslogtreecommitdiff
path: root/compiler/codeGen
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-06-22 21:55:49 +0100
committerIan Lynagh <igloo@earth.li>2012-06-22 21:55:49 +0100
commit1a137b03472f3727ca7a6ab9621b28641c999301 (patch)
tree62fd397a54cf1f9fcb71bf3181abc6dd31876f39 /compiler/codeGen
parent0043f07ad8c9611a905379c2abd40bda0f39ebf9 (diff)
downloadhaskell-1a137b03472f3727ca7a6ab9621b28641c999301.tar.gz
Change more uses of sortLe to sortBy
Diffstat (limited to 'compiler/codeGen')
-rw-r--r--compiler/codeGen/CgStackery.lhs3
-rw-r--r--compiler/codeGen/CgUtils.hs10
-rw-r--r--compiler/codeGen/StgCmmUtils.hs11
3 files changed, 10 insertions, 14 deletions
diff --git a/compiler/codeGen/CgStackery.lhs b/compiler/codeGen/CgStackery.lhs
index 2628760183..a869795caa 100644
--- a/compiler/codeGen/CgStackery.lhs
+++ b/compiler/codeGen/CgStackery.lhs
@@ -43,6 +43,7 @@ import OrdList
import Outputable
import Control.Monad
+import Data.List
\end{code}
%************************************************************************
@@ -333,7 +334,7 @@ Explicitly free some stack space.
freeStackSlots :: [VirtualSpOffset] -> Code
freeStackSlots extra_free
= do { stk_usg <- getStkUsage
- ; let all_free = addFreeSlots (freeStk stk_usg) (sortLe (<=) extra_free)
+ ; let all_free = addFreeSlots (freeStk stk_usg) (sort extra_free)
; let (new_vsp, new_free) = trim (virtSp stk_usg) all_free
; setStkUsage (stk_usg { virtSp = new_vsp, freeStk = new_free }) }
diff --git a/compiler/codeGen/CgUtils.hs b/compiler/codeGen/CgUtils.hs
index f971a0500a..e7d17c1f03 100644
--- a/compiler/codeGen/CgUtils.hs
+++ b/compiler/codeGen/CgUtils.hs
@@ -72,7 +72,9 @@ import Outputable
import Data.Char
import Data.Word
+import Data.List
import Data.Maybe
+import Data.Ord
-------------------------------------------------------------------------
--
@@ -527,12 +529,10 @@ emitSwitch tag_expr branches mb_deflt lo_tag hi_tag
; let via_C | HscC <- hscTarget dflags = True
| otherwise = False
- ; stmts <- mk_switch tag_expr (sortLe le branches)
+ ; stmts <- mk_switch tag_expr (sortBy (comparing fst) branches)
mb_deflt_id lo_tag hi_tag via_C
; emitCgStmts stmts
}
- where
- (t1,_) `le` (t2,_) = t1 <= t2
mk_switch :: CmmExpr -> [(ConTagZ, CgStmts)]
@@ -699,10 +699,8 @@ emitLitSwitch _ [] deflt = emitCgStmts deflt
emitLitSwitch scrut branches deflt_blk
= do { scrut' <- assignTemp scrut
; deflt_blk_id <- forkCgStmts deflt_blk
- ; blk <- mk_lit_switch scrut' deflt_blk_id (sortLe le branches)
+ ; blk <- mk_lit_switch scrut' deflt_blk_id (sortBy (comparing fst) branches)
; emitCgStmts blk }
- where
- le (t1,_) (t2,_) = t1 <= t2
mk_lit_switch :: CmmExpr -> BlockId
-> [(Literal,CgStmts)]
diff --git a/compiler/codeGen/StgCmmUtils.hs b/compiler/codeGen/StgCmmUtils.hs
index dda2260a04..bb4a653c05 100644
--- a/compiler/codeGen/StgCmmUtils.hs
+++ b/compiler/codeGen/StgCmmUtils.hs
@@ -79,6 +79,8 @@ import FastString
import Outputable
import Data.Char
+import Data.List
+import Data.Ord
import Data.Word
import Data.Maybe
@@ -574,14 +576,11 @@ mkCmmSwitch via_C tag_expr branches mb_deflt lo_tag hi_tag
label_branches join_lbl branches $ \ branches ->
assignTemp' tag_expr $ \tag_expr' ->
- mk_switch tag_expr' (sortLe le branches) mb_deflt
+ mk_switch tag_expr' (sortBy (comparing fst) branches) mb_deflt
lo_tag hi_tag via_C
-- Sort the branches before calling mk_switch
<*> mkLabel join_lbl
- where
- (t1,_) `le` (t2,_) = t1 <= t2
-
mk_switch :: CmmExpr -> [(ConTagZ, BlockId)]
-> Maybe BlockId
-> ConTagZ -> ConTagZ -> Bool
@@ -731,10 +730,8 @@ mkCmmLitSwitch scrut branches deflt
withFreshLabel "switch join" $ \ join_lbl ->
label_code join_lbl deflt $ \ deflt ->
label_branches join_lbl branches $ \ branches ->
- mk_lit_switch scrut' deflt (sortLe le branches)
+ mk_lit_switch scrut' deflt (sortBy (comparing fst) branches)
<*> mkLabel join_lbl
- where
- le (t1,_) (t2,_) = t1 <= t2
mk_lit_switch :: CmmExpr -> BlockId
-> [(Literal,BlockId)]