-
Notifications
You must be signed in to change notification settings - Fork 444
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
Make StateVariable an IR class that accepts IR::Member. Use ICastable for some nodes. #3741
Conversation
b3a31c6
to
a3ea011
Compare
a3ea011
to
3cbd156
Compare
30dccf6
to
82d7547
Compare
@@ -28,7 +27,7 @@ namespace P4Tools::P4Testgen { | |||
/// are present, but not expressions. The reason expressions need to be keys is that sometimes | |||
/// entire expressions are mapped to a particular constant. | |||
using ConcolicVariableMap = | |||
ordered_map<std::variant<const StateVariable, const IR::Expression *>, const IR::Expression *>; | |||
std::map<std::variant<const IR::StateVariable, const IR::Expression *>, const IR::Expression *>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the ordering of any of these maps and sets matter - do we need them for deterministic behavior when passing the same seed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, that was a rebase mistake, good catch!
@@ -64,8 +63,9 @@ const Model *TestBackEnd::computeConcolicVariables(const ExecutionState *executi | |||
const auto *concolicAssignment = resolvedConcolicVariable.second; | |||
const IR::Expression *pathConstraint = nullptr; | |||
// We need to differentiate between state variables and expressions here. | |||
if (std::holds_alternative<const StateVariable>(concolicVariable)) { | |||
pathConstraint = new IR::Equ(std::get<const StateVariable>(concolicVariable), | |||
// We need to differentiate between state variables and expressions here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repeated comment.
@@ -125,9 +125,9 @@ void test(const IR::Expression *expression, const IR::AssignmentStatement *varia | |||
Model model = *solver.getModel(); | |||
ASSERT_EQ(model.size(), 2u); | |||
|
|||
ASSERT_EQ(model.count(variableValue->left), 1u); | |||
ASSERT_EQ(model.count(variableValue->left->checkedTo<IR::Member>()), 1u); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1U
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@mbudiu-vmw This adds new operators to the syntax in the ir-generator yacc file. Any potential issues that could arise here? |
You probably mean that you have a new .def file. That should always work. |
I was referring to the edits here: The syntax was missing |
The file in question has been written entirely by @ChrisDodd |
e1e3688
to
183432f
Compare
183432f
to
25c9f67
Compare
8dfee6b
to
087132a
Compare
Some preparation for #3519. Remove implicit casting from StateVariable and explicitly require IR::Member as initializer argument.
This required a small change to ir-generator.ypp. Those operators were not part of the syntax.