diff options
author | simonpj <unknown> | 2003-02-20 18:33:55 +0000 |
---|---|---|
committer | simonpj <unknown> | 2003-02-20 18:33:55 +0000 |
commit | 56b5a8b862d4eaeeaa941dd53e3d1009bdeadc0d (patch) | |
tree | 6bad69fec74d502a12abb8dcb912593a8356d484 /ghc/compiler/deSugar/DsExpr.lhs | |
parent | 8589a69045e96e56f2f4e8cced1bdfc486355623 (diff) | |
download | haskell-56b5a8b862d4eaeeaa941dd53e3d1009bdeadc0d.tar.gz |
[project @ 2003-02-20 18:33:50 by simonpj]
-------------------------------------
Add Core Notes and the {-# CORE #-} pragma
-------------------------------------
This is an idea of Hal Daume's. The key point is that Notes in Core
are augmented thus:
data Note
= SCC CostCentre
| ...
| CoreNote String -- NEW
These notes can be injected via a Haskell-source pragma:
f x = ({-# CORE "foo" #-} show) ({-# CORE "bar" #-} x)
This wraps a (Note (CoreNote "foo")) around the 'show' variable,
and a similar note around the argument to 'show'.
These notes are basically ignored by GHC, but are emitted into
External Core, where they may convey useful information.
Exactly how code involving these notes is munged by the simplifier
isn't very well defined. We'll see how it pans out. Meanwhile
the impact on the rest of the compiler is minimal.
Diffstat (limited to 'ghc/compiler/deSugar/DsExpr.lhs')
-rw-r--r-- | ghc/compiler/deSugar/DsExpr.lhs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ghc/compiler/deSugar/DsExpr.lhs b/ghc/compiler/deSugar/DsExpr.lhs index 6ae0d0c8ab..3a31d90c81 100644 --- a/ghc/compiler/deSugar/DsExpr.lhs +++ b/ghc/compiler/deSugar/DsExpr.lhs @@ -241,6 +241,13 @@ dsExpr (HsSCC cc expr) getModuleDs `thenDs` \ mod_name -> returnDs (Note (SCC (mkUserCC cc mod_name)) core_expr) + +-- hdaume: core annotation + +dsExpr (HsCoreAnn fs expr) + = dsExpr expr `thenDs` \ core_expr -> + returnDs (Note (CoreNote $ unpackFS fs) core_expr) + -- special case to handle unboxed tuple patterns. dsExpr (HsCase discrim matches src_loc) |