Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enrichment/interprocedural information from interfaces instead of full source parse #475

Open
ecossevin opened this issue Jan 15, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@ecossevin
Copy link

Is your feature request related to a problem? Please describe.

Source_callee = Sourcefile.from_file('callee.F90') source_caller = Sourcefile.from_file('caller.F90', definitions=source_callee.definitions)

When there is a call to a subroutine in a piece of code where i'm doing dataflowanalysis : I would like to be able to use an interface as a definition here. In order to avoid to parse and generate the ir of the whole routine when I just need the arguments intent.

I would be pleased to help you adding this feature to loki.

Describe the solution you'd like

I don't know if reading the interface can allow to know .defines_symbols and .uses_symbols, or if reading the interface can only show which variable are read only and read write.

Describe alternatives you've considered

I wrote some code to read the interface and update which variables where read only and which one where read write.

Additional context

SUBROUTINE CALLER() REAL :: A, B, C, D, E pragma region1 A = B + 1 C = A CALL CALLEE(D, E) end pragma region 1 END SUBROUTINE CALLER
In this example, I would like to know which variables are read only and which one are read write, without reading the whole calle.F90 file. But just callee.intfb.F90 (the interface).

Organisation

météo france

@ecossevin ecossevin added the enhancement New feature or request label Jan 15, 2025
@reuterbal reuterbal changed the title enrich dataflow analysis with interface Enrichment/interprocedural information from interfaces instead of full source parse Jan 16, 2025
@reuterbal
Copy link
Collaborator

Thanks @ecossevin, I find this an appealing idea. I had briefly raised this as an idea in #310 but your description is more complete, so copying my comment here and closing the other issue:

As suggested by @ecossevin , we should add a utility that can parse the interface blocks in .intfb.h header files directly to extract enrichment information for call statements. This could potentially be implemented via the REGEX frontend, thus removing the need to feed this through a full frontend like fparser.

The key idea from my point of view would be to implement enrichment (i.e., the annotation with interprocedural information) from interfaces instead of full source files. This makes the required information automatically available to dataflow analysis in the usual way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants