Skip to content

Commit

Permalink
Rebase on solver move PR.
Browse files Browse the repository at this point in the history
Signed-off-by: fruffy <[email protected]>
  • Loading branch information
fruffy committed Aug 1, 2024
1 parent cee3928 commit a37fe7b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 21 deletions.
20 changes: 0 additions & 20 deletions backends/p4tools/common/lib/ir_compare.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,5 @@ struct StateVariableLess {
}
};

/// Equals for SymbolicVariable pointers. We only compare the label.
struct SymbolicVariableEqual {
bool operator()(const IR::SymbolicVariable *s1, const IR::SymbolicVariable *s2) const {
return s1->label == s2->label;
}
bool operator()(const IR::SymbolicVariable &s1, const IR::SymbolicVariable &s2) const {
return s1.label == s2.label;
}
};

/// Less for SymbolicVariable pointers. We only compare the label.
struct SymbolicVariableLess {
bool operator()(const IR::SymbolicVariable *s1, const IR::SymbolicVariable *s2) const {
return *s1 < *s2;
}
bool operator()(const IR::SymbolicVariable &s1, const IR::SymbolicVariable &s2) const {
return s1 < s2;
}
};

} // namespace IR
#endif /* BACKENDS_P4TOOLS_COMMON_LIB_IR_COMPARE_H_ */
29 changes: 29 additions & 0 deletions ir/compare.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#ifndef IR_COMPARE_H_
#define IR_COMPARE_H_

#include "ir/ir.h"

namespace IR {

/// Equals for SymbolicVariable pointers. We only compare the label.
struct SymbolicVariableEqual {
bool operator()(const IR::SymbolicVariable *s1, const IR::SymbolicVariable *s2) const {
return s1->label == s2->label;
}
bool operator()(const IR::SymbolicVariable &s1, const IR::SymbolicVariable &s2) const {
return s1.label == s2.label;
}
};

/// Less for SymbolicVariable pointers. We only compare the label.
struct SymbolicVariableLess {
bool operator()(const IR::SymbolicVariable *s1, const IR::SymbolicVariable *s2) const {
return *s1 < *s2;
}
bool operator()(const IR::SymbolicVariable &s1, const IR::SymbolicVariable &s2) const {
return s1 < s2;
}
};

} // namespace IR
#endif /* IR_COMPARE_H_ */
2 changes: 1 addition & 1 deletion ir/solver.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <vector>

#include "absl/container/btree_map.h"
#include "backends/p4tools/common/lib/ir_compare.h"
#include "ir/compare.h"
#include "ir/ir.h"
#include "lib/castable.h"
#include "lib/cstring.h"
Expand Down

0 comments on commit a37fe7b

Please sign in to comment.