Skip to content

Split variable adder and constrain variable passes #446

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

Closed
wants to merge 3 commits into from

Conversation

kyleheadley
Copy link
Member

By creating and merging all FV's at once, we avoid alterations introduced by the constraints on them. Merging is simpler and solves #427. Hopefully, this allows us to remove code later that dealing with the complexity, like the various brainTransplant methods.

The Typedef map needed to be populated in the variable adder stage, or it wasn't available in time.

Copy link
Collaborator

@john-h-kastner john-h-kastner left a comment

Choose a reason for hiding this comment

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

one suggestion

@@ -199,10 +203,6 @@ class ProgramInfo : public ProgramVariableAdder {
// Retrieves a FVConstraint* from a Decl (which could be static, or global)
FVConstraint *getFuncFVConstraint(FunctionDecl *FD, ASTContext *C);

// For each pointer type in the declaration of D, add a variable to the
// constraint system for that pointer type.
void addVariable(clang::DeclaratorDecl *D, clang::ASTContext *AstContext);
Copy link
Collaborator

@john-h-kastner john-h-kastner Feb 24, 2021

Choose a reason for hiding this comment

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

This was originally made private so that it could be exposed by the ProgramVariableAdder interface used by VariableAdderVisitor. The idea was that only VariableAdderVisitor should be creating variables, so restricting access to this function makes it less likely that variables are added elsewhere.

It looks like you made this change because you need seenTypedef and addTypedef, so I suggest adding these functions to ProgramVariableAdder and keeping addVariable private.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, I forgot to ask about this. It looks like we have multiple interfaces, but only use one class. But this seems like a decent explanation so I'll follow your suggestion unless I hear otherwise.

@kyleheadley
Copy link
Member Author

This PR was intended to solve an immediate benchmark issue, but didn't get to run on the benchmarks until a more encompassing code change was produced (#463). The valuable parts have been incorporated into that change.

@kyleheadley kyleheadley closed this Mar 3, 2021
@kyleheadley kyleheadley deleted the split_add_constrain_passes branch March 8, 2021 18:37
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