Skip to content

Improving struct pruning - #19

Draft
robotrobo wants to merge 1 commit into
masterfrom
improve_struct_pruning
Draft

Improving struct pruning#19
robotrobo wants to merge 1 commit into
masterfrom
improve_struct_pruning

Conversation

@robotrobo

Copy link
Copy Markdown
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
Copy Markdown
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

fruffy commented Mar 11, 2022

Copy link
Copy Markdown
Contributor

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