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