Skip to content

[CGFCOLLECTOR] Adding Fortran call graph collector#115

Open
gomfol12 wants to merge 143 commits intotudasc:develfrom
gomfol12:fortran_collector
Open

[CGFCOLLECTOR] Adding Fortran call graph collector#115
gomfol12 wants to merge 143 commits intotudasc:develfrom
gomfol12:fortran_collector

Conversation

@gomfol12
Copy link
Contributor

@gomfol12 gomfol12 commented Feb 5, 2026

This adds a call graph collector for Fortran. The collector is implemented as a flang plugin and generates a call graph from source-level. See the tests for a list of language features this plugin covers.

This pull request is quite large, but it is not really possible splitting it in multiply requests without pushing broken code. The tests could be separate into a different pull request, but they are tightly coupled with the collector and would fail without it, so I think keeping it in one pull request makes sense.

What this adds:

  • new directory cgfcollector that includes flang plugin, tests, tools, etc.
  • flang plugin that generates call graph in metacg format.
  • two wrapper script cgfcollector_wrapper.sh and cgfcollector_comp_wrapper.sh that simplify running the plugin.
  • cgCompare tool: for comparing two call graphs (can be replaced with cgdiff)
  • another test runner

How to run: see cgfcollector/README.md

The commit history is a mess, and I don't know how strongly you value a clean git history and if I should clean this up.

Copy link
Member

@pearzt pearzt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for all the work, the structure looks really good. I have some initial comments, but I will try to do a more in-depth review soon.

Copy link
Member

@jplehr jplehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this.

I did an initial brief pass, please go through the comments and address them.

One more question: Does this PR as-is already run CI pipelines? If not, please add it to the CI pipelines as appropriate.


std::string cgString = dumpCG();

std::unique_ptr<llvm::raw_pwrite_stream> file = ::createOutputFile(getInstance(), getCurrentFile(), "");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be problematic in parallel CI runs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why this could be problematic. Every test case operates on its own set of files and is only run once, per CI run.

@pearzt
Copy link
Member

pearzt commented Feb 17, 2026

Please rebase this onto the most current devel.

Copy link
Member

@jplehr jplehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another round of comments

@gomfol12 gomfol12 changed the title Adding Fortran call graph collector [CGFCOLLECTOR] Adding Fortran call graph collector Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants