@@ -91,6 +91,11 @@ namespace rdf {
91
91
bool operator < (const RegisterRef &RR) const {
92
92
return Reg < RR.Reg || (Reg == RR.Reg && Mask < RR.Mask );
93
93
}
94
+
95
+ size_t hash () const {
96
+ return std::hash<RegisterId>{}(Reg) ^
97
+ std::hash<LaneBitmask::Type>{}(Mask.getAsInteger ());
98
+ }
94
99
};
95
100
96
101
@@ -110,7 +115,11 @@ namespace rdf {
110
115
return RegMasks.get (Register::stackSlot2Index (R));
111
116
}
112
117
113
- RegisterRef normalize (RegisterRef RR) const ;
118
+ LLVM_ATTRIBUTE_DEPRECATED (RegisterRef normalize (RegisterRef RR),
119
+ "This function is now an identity function");
120
+ RegisterRef normalize (RegisterRef RR) const {
121
+ return RR;
122
+ }
114
123
115
124
bool alias (RegisterRef RA, RegisterRef RB) const {
116
125
if (!isRegMaskId (RA.Reg ))
@@ -128,6 +137,10 @@ namespace rdf {
128
137
return MaskInfos[Register::stackSlot2Index (MaskId)].Units ;
129
138
}
130
139
140
+ const BitVector &getUnitAliases (uint32_t U) const {
141
+ return AliasInfos[U].Regs ;
142
+ }
143
+
131
144
RegisterRef mapTo (RegisterRef RR, unsigned R) const ;
132
145
const TargetRegisterInfo &getTRI () const { return TRI; }
133
146
@@ -142,12 +155,16 @@ namespace rdf {
142
155
struct MaskInfo {
143
156
BitVector Units;
144
157
};
158
+ struct AliasInfo {
159
+ BitVector Regs;
160
+ };
145
161
146
162
const TargetRegisterInfo &TRI;
147
163
IndexedSet<const uint32_t *> RegMasks;
148
164
std::vector<RegInfo> RegInfos;
149
165
std::vector<UnitInfo> UnitInfos;
150
166
std::vector<MaskInfo> MaskInfos;
167
+ std::vector<AliasInfo> AliasInfos;
151
168
152
169
bool aliasRR (RegisterRef RA, RegisterRef RB) const ;
153
170
bool aliasRM (RegisterRef RR, RegisterRef RM) const ;
@@ -159,10 +176,15 @@ namespace rdf {
159
176
: Units(pri.getTRI().getNumRegUnits()), PRI(pri) {}
160
177
RegisterAggr (const RegisterAggr &RG) = default ;
161
178
179
+ unsigned count () const { return Units.count (); }
162
180
bool empty () const { return Units.none (); }
163
181
bool hasAliasOf (RegisterRef RR) const ;
164
182
bool hasCoverOf (RegisterRef RR) const ;
165
183
184
+ bool operator ==(const RegisterAggr &A) const {
185
+ return DenseMapInfo<BitVector>::isEqual (Units, A.Units );
186
+ }
187
+
166
188
static bool isCoverOf (RegisterRef RA, RegisterRef RB,
167
189
const PhysicalRegisterInfo &PRI) {
168
190
return RegisterAggr (PRI).insert (RA).hasCoverOf (RB);
@@ -179,6 +201,10 @@ namespace rdf {
179
201
RegisterRef clearIn (RegisterRef RR) const ;
180
202
RegisterRef makeRegRef () const ;
181
203
204
+ size_t hash () const {
205
+ return DenseMapInfo<BitVector>::getHashValue (Units);
206
+ }
207
+
182
208
void print (raw_ostream &OS) const ;
183
209
184
210
struct rr_iterator {
@@ -232,9 +258,26 @@ namespace rdf {
232
258
LaneBitmask Mask;
233
259
};
234
260
raw_ostream &operator << (raw_ostream &OS, const PrintLaneMaskOpt &P);
235
-
236
261
} // end namespace rdf
237
262
238
263
} // end namespace llvm
239
264
265
+ namespace std {
266
+ template <> struct hash <llvm::rdf::RegisterRef> {
267
+ size_t operator ()(llvm::rdf::RegisterRef A) const {
268
+ return A.hash ();
269
+ }
270
+ };
271
+ template <> struct hash <llvm::rdf::RegisterAggr> {
272
+ size_t operator ()(const llvm::rdf::RegisterAggr &A) const {
273
+ return A.hash ();
274
+ }
275
+ };
276
+ template <> struct equal_to <llvm::rdf::RegisterAggr> {
277
+ bool operator ()(const llvm::rdf::RegisterAggr &A,
278
+ const llvm::rdf::RegisterAggr &B) const {
279
+ return A == B;
280
+ }
281
+ };
282
+ }
240
283
#endif // LLVM_LIB_TARGET_HEXAGON_RDFREGISTERS_H
0 commit comments