I’ve been rewriting PDT, the auto-instrumenter that works with TAU (PDT - Program Database Toolkit -), using Clang’s libtooling for the C and C++ side of things, but the original PDT can also instrument Fortran.
Is there a Flang equivalent to libtooling that can provide access to the AST, either existing in LLVM or in progress? If not, is there any work being done on that front, or any kind of ETA on when something like this might be available?
Hi @alisterj ,
It’s great to see some interest in this direction! Sadly, this is not yet available in Flang. We’ve recently had a discussion about this internally. Basically, we need a volunteer to help us with this I can point people in the right direction, but I won’t have the bandwidth to work on this any time soon. I am not aware of anyone else looking into it.
As a side note, we’ve been wondering whether there would be any demand for this. Many thanks for bringing this up, it sounds like it would helpful!
Thanks for the reply Andrzej! I also don’t have the bandwidth to work on this right now, but do you have an idea how much work it would take or the major steps that would be necessary? (Maybe I can make time between my dissertation and other projects )
I do think there would be a demand for this. I can imagine a lot of people who would like to have better analysis and transformation tools for Fortran (especially modern Fortran), most of the tools that currently exist don’t have nearly as broad a developer/user community as MLIR/LLVM and don’t support all the new Fortran features.
Hi @alisterj ,
Apologies for the delay, I completely missed you reply! I should’ve configured Discourse to send me e-mail notifications.
I think that first we should introduce a plugin API to allow injecting custom frontend actions. This should be relatively easy as most of the APIs come from LLVM (i.e. these are already available for re-use). Once that’s complete, we could consider the libTooling API. Looking at the implementation in Clang makes me think that that’s a rather non-trivial API. But we could try identifying a basic set of required functionalities and start with that.
As for the plugin API, we are looking into this internally right now and I am hoping that we will have something to share for LLVM 13 !