How to inline early in a GHC plugin?
Simon Peyton Jones
simonpj at microsoft.com
Fri Dec 2 17:07:38 UTC 2016
I don’t really understand your question clearly. So I’ll guess
Unfoldings are added to Ids in Simplify.completeBind (look for setUnfoldingInfo). Apart from INLINE pragmas, that’s about the only place it happens.
Does that help?
From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Conal Elliott
Sent: 01 December 2016 21:51
To: ghc-devs at haskell.org
Subject: How to inline early in a GHC plugin?
I'm implementing a GHC plugin that installs a `BuiltInRule` that does the work, and I'd like to learn how to inline more flexibly. Given an identifier `v`, I'm using `maybeUnfoldingTemplate (realIdUnfolding v)` to get a `Maybe CoreExpr`. Sometimes this recipe yields `Nothing` until a later compiler phase. Meanwhile, I guess my variable `v` has been replaced by one with inlining info. First, am I understanding this mechanism correctly? A GHC source pointer to how inlining is made available would help me. Second, can I access the inlining info before it's made available to the rest of the simplifier?
Thanks, - Conal
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ghc-devs