-
Notifications
You must be signed in to change notification settings - Fork 448
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace boost::container::flat_map with absl::btree_map in P4Tools. (#…
…4768) * Make SymbolicVariable part of the core IR. (#4840) Signed-off-by: fruffy <[email protected]> * Replace boost::container::flat_map with absl::btree_map in P4Tools. Signed-off-by: fruffy <[email protected]> * Review comments. Signed-off-by: fruffy <[email protected]> * Rebase on solver move PR. Signed-off-by: fruffy <[email protected]> --------- Signed-off-by: fruffy <[email protected]>
- Loading branch information
Showing
12 changed files
with
77 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef BACKENDS_P4TOOLS_COMMON_LIB_IR_COMPARE_H_ | ||
#define BACKENDS_P4TOOLS_COMMON_LIB_IR_COMPARE_H_ | ||
|
||
#include "ir/ir.h" | ||
|
||
namespace IR { | ||
|
||
/// Equals for StateVariable pointers. We only compare the label. | ||
struct StateVariableEqual { | ||
bool operator()(const IR::StateVariable *s1, const IR::StateVariable *s2) const { | ||
return s1->equiv(*s2); | ||
} | ||
bool operator()(const IR::StateVariable &s1, const IR::StateVariable &s2) const { | ||
return s1.equiv(s2); | ||
} | ||
}; | ||
|
||
/// Less for StateVariable pointers. We only compare the label. | ||
struct StateVariableLess { | ||
bool operator()(const IR::StateVariable *s1, const IR::StateVariable *s2) const { | ||
return *s1 < *s2; | ||
} | ||
bool operator()(const IR::StateVariable &s1, const IR::StateVariable &s2) const { | ||
return s1 < s2; | ||
} | ||
}; | ||
|
||
} // namespace IR | ||
#endif /* BACKENDS_P4TOOLS_COMMON_LIB_IR_COMPARE_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters