P4C
The P4 Compiler
Loading...
Searching...
No Matches
match_register.h
1
19#ifndef BACKENDS_TOFINO_BF_P4C_PARDE_MATCH_REGISTER_H_
20#define BACKENDS_TOFINO_BF_P4C_PARDE_MATCH_REGISTER_H_
21
22#include <iostream>
23
24#include "lib/cstring.h"
25
26namespace P4 {
27
28class JSONGenerator;
29class JSONLoader;
30
32 public:
34 explicit MatchRegister(cstring);
35
36 cstring toString() const;
37
38 bool operator==(const MatchRegister &other) const { return name == other.name; }
39
41 void toJSON(JSONGenerator &json) const;
42 static MatchRegister fromJSON(JSONLoader &json);
43
44 cstring name;
45 size_t size;
46 int id;
47
48 static int s_id;
49
50 bool operator<(const MatchRegister &other) const {
51 if (size < other.size) return true;
52 if (other.size < size) return false;
53 if (id < other.id) return true;
54 if (other.id > id) return false;
55 return false;
56 }
57
58 friend std::ostream &operator<<(std::ostream &out, const MatchRegister &c);
59};
60
61inline std::ostream &operator<<(std::ostream &out, const MatchRegister &c) { return out << c.name; }
62
63} // namespace P4
64
65#endif /* BACKENDS_TOFINO_BF_P4C_PARDE_MATCH_REGISTER_H_ */
Definition json_generator.h:37
Definition json_loader.h:39
Definition match_register.h:31
void toJSON(JSONGenerator &json) const
JSON serialization/deserialization.
Definition match_register.cpp:46
static int s_id
Definition match_register.h:48
Definition cstring.h:85
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24