summaryrefslogtreecommitdiff
path: root/compiler/simplCore
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/simplCore')
-rw-r--r--compiler/simplCore/CSE.lhs2
-rw-r--r--compiler/simplCore/CoreMonad.lhs5
-rw-r--r--compiler/simplCore/FloatIn.lhs3
-rw-r--r--compiler/simplCore/FloatOut.lhs3
-rw-r--r--compiler/simplCore/LiberateCase.lhs3
-rw-r--r--compiler/simplCore/OccurAnal.lhs3
-rw-r--r--compiler/simplCore/SAT.lhs3
-rw-r--r--compiler/simplCore/SetLevels.lhs3
-rw-r--r--compiler/simplCore/SimplCore.lhs2
-rw-r--r--compiler/simplCore/SimplEnv.lhs2
-rw-r--r--compiler/simplCore/SimplUtils.lhs2
-rw-r--r--compiler/simplCore/Simplify.lhs37
12 files changed, 42 insertions, 26 deletions
diff --git a/compiler/simplCore/CSE.lhs b/compiler/simplCore/CSE.lhs
index 691f883d02..90715737c2 100644
--- a/compiler/simplCore/CSE.lhs
+++ b/compiler/simplCore/CSE.lhs
@@ -4,6 +4,8 @@
\section{Common subexpression}
\begin{code}
+{-# LANGUAGE CPP #-}
+
module CSE (cseProgram) where
#include "HsVersions.h"
diff --git a/compiler/simplCore/CoreMonad.lhs b/compiler/simplCore/CoreMonad.lhs
index b2f697a632..c06036044d 100644
--- a/compiler/simplCore/CoreMonad.lhs
+++ b/compiler/simplCore/CoreMonad.lhs
@@ -4,15 +4,14 @@
\section[CoreMonad]{The core pipeline monad}
\begin{code}
-{-# OPTIONS -fno-warn-tabs #-}
+{-# LANGUAGE CPP, UndecidableInstances #-}
+{-# OPTIONS_GHC -fno-warn-tabs #-}
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and
-- detab the module (please do the detabbing in a separate patch). See
-- http://ghc.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
-- for details
-{-# LANGUAGE UndecidableInstances #-}
-
module CoreMonad (
-- * Configuration of the core-to-core passes
CoreToDo(..), runWhen, runMaybe,
diff --git a/compiler/simplCore/FloatIn.lhs b/compiler/simplCore/FloatIn.lhs
index 8a35749c67..2cf886c5c6 100644
--- a/compiler/simplCore/FloatIn.lhs
+++ b/compiler/simplCore/FloatIn.lhs
@@ -12,7 +12,8 @@ case, so that we don't allocate things, save them on the stack, and
then discover that they aren't needed in the chosen branch.
\begin{code}
-{-# OPTIONS -fno-warn-tabs #-}
+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-tabs #-}
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and
-- detab the module (please do the detabbing in a separate patch). See
diff --git a/compiler/simplCore/FloatOut.lhs b/compiler/simplCore/FloatOut.lhs
index fbe8a3eb8a..dbab552431 100644
--- a/compiler/simplCore/FloatOut.lhs
+++ b/compiler/simplCore/FloatOut.lhs
@@ -6,8 +6,9 @@
``Long-distance'' floating of bindings towards the top level.
\begin{code}
+{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
-{-# OPTIONS -fno-warn-tabs #-}
+{-# OPTIONS_GHC -fno-warn-tabs #-}
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and
-- detab the module (please do the detabbing in a separate patch). See
diff --git a/compiler/simplCore/LiberateCase.lhs b/compiler/simplCore/LiberateCase.lhs
index a89396b782..2593ab159c 100644
--- a/compiler/simplCore/LiberateCase.lhs
+++ b/compiler/simplCore/LiberateCase.lhs
@@ -4,7 +4,8 @@
\section[LiberateCase]{Unroll recursion to allow evals to be lifted from a loop}
\begin{code}
-{-# OPTIONS -fno-warn-tabs #-}
+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-tabs #-}
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and
-- detab the module (please do the detabbing in a separate patch). See
diff --git a/compiler/simplCore/OccurAnal.lhs b/compiler/simplCore/OccurAnal.lhs
index 2487787c8d..c9323359c5 100644
--- a/compiler/simplCore/OccurAnal.lhs
+++ b/compiler/simplCore/OccurAnal.lhs
@@ -12,7 +12,8 @@ The occurrence analyser re-typechecks a core expression, returning a new
core expression with (hopefully) improved usage information.
\begin{code}
-{-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE CPP, BangPatterns #-}
+
module OccurAnal (
occurAnalysePgm, occurAnalyseExpr, occurAnalyseExpr_NoBinderSwap
) where
diff --git a/compiler/simplCore/SAT.lhs b/compiler/simplCore/SAT.lhs
index bc1ce42cd6..92ebdfe389 100644
--- a/compiler/simplCore/SAT.lhs
+++ b/compiler/simplCore/SAT.lhs
@@ -49,7 +49,8 @@ essential to make this work well!
\begin{code}
-{-# OPTIONS -fno-warn-tabs #-}
+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-tabs #-}
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and
-- detab the module (please do the detabbing in a separate patch). See
diff --git a/compiler/simplCore/SetLevels.lhs b/compiler/simplCore/SetLevels.lhs
index 6edadb8bd9..225d5d612e 100644
--- a/compiler/simplCore/SetLevels.lhs
+++ b/compiler/simplCore/SetLevels.lhs
@@ -42,7 +42,8 @@
the scrutinee of the case, and we can inline it.
\begin{code}
-{-# OPTIONS -fno-warn-tabs #-}
+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-tabs #-}
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and
-- detab the module (please do the detabbing in a separate patch). See
diff --git a/compiler/simplCore/SimplCore.lhs b/compiler/simplCore/SimplCore.lhs
index 436d1b63aa..59b39a9c60 100644
--- a/compiler/simplCore/SimplCore.lhs
+++ b/compiler/simplCore/SimplCore.lhs
@@ -4,6 +4,8 @@
\section[SimplCore]{Driver for simplifying @Core@ programs}
\begin{code}
+{-# LANGUAGE CPP #-}
+
module SimplCore ( core2core, simplifyExpr ) where
#include "HsVersions.h"
diff --git a/compiler/simplCore/SimplEnv.lhs b/compiler/simplCore/SimplEnv.lhs
index 5f1013def8..1c5ebc501b 100644
--- a/compiler/simplCore/SimplEnv.lhs
+++ b/compiler/simplCore/SimplEnv.lhs
@@ -4,6 +4,8 @@
\section[SimplMonad]{The simplifier Monad}
\begin{code}
+{-# LANGUAGE CPP #-}
+
module SimplEnv (
InId, InBind, InExpr, InAlt, InArg, InType, InBndr, InVar,
OutId, OutTyVar, OutBind, OutExpr, OutAlt, OutArg, OutType, OutBndr, OutVar,
diff --git a/compiler/simplCore/SimplUtils.lhs b/compiler/simplCore/SimplUtils.lhs
index 59e5d4adc1..14789c44a4 100644
--- a/compiler/simplCore/SimplUtils.lhs
+++ b/compiler/simplCore/SimplUtils.lhs
@@ -4,6 +4,8 @@
\section[SimplUtils]{The simplifier utilities}
\begin{code}
+{-# LANGUAGE CPP #-}
+
module SimplUtils (
-- Rebuilding
mkLam, mkCase, prepareAlts, tryEtaExpandRhs,
diff --git a/compiler/simplCore/Simplify.lhs b/compiler/simplCore/Simplify.lhs
index 02470be050..1125c2e883 100644
--- a/compiler/simplCore/Simplify.lhs
+++ b/compiler/simplCore/Simplify.lhs
@@ -4,6 +4,8 @@
\section[Simplify]{The main module of the simplifier}
\begin{code}
+{-# LANGUAGE CPP #-}
+
module Simplify ( simplTopBinds, simplExpr ) where
#include "HsVersions.h"
@@ -219,9 +221,7 @@ simplTopBinds env0 binds0
-- It's rather as if the top-level binders were imported.
-- See note [Glomming] in OccurAnal.
; env1 <- simplRecBndrs env0 (bindersOfBinds binds0)
- ; dflags <- getDynFlags
- ; let dump_flag = dopt Opt_D_verbose_core2core dflags
- ; env2 <- simpl_binds dump_flag env1 binds0
+ ; env2 <- simpl_binds env1 binds0
; freeTick SimplifierDone
; return env2 }
where
@@ -229,16 +229,10 @@ simplTopBinds env0 binds0
-- they should have their fragile IdInfo zapped (notably occurrence info)
-- That's why we run down binds and bndrs' simultaneously.
--
- -- The dump-flag emits a trace for each top-level binding, which
- -- helps to locate the tracing for inlining and rule firing
- simpl_binds :: Bool -> SimplEnv -> [InBind] -> SimplM SimplEnv
- simpl_binds _ env [] = return env
- simpl_binds dump env (bind:binds) = do { env' <- trace_bind dump bind $
- simpl_bind env bind
- ; simpl_binds dump env' binds }
-
- trace_bind True bind = pprTrace "SimplBind" (ppr (bindersOf bind))
- trace_bind False _ = \x -> x
+ simpl_binds :: SimplEnv -> [InBind] -> SimplM SimplEnv
+ simpl_binds env [] = return env
+ simpl_binds env (bind:binds) = do { env' <- simpl_bind env bind
+ ; simpl_binds env' binds }
simpl_bind env (Rec pairs) = simplRecBind env TopLevel pairs
simpl_bind env (NonRec b r) = simplRecOrTopPair env' TopLevel NonRecursive b b' r
@@ -293,12 +287,21 @@ simplRecOrTopPair :: SimplEnv
-> SimplM SimplEnv -- Returns an env that includes the binding
simplRecOrTopPair env top_lvl is_rec old_bndr new_bndr rhs
- = do dflags <- getDynFlags
- -- Check for unconditional inline
- if preInlineUnconditionally dflags env top_lvl old_bndr rhs
+ = do { dflags <- getDynFlags
+ ; trace_bind dflags $
+ if preInlineUnconditionally dflags env top_lvl old_bndr rhs
+ -- Check for unconditional inline
then do tick (PreInlineUnconditionally old_bndr)
return (extendIdSubst env old_bndr (mkContEx env rhs))
- else simplLazyBind env top_lvl is_rec old_bndr new_bndr rhs env
+ else simplLazyBind env top_lvl is_rec old_bndr new_bndr rhs env }
+ where
+ trace_bind dflags thing_inside
+ | not (dopt Opt_D_verbose_core2core dflags)
+ = thing_inside
+ | otherwise
+ = pprTrace "SimplBind" (ppr old_bndr) thing_inside
+ -- trace_bind emits a trace for each top-level binding, which
+ -- helps to locate the tracing for inlining and rule firing
\end{code}