You need a full data stream to search for dependencies. Then you will need to actually insert OpenMP calls.
What you want is a program conversion system. GCC probably has dependency information, but for custom projects, working with them is quite difficult. Others mentioned Klang and Rose. Clang may be a worthy choice, but user analysis / transformation is not its main goal. Rose is designed to support custom tools, but IMHO is a fairly complex scheme, used in practice due to the use of the front end of the EDG, which is not intended to support conversion.
[NEXT TEXT DELETE BY MODERATOR. I HAVE THIS BACK, BECAUSE THIS IS ONE VALID TRANSFORMATION SYSTEM FOR THIS TASK. THE FACT THAT I AM RESPONSIBLE FOR THIS, UNDER ANY CIRCUMSTANCES WITHOUT LIMITING ITS VALUE AS A USEFUL ANSWER TO OP.]
Our DMS software reengineering toolkit with its front end C is clearly designed as a program conversion system. It has a complete data flow analysis (including point analysis, call schedule analysis and range analysis), linked to AST in a reasonable way. It provides initial rewriting rules that allow you to change AST expressed in the form of surface syntax; you can read conversions, not check a bunch of procedural code. With the modified AST, DMS can regenerate the source code, including comments in compiled form.
source share