diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2017-03-08 10:26:47 +0000 |
---|---|---|
committer | David Feuer <David.Feuer@gmail.com> | 2017-04-28 18:08:33 -0400 |
commit | 193664d42dbceadaa1e4689dfa17ff1cf5a405a0 (patch) | |
tree | 9288e57ab81dcbf9f633cae13d9920cf38a11754 /compiler/prelude/PrimOp.hs | |
parent | 1cae73aa7a1bf934e3dcae943d0d1686e8b12c26 (diff) | |
download | haskell-193664d42dbceadaa1e4689dfa17ff1cf5a405a0.tar.gz |
Re-engineer caseRules to add tagToEnum/dataToTag
See Note [Scrutinee Constant Folding] in SimplUtils
* Add cases for tagToEnum and dataToTag. This is the main new
bit. It allows the simplifier to remove the pervasive uses
of case tagToEnum (a > b) of
False -> e1
True -> e2
and replace it by the simpler
case a > b of
DEFAULT -> e1
1# -> e2
See Note [caseRules for tagToEnum]
and Note [caseRules for dataToTag] in PrelRules.
* This required some changes to the API of caseRules, and hence
to code in SimplUtils. See Note [Scrutinee Constant Folding]
in SimplUtils.
* Avoid duplication of work in the (unusual) case of
case BIG + 3# of b
DEFAULT -> e1
6# -> e2
Previously we got
case BIG of
DEFAULT -> let b = BIG + 3# in e1
3# -> let b = 6# in e2
Now we get
case BIG of b#
DEFAULT -> let b = b' + 3# in e1
3# -> let b = 6# in e2
* Avoid duplicated code in caseRules
A knock-on refactoring:
* Move Note [Word/Int underflow/overflow] to Literal, as
documentation to accompany mkMachIntWrap etc; and get
rid of PrelRuls.intResult' in favour of mkMachIntWrap
Diffstat (limited to 'compiler/prelude/PrimOp.hs')
0 files changed, 0 insertions, 0 deletions