diff options
| author | Simon Peyton Jones <simonpj@microsoft.com> | 2011-04-19 11:06:20 +0100 |
|---|---|---|
| committer | Simon Peyton Jones <simonpj@microsoft.com> | 2011-04-19 11:06:20 +0100 |
| commit | fdf8656855d26105ff36bdd24d41827b05037b91 (patch) | |
| tree | fbbaeb08132051cde17ec7c3020cb835b04b947e /compiler/simplCore/CSE.lhs | |
| parent | a52ff7619e8b7d74a9d933d922eeea49f580bca8 (diff) | |
| download | haskell-fdf8656855d26105ff36bdd24d41827b05037b91.tar.gz | |
This BIG PATCH contains most of the work for the New Coercion Representation
See the paper "Practical aspects of evidence based compilation in System FC"
* Coercion becomes a data type, distinct from Type
* Coercions become value-level things, rather than type-level things,
(although the value is zero bits wide, like the State token)
A consequence is that a coerion abstraction increases the arity by 1
(just like a dictionary abstraction)
* There is a new constructor in CoreExpr, namely Coercion, to inject
coercions into terms
Diffstat (limited to 'compiler/simplCore/CSE.lhs')
| -rw-r--r-- | compiler/simplCore/CSE.lhs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/simplCore/CSE.lhs b/compiler/simplCore/CSE.lhs index 523431fec0..5bec8f0c3d 100644 --- a/compiler/simplCore/CSE.lhs +++ b/compiler/simplCore/CSE.lhs @@ -207,6 +207,7 @@ do_one env (id, rhs) tryForCSE :: CSEnv -> CoreExpr -> CoreExpr tryForCSE _ (Type t) = Type t +tryForCSE _ (Coercion c) = Coercion c tryForCSE env expr = case lookupCSEnv env expr' of Just smaller_expr -> smaller_expr Nothing -> expr' @@ -215,6 +216,7 @@ tryForCSE env expr = case lookupCSEnv env expr' of cseExpr :: CSEnv -> CoreExpr -> CoreExpr cseExpr _ (Type t) = Type t +cseExpr _ (Coercion co) = Coercion co cseExpr _ (Lit lit) = Lit lit cseExpr env (Var v) = Var (lookupSubst env v) cseExpr env (App f a) = App (cseExpr env f) (tryForCSE env a) |
