diff options
author | Joachim Breitner <mail@joachim-breitner.de> | 2017-02-02 20:28:29 -0500 |
---|---|---|
committer | Joachim Breitner <mail@joachim-breitner.de> | 2017-02-04 18:08:56 -0500 |
commit | 54b9b064fc7960a4dbad387481bc3a6496cc397f (patch) | |
tree | 3fbfe63e02d5ddd877c28d15ff2064aca1360ed6 | |
parent | 82121357f5bf0fd04500187a097c3b614e1fcfd1 (diff) | |
download | haskell-54b9b064fc7960a4dbad387481bc3a6496cc397f.tar.gz |
Expose cseExpr from CSE
for the benefit of GHC API users who want to CSE single expressions.
Differential Revision: https://phabricator.haskell.org/D3069
-rw-r--r-- | compiler/simplCore/CSE.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 971b3e0ea6..21dbd0790a 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -6,7 +6,7 @@ {-# LANGUAGE CPP #-} -module CSE (cseProgram) where +module CSE (cseProgram, cseOneExpr) where #include "HsVersions.h" @@ -373,6 +373,9 @@ tryForCSE toplevel env expr -- top of the replaced sub-expression. This is probably not too -- useful in practice, but upholds our semantics. +cseOneExpr :: CoreExpr -> CoreExpr +cseOneExpr = cseExpr emptyCSEnv + cseExpr :: CSEnv -> InExpr -> OutExpr cseExpr env (Type t) = Type (substTy (csEnvSubst env) t) cseExpr env (Coercion c) = Coercion (substCo (csEnvSubst env) c) |