34 #ifndef MC2LIB_MEMCONSISTENCY_EVENTSETS_HPP_ 35 #define MC2LIB_MEMCONSISTENCY_EVENTSETS_HPP_ 42 #include "../sets.hpp" 43 #include "../types.hpp" 51 namespace memconsistency {
58 return std::hash<types::Poi>()(k.
poi);
66 operator std::string()
const {
67 std::ostringstream oss;
68 oss <<
"P" << std::setfill(
'0') << std::setw(2) <<
pid <<
": " 69 << std::setfill(
'0') << std::setw(
sizeof(
types::Poi) * 2) << std::hex
115 static constexpr Type kNone = 0x00000000;
118 static constexpr Type kRead = 0x00000001;
119 static constexpr Type kWrite = 0x00000002;
120 static constexpr Type kAcquire = 0x00000004;
121 static constexpr Type kRelease = 0x00000008;
122 static constexpr Type kMemoryOperation = kRead | kWrite | kAcquire | kRelease;
125 static constexpr Type kRegInAddr = 0x00000010;
126 static constexpr Type kRegInData = 0x00000020;
127 static constexpr Type kRegOut = 0x00000040;
128 static constexpr Type kBranch = 0x00000080;
131 static constexpr Type kNext = 0x00000100;
138 : addr(addr_), type(type_), iiid(iiid_) {}
140 operator std::string()
const {
141 std::ostringstream oss;
142 oss <<
"[" <<
static_cast<std::string
>(iiid) <<
"] ";
144 std::ostringstream memtype;
149 bool found_type =
false;
151 if (AllType(kRead)) {
156 if (AllType(kWrite)) {
157 memtype << (found_type ?
"|" :
"") <<
"Write";
161 if (AllType(kAcquire)) {
162 memtype << (found_type ?
"|" :
"") <<
"Acquire";
166 if (AllType(kRelease)) {
167 memtype << (found_type ?
"|" :
"") <<
"Release";
171 if (AllType(kRegInAddr)) {
172 memtype << (found_type ?
"|" :
"") <<
"RegInAddr";
176 if (AllType(kRegInData)) {
177 memtype << (found_type ?
"|" :
"") <<
"RegInData";
181 if (AllType(kRegOut)) {
182 memtype << (found_type ?
"|" :
"") <<
"RegOut";
186 if (AllType(kBranch)) {
187 memtype << (found_type ?
"|" :
"") <<
"Branch";
192 oss << std::setfill(
' ') << std::setw(8) << memtype.str() <<
" @ " 198 return type == rhs.
type && addr == rhs.
addr && iiid == rhs.
iiid;
202 return type != rhs.
type || addr != rhs.
addr || iiid != rhs.
iiid;
227 class Error :
public std::logic_error {
231 using std::logic_error::logic_error;
233 explicit Error(
const std::string& what_arg) : std::logic_error(what_arg) {}
235 explicit Error(
const char* what_arg) : std::logic_error(what_arg) {}
Definition: eventsets.hpp:227
Iiid Prev() const
Definition: eventsets.hpp:93
bool AllType(Type type_mask) const
Definition: eventsets.hpp:209
bool AnyBitmask(T mask, T any)
Definition: sets.hpp:73
Iiid(types::Pid pid_, types::Poi poi_)
Definition: eventsets.hpp:64
bool AnyType(Type type_mask) const
Definition: eventsets.hpp:213
Types< true >::Poi Poi
Program order index type.
Definition: types.hpp:76
Event(Type type_, types::Addr addr_, const Iiid &iiid_)
Definition: eventsets.hpp:137
bool operator!=(const Event &rhs) const
Definition: eventsets.hpp:201
sets::Set< sets::Types< Event > > EventSet
Definition: eventsets.hpp:223
Iiid Next() const
Definition: eventsets.hpp:91
Error(const std::string &what_arg)
Definition: eventsets.hpp:233
Definition: eventsets.hpp:53
bool operator==(const Iiid &rhs) const
Definition: eventsets.hpp:74
std::uint32_t Type
Definition: eventsets.hpp:111
Definition: eventsets.hpp:55
Iiid iiid
Definition: eventsets.hpp:220
Iiid()
Definition: eventsets.hpp:62
bool operator<(const Iiid &rhs) const
Definition: eventsets.hpp:82
bool AllBitmask(T mask, T all)
Definition: sets.hpp:60
Definition: eventsets.hpp:103
sets::RelationSeq< sets::Types< Event > > EventRelSeq
Definition: eventsets.hpp:225
bool operator==(const Event &rhs) const
Definition: eventsets.hpp:197
Iiid & operator++()
Definition: eventsets.hpp:86
bool operator!=(const Iiid &rhs) const
Definition: eventsets.hpp:78
Abstracts over container library's set implementation.
Definition: sets.hpp:85
Iiid::Hash::result_type operator()(const Event &k) const
Definition: eventsets.hpp:106
Error(const char *what_arg)
Definition: eventsets.hpp:235
sets::Relation< sets::Types< Event > > EventRel
Definition: eventsets.hpp:224
bool operator<(const Event &rhs) const
Definition: eventsets.hpp:207
std::hash< types::Poi >::result_type result_type
Definition: eventsets.hpp:56
types::Addr addr
Definition: eventsets.hpp:218
Types< true >::Addr Addr
Address type.
Definition: types.hpp:66
Definition: eventsets.hpp:105
types::Pid pid
Definition: eventsets.hpp:99
Types< true >::Pid Pid
Processor/thread ID type.
Definition: types.hpp:71
Definition: sets.hpp:1310
Event()
Definition: eventsets.hpp:135
result_type operator()(const Iiid &k) const
Definition: eventsets.hpp:57
types::Poi poi
Definition: eventsets.hpp:100
Type type
Definition: eventsets.hpp:219