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

Improving struct pruning #19

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

robotrobo
Copy link
Collaborator

Continues work from issue #5 , follows from PR #14.

@robotrobo robotrobo requested a review from fruffy March 10, 2022 02:52
@robotrobo
Copy link
Collaborator Author

I was trying to improve the ListStructs inspector and found this :-
Lets say we have a struct abcd which has three fields initially. Now, we have a method call in our p4 program,
methodA({0w10,0w1,0w2}) where methodA takes an argument of type abcd, but, our pruner removes all the fields of abcd because they are not accessed anywhere else. So, how do we tell ListStructs that this ListExpression tuple will be the initializerList for a particular struct. Inside IR::MethodCallExpression, there is a vector called typeArguments, but they currently seem to be empty. Maybe we will need to populate the typeMap?

@fruffy
Copy link
Contributor

fruffy commented Mar 11, 2022

Usually, you can tell the type of the structure by looking up the method declaration. So in this case, you would look up the declaration of methodA and check what the type of the parameter is. We can use the refmap and typeChecking for this if you want to. With the refMap and the typeMap you should be able to look up such declarations.

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.

2 participants