P4C
The P4 Compiler
Loading...
Searching...
No Matches
cluster_phv_operations.h
1
19#ifndef BF_P4C_PHV_CLUSTER_PHV_OPERATIONS_H_
20#define BF_P4C_PHV_CLUSTER_PHV_OPERATIONS_H_
21
22#include "bf-p4c/ir/thread_visitor.h"
23#include "bf-p4c/phv/phv.h"
24#include "bf-p4c/phv/phv_parde_mau_use.h"
25#include "ir/ir.h"
26#include "lib/map.h"
27#include "lib/ordered_map.h"
28#include "lib/range.h"
29
30namespace PHV {
31class Field;
32} // namespace PHV
33
34class PhvInfo;
35
48 static constexpr int SALU_HASH_SOURCE_LIMIT = 51;
49
50 public:
64
65 // The following instructions are shift instructions, for which
66 // even the sources should have a no-pack property.
67 static const ordered_set<cstring> SHIFT_OPS;
68
69 // The following instructions are saturating instructions, for which
70 // even the sources shoudl have a no-pack property.
71 static const ordered_set<cstring> SATURATE_OPS;
72
73 private:
74 PhvInfo &phv;
75
76 // Strip down version of input_xbar.cpp FindSaluSources
77 class Find_Salu_Sources : public Inspector {
78 const PhvInfo &phv;
79
80 bool preorder(const IR::MAU::SaluAction *) override;
81 bool preorder(const IR::Expression *e) override;
82 bool preorder(const IR::MAU::HashDist *) override;
83 bool preorder(const IR::MAU::IXBarExpression *) override;
85 bool preorder(const IR::Annotation *) override { return false; }
86 bool preorder(const IR::Declaration_Instance *) override { return false; }
87 bool preorder(const IR::MAU::Selector *) override { return false; }
88
89 static void collapse_contained(std::map<le_bitrange, const IR::Expression *> &m);
90
91 public:
92 explicit Find_Salu_Sources(const PhvInfo &phv) : phv(phv) {}
93
95 std::vector<const IR::MAU::IXBarExpression *> hash_sources;
96 };
97
98 void processSaluInst(const IR::MAU::Instruction *);
99 void processInst(const IR::MAU::Instruction *);
100 bool preorder(const IR::MAU::Instruction *) override;
101
102 public:
103 explicit PHV_Field_Operations(PhvInfo &phv_f) : phv(phv_f) {}
104};
105
106#endif /* BF_P4C_PHV_CLUSTER_PHV_OPERATIONS_H_ */
Definition visitor.h:400
Definition ordered_map.h:32
Definition ordered_set.h:32
Annotate each Field in PhvInfo with the instructions it's involved in.
Definition cluster_phv_operations.h:47
static const ordered_set< cstring > BITWISE_OPS
Definition cluster_phv_operations.h:26
Definition phv_fields.h:1095
The namespace encapsulating PHV-related stuff.
Definition gateway.h:32