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

Replace ref by literal #2828

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

hbrunie
Copy link
Collaborator

@hbrunie hbrunie commented Dec 17, 2024

Replacing PsyIR Reference by PsyIR Literal when it is easy to do so.
Same file, same subroutine, or subroutine contained in module.
Build a param_table with symbol name and Literal, then go through psyir references and symbol_table array type shapes to look for ref with name contained in param_table.

Issues:

  • it seems that initial value will always be a literal, is this expected behavior? If so I can remove a test raise error not triggered yet.
  • I might have found a bug: `character(len=4), parameter :: x = "toto" is not parsed a a is_constant.

@hbrunie hbrunie requested a review from arporter December 17, 2024 10:39
@hbrunie hbrunie self-assigned this Dec 17, 2024
@hbrunie hbrunie requested a review from sergisiso December 17, 2024 10:40
@hbrunie hbrunie added ready for review PSyIR Core PSyIR functionality labels Dec 17, 2024
@arporter
Copy link
Member

  • it seems that initial value will always be a literal, is this expected behavior? If so I can remove a test raise error not triggered yet.

Thanks Hugo. I'm pretty sure we allow any PSyIR expression as an initial value?

@hbrunie
Copy link
Collaborator Author

hbrunie commented Dec 17, 2024

  • it seems that initial value will always be a literal, is this expected behavior? If so I can remove a test raise error not triggered yet.

Thanks Hugo. I'm pretty sure we allow any PSyIR expression as an initial value?

Thanks. I made a test showing the current limit of this MR with respect to non-literal initial value (for example a binary operation).

But I don't understand why
character (len=4), parameter :: x ="toto" does not make a constant symbol with initial_value being

@arporter
Copy link
Member

But I don't understand why
character (len=4), parameter :: x ="toto" does not make a constant symbol with initial_value being

I think that's because we don't support the len=xxx specification on a character declaration.

Copy link

codecov bot commented Dec 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.88%. Comparing base (2d1f953) to head (5387311).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2828   +/-   ##
=======================================
  Coverage   99.88%   99.88%           
=======================================
  Files         357      358    +1     
  Lines       49742    49806   +64     
=======================================
+ Hits        49686    49750   +64     
  Misses         56       56           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hbrunie
Copy link
Collaborator Author

hbrunie commented Dec 17, 2024

But I don't understand why
character (len=4), parameter :: x ="toto" does not make a constant symbol with initial_value being

I think that's because we don't support the len=xxx specification on a character declaration.

That's ok. I don't deal with "complex" right hand side for now. If this is not a Literal, the parameter is just ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PSyIR Core PSyIR functionality ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants