[GHC] #10706: Make -fcpr-off a dynamic flag
GHC
ghc-devs at haskell.org
Wed Jul 29 15:21:53 UTC 2015
#10706: Make -fcpr-off a dynamic flag
-------------------------------------+-------------------------------------
Reporter: darchon | Owner: darchon
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.11
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Revisions: Phab:D1110
-------------------------------------+-------------------------------------
Comment (by darchon):
I have to confess that my use-case is very unconventional, perhaps even
contrived:
I work on a compiler that translates Haskell to circuits (www.clash-
lang.org), and I use Streams to model sequential circuits:
{{{
data Stream a = a :- Stream a
}}}
Given this model of a sequential circuit, appending an element to a
stream:
{{{
memory i s = i :- s
}}}
has a clear circuit semantics, it translates to a memory/latch.
However, decomposing a stream:
{{{
case s of i :- s' -> ...
}}}
would basically translate to "looking into the future", which cannot be
transformed into a circuit.
I have taken great care that, under normal conditions, a case statement
with a {{{Signal a}}} as a scrutinee never occurs. For one by not
exporting the constructor of the {{{Steam}}} data type.
However, due to the CPR analysis I sometimes end up with a worker/wrapper
that looks something like this:
{{{
case memory i s of
a :- bs -> g (#a,bs#)
g (#a,bs#) = a :- bs
}}}
which gives me the troublesome case-decomposition on the {{{Stream}}} data
type.
Now, as to why I want {{{-fcpr-off}}} to be a dynamic flag: All my
functions that manipulate the {{{Stream}}} type exist in a single module.
If these functions get no CPR annotations, I noticed that the above
troublesome worker/wrapper is never created elsewhere.
The CPR annotations do not bother me in any of my other modules, and I do
not want to turn off strictness analysis completely in the module where I
define my {{{Stream}}}-manipulating functions. Hence I would like to have
a {{{-fcpr-off}}} dynamic flag, so I can turn off CPR annotations just for
that single module.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10706#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list