Runnig a compiler plugin over ALL code

Matthew Pickering matthewtpickering at gmail.com
Wed Feb 9 11:18:35 UTC 2022


The imagine the plugin doesn't run over that definition because it
doesn't exist when your plugin runs. I imagine it's a core plugin, so
you might need to run it earlier in the pipeline?

Matt

On Wed, Feb 9, 2022 at 11:16 AM Tillmann Vogt via ghc-devs
<ghc-devs at haskell.org> wrote:
>
> Hi,
>
> I am running a compiler plugin over hundreds of libraries to extract
> statistical data. I use the plugin like it is done here:
>
> https://github.com/coot/ghc-tags-plugin
>
> So I just have to add a cabal.project.local to a library with:
>
>
> ignore-project: False
>
> package test
>      ghc-options: -package-db=/home/till/.cabal/store/ghc-8.10.7/package.db
>                   -plugin-package=ghc-core-graph
>                   -fplugin=GhcPlugins.Optimind
>
> But unfortunately the plugin only runs over code that is used in the
> main function or that is used in other functions.
>
> Example:
>
> main = putStrLn (show (f 0))
>
> f x = sin x
>
> g = h + i
>
> Then the compiler plugin only runs over f, h, i   but not not g (unused
> top level functions).
>
> Can the plugin be forced to run over all code?
>
> -Tillmann
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


More information about the ghc-devs mailing list