behaviour of {-# NOINLINE #-} in where clauses
Bulat Ziganshin
bulat.ziganshin at gmail.com
Mon Aug 14 11:51:36 EDT 2006
Hello Duncan,
Monday, August 14, 2006, 2:33:31 AM, you wrote:
> Reversing the test doesn't help because either way ghc turns it into:
> case thing of
> _DEFAULT ->
> 4096 ->
to be exact, ghc passes code for default case separately from code for
other cases. look at emitSwitch procedure to know why it's required
> and from that generates CMM:
> if (thing != 4096) goto much_later;
> ...
> much_later:
> ...
can't you use 'if' expressions?
> Even so, I kind of wish there were a stage between STG and CMM that
> showed the imperative model of STG with linear layout, control flow and
> notes to indicate thunk/closure allocations. I expect most of my problem
> is that I do not understand the STG evaluation model sufficiently well
> to see how it maps to basic blocks, jumps/calls etc.
i once tried to understood STG->CMM code generation. it's all in
codeGen directory of ghc sources. and now i think that STG is pretty
low-level imperative language, not harder than C for example. i even
had the idea to write STG->C translator that generates efficient code.
on the other side, jhc already contains pretty the same thing (John
claims that jhc's internal language is close to STG)
--
Best regards,
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Glasgow-haskell-users
mailing list