OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "test/unittests/compiler/node-test-utils.h" | 5 #include "test/unittests/compiler/node-test-utils.h" |
6 | 6 |
7 #include "src/assembler.h" | 7 #include "src/assembler.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 #include "src/compiler/simplified-operator.h" | 9 #include "src/compiler/simplified-operator.h" |
10 #include "src/unique.h" | 10 #include "src/unique.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 return false; | 34 return false; |
35 } | 35 } |
36 return true; | 36 return true; |
37 } | 37 } |
38 | 38 |
39 | 39 |
40 class NodeMatcher : public MatcherInterface<Node*> { | 40 class NodeMatcher : public MatcherInterface<Node*> { |
41 public: | 41 public: |
42 explicit NodeMatcher(IrOpcode::Value opcode) : opcode_(opcode) {} | 42 explicit NodeMatcher(IrOpcode::Value opcode) : opcode_(opcode) {} |
43 | 43 |
44 void DescribeTo(std::ostream* os) const OVERRIDE { | 44 void DescribeTo(std::ostream* os) const override { |
45 *os << "is a " << IrOpcode::Mnemonic(opcode_) << " node"; | 45 *os << "is a " << IrOpcode::Mnemonic(opcode_) << " node"; |
46 } | 46 } |
47 | 47 |
48 bool MatchAndExplain(Node* node, | 48 bool MatchAndExplain(Node* node, |
49 MatchResultListener* listener) const OVERRIDE { | 49 MatchResultListener* listener) const override { |
50 if (node == NULL) { | 50 if (node == NULL) { |
51 *listener << "which is NULL"; | 51 *listener << "which is NULL"; |
52 return false; | 52 return false; |
53 } | 53 } |
54 if (node->opcode() != opcode_) { | 54 if (node->opcode() != opcode_) { |
55 *listener << "whose opcode is " << IrOpcode::Mnemonic(node->opcode()) | 55 *listener << "whose opcode is " << IrOpcode::Mnemonic(node->opcode()) |
56 << " but should have been " << IrOpcode::Mnemonic(opcode_); | 56 << " but should have been " << IrOpcode::Mnemonic(opcode_); |
57 return false; | 57 return false; |
58 } | 58 } |
59 return true; | 59 return true; |
60 } | 60 } |
61 | 61 |
62 private: | 62 private: |
63 const IrOpcode::Value opcode_; | 63 const IrOpcode::Value opcode_; |
64 }; | 64 }; |
65 | 65 |
66 | 66 |
67 class IsBranchMatcher FINAL : public NodeMatcher { | 67 class IsBranchMatcher final : public NodeMatcher { |
68 public: | 68 public: |
69 IsBranchMatcher(const Matcher<Node*>& value_matcher, | 69 IsBranchMatcher(const Matcher<Node*>& value_matcher, |
70 const Matcher<Node*>& control_matcher) | 70 const Matcher<Node*>& control_matcher) |
71 : NodeMatcher(IrOpcode::kBranch), | 71 : NodeMatcher(IrOpcode::kBranch), |
72 value_matcher_(value_matcher), | 72 value_matcher_(value_matcher), |
73 control_matcher_(control_matcher) {} | 73 control_matcher_(control_matcher) {} |
74 | 74 |
75 void DescribeTo(std::ostream* os) const FINAL { | 75 void DescribeTo(std::ostream* os) const final { |
76 NodeMatcher::DescribeTo(os); | 76 NodeMatcher::DescribeTo(os); |
77 *os << " whose value ("; | 77 *os << " whose value ("; |
78 value_matcher_.DescribeTo(os); | 78 value_matcher_.DescribeTo(os); |
79 *os << ") and control ("; | 79 *os << ") and control ("; |
80 control_matcher_.DescribeTo(os); | 80 control_matcher_.DescribeTo(os); |
81 *os << ")"; | 81 *os << ")"; |
82 } | 82 } |
83 | 83 |
84 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 84 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
85 return (NodeMatcher::MatchAndExplain(node, listener) && | 85 return (NodeMatcher::MatchAndExplain(node, listener) && |
86 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | 86 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
87 "value", value_matcher_, listener) && | 87 "value", value_matcher_, listener) && |
88 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 88 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
89 "control", control_matcher_, listener)); | 89 "control", control_matcher_, listener)); |
90 } | 90 } |
91 | 91 |
92 private: | 92 private: |
93 const Matcher<Node*> value_matcher_; | 93 const Matcher<Node*> value_matcher_; |
94 const Matcher<Node*> control_matcher_; | 94 const Matcher<Node*> control_matcher_; |
95 }; | 95 }; |
96 | 96 |
97 | 97 |
98 class IsSwitchMatcher FINAL : public NodeMatcher { | 98 class IsSwitchMatcher final : public NodeMatcher { |
99 public: | 99 public: |
100 IsSwitchMatcher(const Matcher<Node*>& value_matcher, | 100 IsSwitchMatcher(const Matcher<Node*>& value_matcher, |
101 const Matcher<Node*>& control_matcher) | 101 const Matcher<Node*>& control_matcher) |
102 : NodeMatcher(IrOpcode::kSwitch), | 102 : NodeMatcher(IrOpcode::kSwitch), |
103 value_matcher_(value_matcher), | 103 value_matcher_(value_matcher), |
104 control_matcher_(control_matcher) {} | 104 control_matcher_(control_matcher) {} |
105 | 105 |
106 void DescribeTo(std::ostream* os) const FINAL { | 106 void DescribeTo(std::ostream* os) const final { |
107 NodeMatcher::DescribeTo(os); | 107 NodeMatcher::DescribeTo(os); |
108 *os << " whose value ("; | 108 *os << " whose value ("; |
109 value_matcher_.DescribeTo(os); | 109 value_matcher_.DescribeTo(os); |
110 *os << ") and control ("; | 110 *os << ") and control ("; |
111 control_matcher_.DescribeTo(os); | 111 control_matcher_.DescribeTo(os); |
112 *os << ")"; | 112 *os << ")"; |
113 } | 113 } |
114 | 114 |
115 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 115 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
116 return (NodeMatcher::MatchAndExplain(node, listener) && | 116 return (NodeMatcher::MatchAndExplain(node, listener) && |
117 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | 117 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
118 "value", value_matcher_, listener) && | 118 "value", value_matcher_, listener) && |
119 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 119 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
120 "control", control_matcher_, listener)); | 120 "control", control_matcher_, listener)); |
121 } | 121 } |
122 | 122 |
123 private: | 123 private: |
124 const Matcher<Node*> value_matcher_; | 124 const Matcher<Node*> value_matcher_; |
125 const Matcher<Node*> control_matcher_; | 125 const Matcher<Node*> control_matcher_; |
126 }; | 126 }; |
127 | 127 |
128 | 128 |
129 class IsIfValueMatcher FINAL : public NodeMatcher { | 129 class IsIfValueMatcher final : public NodeMatcher { |
130 public: | 130 public: |
131 IsIfValueMatcher(const Matcher<int32_t>& value_matcher, | 131 IsIfValueMatcher(const Matcher<int32_t>& value_matcher, |
132 const Matcher<Node*>& control_matcher) | 132 const Matcher<Node*>& control_matcher) |
133 : NodeMatcher(IrOpcode::kIfValue), | 133 : NodeMatcher(IrOpcode::kIfValue), |
134 value_matcher_(value_matcher), | 134 value_matcher_(value_matcher), |
135 control_matcher_(control_matcher) {} | 135 control_matcher_(control_matcher) {} |
136 | 136 |
137 void DescribeTo(std::ostream* os) const FINAL { | 137 void DescribeTo(std::ostream* os) const final { |
138 NodeMatcher::DescribeTo(os); | 138 NodeMatcher::DescribeTo(os); |
139 *os << " whose value ("; | 139 *os << " whose value ("; |
140 value_matcher_.DescribeTo(os); | 140 value_matcher_.DescribeTo(os); |
141 *os << ") and control ("; | 141 *os << ") and control ("; |
142 control_matcher_.DescribeTo(os); | 142 control_matcher_.DescribeTo(os); |
143 *os << ")"; | 143 *os << ")"; |
144 } | 144 } |
145 | 145 |
146 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 146 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
147 return (NodeMatcher::MatchAndExplain(node, listener) && | 147 return (NodeMatcher::MatchAndExplain(node, listener) && |
148 PrintMatchAndExplain(OpParameter<int32_t>(node->op()), "value", | 148 PrintMatchAndExplain(OpParameter<int32_t>(node->op()), "value", |
149 value_matcher_, listener) && | 149 value_matcher_, listener) && |
150 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 150 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
151 "control", control_matcher_, listener)); | 151 "control", control_matcher_, listener)); |
152 } | 152 } |
153 | 153 |
154 private: | 154 private: |
155 const Matcher<int32_t> value_matcher_; | 155 const Matcher<int32_t> value_matcher_; |
156 const Matcher<Node*> control_matcher_; | 156 const Matcher<Node*> control_matcher_; |
157 }; | 157 }; |
158 | 158 |
159 | 159 |
160 class IsControl1Matcher FINAL : public NodeMatcher { | 160 class IsControl1Matcher final : public NodeMatcher { |
161 public: | 161 public: |
162 IsControl1Matcher(IrOpcode::Value opcode, | 162 IsControl1Matcher(IrOpcode::Value opcode, |
163 const Matcher<Node*>& control_matcher) | 163 const Matcher<Node*>& control_matcher) |
164 : NodeMatcher(opcode), control_matcher_(control_matcher) {} | 164 : NodeMatcher(opcode), control_matcher_(control_matcher) {} |
165 | 165 |
166 void DescribeTo(std::ostream* os) const FINAL { | 166 void DescribeTo(std::ostream* os) const final { |
167 NodeMatcher::DescribeTo(os); | 167 NodeMatcher::DescribeTo(os); |
168 *os << " whose control ("; | 168 *os << " whose control ("; |
169 control_matcher_.DescribeTo(os); | 169 control_matcher_.DescribeTo(os); |
170 *os << ")"; | 170 *os << ")"; |
171 } | 171 } |
172 | 172 |
173 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 173 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
174 return (NodeMatcher::MatchAndExplain(node, listener) && | 174 return (NodeMatcher::MatchAndExplain(node, listener) && |
175 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 175 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
176 "control", control_matcher_, listener)); | 176 "control", control_matcher_, listener)); |
177 } | 177 } |
178 | 178 |
179 private: | 179 private: |
180 const Matcher<Node*> control_matcher_; | 180 const Matcher<Node*> control_matcher_; |
181 }; | 181 }; |
182 | 182 |
183 | 183 |
184 class IsControl2Matcher FINAL : public NodeMatcher { | 184 class IsControl2Matcher final : public NodeMatcher { |
185 public: | 185 public: |
186 IsControl2Matcher(IrOpcode::Value opcode, | 186 IsControl2Matcher(IrOpcode::Value opcode, |
187 const Matcher<Node*>& control0_matcher, | 187 const Matcher<Node*>& control0_matcher, |
188 const Matcher<Node*>& control1_matcher) | 188 const Matcher<Node*>& control1_matcher) |
189 : NodeMatcher(opcode), | 189 : NodeMatcher(opcode), |
190 control0_matcher_(control0_matcher), | 190 control0_matcher_(control0_matcher), |
191 control1_matcher_(control1_matcher) {} | 191 control1_matcher_(control1_matcher) {} |
192 | 192 |
193 void DescribeTo(std::ostream* os) const FINAL { | 193 void DescribeTo(std::ostream* os) const final { |
194 NodeMatcher::DescribeTo(os); | 194 NodeMatcher::DescribeTo(os); |
195 *os << " whose control0 ("; | 195 *os << " whose control0 ("; |
196 control0_matcher_.DescribeTo(os); | 196 control0_matcher_.DescribeTo(os); |
197 *os << ") and control1 ("; | 197 *os << ") and control1 ("; |
198 control1_matcher_.DescribeTo(os); | 198 control1_matcher_.DescribeTo(os); |
199 *os << ")"; | 199 *os << ")"; |
200 } | 200 } |
201 | 201 |
202 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 202 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
203 return (NodeMatcher::MatchAndExplain(node, listener) && | 203 return (NodeMatcher::MatchAndExplain(node, listener) && |
204 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 0), | 204 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 0), |
205 "control0", control0_matcher_, listener) && | 205 "control0", control0_matcher_, listener) && |
206 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 1), | 206 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 1), |
207 "control1", control1_matcher_, listener)); | 207 "control1", control1_matcher_, listener)); |
208 } | 208 } |
209 | 209 |
210 private: | 210 private: |
211 const Matcher<Node*> control0_matcher_; | 211 const Matcher<Node*> control0_matcher_; |
212 const Matcher<Node*> control1_matcher_; | 212 const Matcher<Node*> control1_matcher_; |
213 }; | 213 }; |
214 | 214 |
215 | 215 |
216 class IsControl3Matcher FINAL : public NodeMatcher { | 216 class IsControl3Matcher final : public NodeMatcher { |
217 public: | 217 public: |
218 IsControl3Matcher(IrOpcode::Value opcode, | 218 IsControl3Matcher(IrOpcode::Value opcode, |
219 const Matcher<Node*>& control0_matcher, | 219 const Matcher<Node*>& control0_matcher, |
220 const Matcher<Node*>& control1_matcher, | 220 const Matcher<Node*>& control1_matcher, |
221 const Matcher<Node*>& control2_matcher) | 221 const Matcher<Node*>& control2_matcher) |
222 : NodeMatcher(opcode), | 222 : NodeMatcher(opcode), |
223 control0_matcher_(control0_matcher), | 223 control0_matcher_(control0_matcher), |
224 control1_matcher_(control1_matcher), | 224 control1_matcher_(control1_matcher), |
225 control2_matcher_(control2_matcher) {} | 225 control2_matcher_(control2_matcher) {} |
226 | 226 |
227 void DescribeTo(std::ostream* os) const FINAL { | 227 void DescribeTo(std::ostream* os) const final { |
228 NodeMatcher::DescribeTo(os); | 228 NodeMatcher::DescribeTo(os); |
229 *os << " whose control0 ("; | 229 *os << " whose control0 ("; |
230 control0_matcher_.DescribeTo(os); | 230 control0_matcher_.DescribeTo(os); |
231 *os << ") and control1 ("; | 231 *os << ") and control1 ("; |
232 control1_matcher_.DescribeTo(os); | 232 control1_matcher_.DescribeTo(os); |
233 *os << ") and control2 ("; | 233 *os << ") and control2 ("; |
234 control2_matcher_.DescribeTo(os); | 234 control2_matcher_.DescribeTo(os); |
235 *os << ")"; | 235 *os << ")"; |
236 } | 236 } |
237 | 237 |
238 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 238 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
239 return (NodeMatcher::MatchAndExplain(node, listener) && | 239 return (NodeMatcher::MatchAndExplain(node, listener) && |
240 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 0), | 240 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 0), |
241 "control0", control0_matcher_, listener) && | 241 "control0", control0_matcher_, listener) && |
242 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 1), | 242 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 1), |
243 "control1", control1_matcher_, listener) && | 243 "control1", control1_matcher_, listener) && |
244 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 2), | 244 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 2), |
245 "control2", control2_matcher_, listener)); | 245 "control2", control2_matcher_, listener)); |
246 } | 246 } |
247 | 247 |
248 private: | 248 private: |
249 const Matcher<Node*> control0_matcher_; | 249 const Matcher<Node*> control0_matcher_; |
250 const Matcher<Node*> control1_matcher_; | 250 const Matcher<Node*> control1_matcher_; |
251 const Matcher<Node*> control2_matcher_; | 251 const Matcher<Node*> control2_matcher_; |
252 }; | 252 }; |
253 | 253 |
254 | 254 |
255 class IsFinishMatcher FINAL : public NodeMatcher { | 255 class IsFinishMatcher final : public NodeMatcher { |
256 public: | 256 public: |
257 IsFinishMatcher(const Matcher<Node*>& value_matcher, | 257 IsFinishMatcher(const Matcher<Node*>& value_matcher, |
258 const Matcher<Node*>& effect_matcher) | 258 const Matcher<Node*>& effect_matcher) |
259 : NodeMatcher(IrOpcode::kFinish), | 259 : NodeMatcher(IrOpcode::kFinish), |
260 value_matcher_(value_matcher), | 260 value_matcher_(value_matcher), |
261 effect_matcher_(effect_matcher) {} | 261 effect_matcher_(effect_matcher) {} |
262 | 262 |
263 void DescribeTo(std::ostream* os) const FINAL { | 263 void DescribeTo(std::ostream* os) const final { |
264 NodeMatcher::DescribeTo(os); | 264 NodeMatcher::DescribeTo(os); |
265 *os << " whose value ("; | 265 *os << " whose value ("; |
266 value_matcher_.DescribeTo(os); | 266 value_matcher_.DescribeTo(os); |
267 *os << ") and effect ("; | 267 *os << ") and effect ("; |
268 effect_matcher_.DescribeTo(os); | 268 effect_matcher_.DescribeTo(os); |
269 *os << ")"; | 269 *os << ")"; |
270 } | 270 } |
271 | 271 |
272 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 272 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
273 return (NodeMatcher::MatchAndExplain(node, listener) && | 273 return (NodeMatcher::MatchAndExplain(node, listener) && |
274 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | 274 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
275 "value", value_matcher_, listener) && | 275 "value", value_matcher_, listener) && |
276 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 276 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
277 effect_matcher_, listener)); | 277 effect_matcher_, listener)); |
278 } | 278 } |
279 | 279 |
280 private: | 280 private: |
281 const Matcher<Node*> value_matcher_; | 281 const Matcher<Node*> value_matcher_; |
282 const Matcher<Node*> effect_matcher_; | 282 const Matcher<Node*> effect_matcher_; |
283 }; | 283 }; |
284 | 284 |
285 | 285 |
286 class IsReturnMatcher FINAL : public NodeMatcher { | 286 class IsReturnMatcher final : public NodeMatcher { |
287 public: | 287 public: |
288 IsReturnMatcher(const Matcher<Node*>& value_matcher, | 288 IsReturnMatcher(const Matcher<Node*>& value_matcher, |
289 const Matcher<Node*>& effect_matcher, | 289 const Matcher<Node*>& effect_matcher, |
290 const Matcher<Node*>& control_matcher) | 290 const Matcher<Node*>& control_matcher) |
291 : NodeMatcher(IrOpcode::kReturn), | 291 : NodeMatcher(IrOpcode::kReturn), |
292 value_matcher_(value_matcher), | 292 value_matcher_(value_matcher), |
293 effect_matcher_(effect_matcher), | 293 effect_matcher_(effect_matcher), |
294 control_matcher_(control_matcher) {} | 294 control_matcher_(control_matcher) {} |
295 | 295 |
296 void DescribeTo(std::ostream* os) const FINAL { | 296 void DescribeTo(std::ostream* os) const final { |
297 NodeMatcher::DescribeTo(os); | 297 NodeMatcher::DescribeTo(os); |
298 *os << " whose value ("; | 298 *os << " whose value ("; |
299 value_matcher_.DescribeTo(os); | 299 value_matcher_.DescribeTo(os); |
300 *os << ") and effect ("; | 300 *os << ") and effect ("; |
301 effect_matcher_.DescribeTo(os); | 301 effect_matcher_.DescribeTo(os); |
302 *os << ") and control ("; | 302 *os << ") and control ("; |
303 control_matcher_.DescribeTo(os); | 303 control_matcher_.DescribeTo(os); |
304 *os << ")"; | 304 *os << ")"; |
305 } | 305 } |
306 | 306 |
307 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 307 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
308 return (NodeMatcher::MatchAndExplain(node, listener) && | 308 return (NodeMatcher::MatchAndExplain(node, listener) && |
309 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | 309 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
310 "value", value_matcher_, listener) && | 310 "value", value_matcher_, listener) && |
311 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 311 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
312 effect_matcher_, listener) && | 312 effect_matcher_, listener) && |
313 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 313 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
314 "control", control_matcher_, listener)); | 314 "control", control_matcher_, listener)); |
315 } | 315 } |
316 | 316 |
317 private: | 317 private: |
318 const Matcher<Node*> value_matcher_; | 318 const Matcher<Node*> value_matcher_; |
319 const Matcher<Node*> effect_matcher_; | 319 const Matcher<Node*> effect_matcher_; |
320 const Matcher<Node*> control_matcher_; | 320 const Matcher<Node*> control_matcher_; |
321 }; | 321 }; |
322 | 322 |
323 | 323 |
324 template <typename T> | 324 template <typename T> |
325 class IsConstantMatcher FINAL : public NodeMatcher { | 325 class IsConstantMatcher final : public NodeMatcher { |
326 public: | 326 public: |
327 IsConstantMatcher(IrOpcode::Value opcode, const Matcher<T>& value_matcher) | 327 IsConstantMatcher(IrOpcode::Value opcode, const Matcher<T>& value_matcher) |
328 : NodeMatcher(opcode), value_matcher_(value_matcher) {} | 328 : NodeMatcher(opcode), value_matcher_(value_matcher) {} |
329 | 329 |
330 void DescribeTo(std::ostream* os) const FINAL { | 330 void DescribeTo(std::ostream* os) const final { |
331 NodeMatcher::DescribeTo(os); | 331 NodeMatcher::DescribeTo(os); |
332 *os << " whose value ("; | 332 *os << " whose value ("; |
333 value_matcher_.DescribeTo(os); | 333 value_matcher_.DescribeTo(os); |
334 *os << ")"; | 334 *os << ")"; |
335 } | 335 } |
336 | 336 |
337 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 337 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
338 return (NodeMatcher::MatchAndExplain(node, listener) && | 338 return (NodeMatcher::MatchAndExplain(node, listener) && |
339 PrintMatchAndExplain(OpParameter<T>(node), "value", value_matcher_, | 339 PrintMatchAndExplain(OpParameter<T>(node), "value", value_matcher_, |
340 listener)); | 340 listener)); |
341 } | 341 } |
342 | 342 |
343 private: | 343 private: |
344 const Matcher<T> value_matcher_; | 344 const Matcher<T> value_matcher_; |
345 }; | 345 }; |
346 | 346 |
347 | 347 |
348 class IsSelectMatcher FINAL : public NodeMatcher { | 348 class IsSelectMatcher final : public NodeMatcher { |
349 public: | 349 public: |
350 IsSelectMatcher(const Matcher<MachineType>& type_matcher, | 350 IsSelectMatcher(const Matcher<MachineType>& type_matcher, |
351 const Matcher<Node*>& value0_matcher, | 351 const Matcher<Node*>& value0_matcher, |
352 const Matcher<Node*>& value1_matcher, | 352 const Matcher<Node*>& value1_matcher, |
353 const Matcher<Node*>& value2_matcher) | 353 const Matcher<Node*>& value2_matcher) |
354 : NodeMatcher(IrOpcode::kSelect), | 354 : NodeMatcher(IrOpcode::kSelect), |
355 type_matcher_(type_matcher), | 355 type_matcher_(type_matcher), |
356 value0_matcher_(value0_matcher), | 356 value0_matcher_(value0_matcher), |
357 value1_matcher_(value1_matcher), | 357 value1_matcher_(value1_matcher), |
358 value2_matcher_(value2_matcher) {} | 358 value2_matcher_(value2_matcher) {} |
359 | 359 |
360 void DescribeTo(std::ostream* os) const FINAL { | 360 void DescribeTo(std::ostream* os) const final { |
361 NodeMatcher::DescribeTo(os); | 361 NodeMatcher::DescribeTo(os); |
362 *os << " whose type ("; | 362 *os << " whose type ("; |
363 type_matcher_.DescribeTo(os); | 363 type_matcher_.DescribeTo(os); |
364 *os << "), value0 ("; | 364 *os << "), value0 ("; |
365 value0_matcher_.DescribeTo(os); | 365 value0_matcher_.DescribeTo(os); |
366 *os << "), value1 ("; | 366 *os << "), value1 ("; |
367 value1_matcher_.DescribeTo(os); | 367 value1_matcher_.DescribeTo(os); |
368 *os << ") and value2 ("; | 368 *os << ") and value2 ("; |
369 value2_matcher_.DescribeTo(os); | 369 value2_matcher_.DescribeTo(os); |
370 *os << ")"; | 370 *os << ")"; |
371 } | 371 } |
372 | 372 |
373 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 373 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
374 return (NodeMatcher::MatchAndExplain(node, listener) && | 374 return (NodeMatcher::MatchAndExplain(node, listener) && |
375 PrintMatchAndExplain(OpParameter<MachineType>(node), "type", | 375 PrintMatchAndExplain(OpParameter<MachineType>(node), "type", |
376 type_matcher_, listener) && | 376 type_matcher_, listener) && |
377 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | 377 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
378 "value0", value0_matcher_, listener) && | 378 "value0", value0_matcher_, listener) && |
379 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 379 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
380 "value1", value1_matcher_, listener) && | 380 "value1", value1_matcher_, listener) && |
381 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), | 381 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), |
382 "value2", value2_matcher_, listener)); | 382 "value2", value2_matcher_, listener)); |
383 } | 383 } |
384 | 384 |
385 private: | 385 private: |
386 const Matcher<MachineType> type_matcher_; | 386 const Matcher<MachineType> type_matcher_; |
387 const Matcher<Node*> value0_matcher_; | 387 const Matcher<Node*> value0_matcher_; |
388 const Matcher<Node*> value1_matcher_; | 388 const Matcher<Node*> value1_matcher_; |
389 const Matcher<Node*> value2_matcher_; | 389 const Matcher<Node*> value2_matcher_; |
390 }; | 390 }; |
391 | 391 |
392 | 392 |
393 class IsPhiMatcher FINAL : public NodeMatcher { | 393 class IsPhiMatcher final : public NodeMatcher { |
394 public: | 394 public: |
395 IsPhiMatcher(const Matcher<MachineType>& type_matcher, | 395 IsPhiMatcher(const Matcher<MachineType>& type_matcher, |
396 const Matcher<Node*>& value0_matcher, | 396 const Matcher<Node*>& value0_matcher, |
397 const Matcher<Node*>& value1_matcher, | 397 const Matcher<Node*>& value1_matcher, |
398 const Matcher<Node*>& control_matcher) | 398 const Matcher<Node*>& control_matcher) |
399 : NodeMatcher(IrOpcode::kPhi), | 399 : NodeMatcher(IrOpcode::kPhi), |
400 type_matcher_(type_matcher), | 400 type_matcher_(type_matcher), |
401 value0_matcher_(value0_matcher), | 401 value0_matcher_(value0_matcher), |
402 value1_matcher_(value1_matcher), | 402 value1_matcher_(value1_matcher), |
403 control_matcher_(control_matcher) {} | 403 control_matcher_(control_matcher) {} |
404 | 404 |
405 void DescribeTo(std::ostream* os) const FINAL { | 405 void DescribeTo(std::ostream* os) const final { |
406 NodeMatcher::DescribeTo(os); | 406 NodeMatcher::DescribeTo(os); |
407 *os << " whose type ("; | 407 *os << " whose type ("; |
408 type_matcher_.DescribeTo(os); | 408 type_matcher_.DescribeTo(os); |
409 *os << "), value0 ("; | 409 *os << "), value0 ("; |
410 value0_matcher_.DescribeTo(os); | 410 value0_matcher_.DescribeTo(os); |
411 *os << "), value1 ("; | 411 *os << "), value1 ("; |
412 value1_matcher_.DescribeTo(os); | 412 value1_matcher_.DescribeTo(os); |
413 *os << ") and control ("; | 413 *os << ") and control ("; |
414 control_matcher_.DescribeTo(os); | 414 control_matcher_.DescribeTo(os); |
415 *os << ")"; | 415 *os << ")"; |
416 } | 416 } |
417 | 417 |
418 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 418 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
419 return (NodeMatcher::MatchAndExplain(node, listener) && | 419 return (NodeMatcher::MatchAndExplain(node, listener) && |
420 PrintMatchAndExplain(OpParameter<MachineType>(node), "type", | 420 PrintMatchAndExplain(OpParameter<MachineType>(node), "type", |
421 type_matcher_, listener) && | 421 type_matcher_, listener) && |
422 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | 422 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
423 "value0", value0_matcher_, listener) && | 423 "value0", value0_matcher_, listener) && |
424 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 424 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
425 "value1", value1_matcher_, listener) && | 425 "value1", value1_matcher_, listener) && |
426 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 426 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
427 "control", control_matcher_, listener)); | 427 "control", control_matcher_, listener)); |
428 } | 428 } |
429 | 429 |
430 private: | 430 private: |
431 const Matcher<MachineType> type_matcher_; | 431 const Matcher<MachineType> type_matcher_; |
432 const Matcher<Node*> value0_matcher_; | 432 const Matcher<Node*> value0_matcher_; |
433 const Matcher<Node*> value1_matcher_; | 433 const Matcher<Node*> value1_matcher_; |
434 const Matcher<Node*> control_matcher_; | 434 const Matcher<Node*> control_matcher_; |
435 }; | 435 }; |
436 | 436 |
437 | 437 |
438 class IsPhi2Matcher FINAL : public NodeMatcher { | 438 class IsPhi2Matcher final : public NodeMatcher { |
439 public: | 439 public: |
440 IsPhi2Matcher(const Matcher<MachineType>& type_matcher, | 440 IsPhi2Matcher(const Matcher<MachineType>& type_matcher, |
441 const Matcher<Node*>& value0_matcher, | 441 const Matcher<Node*>& value0_matcher, |
442 const Matcher<Node*>& value1_matcher, | 442 const Matcher<Node*>& value1_matcher, |
443 const Matcher<Node*>& value2_matcher, | 443 const Matcher<Node*>& value2_matcher, |
444 const Matcher<Node*>& control_matcher) | 444 const Matcher<Node*>& control_matcher) |
445 : NodeMatcher(IrOpcode::kPhi), | 445 : NodeMatcher(IrOpcode::kPhi), |
446 type_matcher_(type_matcher), | 446 type_matcher_(type_matcher), |
447 value0_matcher_(value0_matcher), | 447 value0_matcher_(value0_matcher), |
448 value1_matcher_(value1_matcher), | 448 value1_matcher_(value1_matcher), |
449 value2_matcher_(value2_matcher), | 449 value2_matcher_(value2_matcher), |
450 control_matcher_(control_matcher) {} | 450 control_matcher_(control_matcher) {} |
451 | 451 |
452 void DescribeTo(std::ostream* os) const FINAL { | 452 void DescribeTo(std::ostream* os) const final { |
453 NodeMatcher::DescribeTo(os); | 453 NodeMatcher::DescribeTo(os); |
454 *os << " whose type ("; | 454 *os << " whose type ("; |
455 type_matcher_.DescribeTo(os); | 455 type_matcher_.DescribeTo(os); |
456 *os << "), value0 ("; | 456 *os << "), value0 ("; |
457 value0_matcher_.DescribeTo(os); | 457 value0_matcher_.DescribeTo(os); |
458 *os << "), value1 ("; | 458 *os << "), value1 ("; |
459 value1_matcher_.DescribeTo(os); | 459 value1_matcher_.DescribeTo(os); |
460 *os << "), value2 ("; | 460 *os << "), value2 ("; |
461 value2_matcher_.DescribeTo(os); | 461 value2_matcher_.DescribeTo(os); |
462 *os << ") and control ("; | 462 *os << ") and control ("; |
463 control_matcher_.DescribeTo(os); | 463 control_matcher_.DescribeTo(os); |
464 *os << ")"; | 464 *os << ")"; |
465 } | 465 } |
466 | 466 |
467 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 467 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
468 return (NodeMatcher::MatchAndExplain(node, listener) && | 468 return (NodeMatcher::MatchAndExplain(node, listener) && |
469 PrintMatchAndExplain(OpParameter<MachineType>(node), "type", | 469 PrintMatchAndExplain(OpParameter<MachineType>(node), "type", |
470 type_matcher_, listener) && | 470 type_matcher_, listener) && |
471 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | 471 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
472 "value0", value0_matcher_, listener) && | 472 "value0", value0_matcher_, listener) && |
473 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 473 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
474 "value1", value1_matcher_, listener) && | 474 "value1", value1_matcher_, listener) && |
475 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), | 475 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), |
476 "value2", value2_matcher_, listener) && | 476 "value2", value2_matcher_, listener) && |
477 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 477 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
478 "control", control_matcher_, listener)); | 478 "control", control_matcher_, listener)); |
479 } | 479 } |
480 | 480 |
481 private: | 481 private: |
482 const Matcher<MachineType> type_matcher_; | 482 const Matcher<MachineType> type_matcher_; |
483 const Matcher<Node*> value0_matcher_; | 483 const Matcher<Node*> value0_matcher_; |
484 const Matcher<Node*> value1_matcher_; | 484 const Matcher<Node*> value1_matcher_; |
485 const Matcher<Node*> value2_matcher_; | 485 const Matcher<Node*> value2_matcher_; |
486 const Matcher<Node*> control_matcher_; | 486 const Matcher<Node*> control_matcher_; |
487 }; | 487 }; |
488 | 488 |
489 | 489 |
490 class IsEffectPhiMatcher FINAL : public NodeMatcher { | 490 class IsEffectPhiMatcher final : public NodeMatcher { |
491 public: | 491 public: |
492 IsEffectPhiMatcher(const Matcher<Node*>& effect0_matcher, | 492 IsEffectPhiMatcher(const Matcher<Node*>& effect0_matcher, |
493 const Matcher<Node*>& effect1_matcher, | 493 const Matcher<Node*>& effect1_matcher, |
494 const Matcher<Node*>& control_matcher) | 494 const Matcher<Node*>& control_matcher) |
495 : NodeMatcher(IrOpcode::kEffectPhi), | 495 : NodeMatcher(IrOpcode::kEffectPhi), |
496 effect0_matcher_(effect0_matcher), | 496 effect0_matcher_(effect0_matcher), |
497 effect1_matcher_(effect1_matcher), | 497 effect1_matcher_(effect1_matcher), |
498 control_matcher_(control_matcher) {} | 498 control_matcher_(control_matcher) {} |
499 | 499 |
500 void DescribeTo(std::ostream* os) const FINAL { | 500 void DescribeTo(std::ostream* os) const final { |
501 NodeMatcher::DescribeTo(os); | 501 NodeMatcher::DescribeTo(os); |
502 *os << "), effect0 ("; | 502 *os << "), effect0 ("; |
503 effect0_matcher_.DescribeTo(os); | 503 effect0_matcher_.DescribeTo(os); |
504 *os << "), effect1 ("; | 504 *os << "), effect1 ("; |
505 effect1_matcher_.DescribeTo(os); | 505 effect1_matcher_.DescribeTo(os); |
506 *os << ") and control ("; | 506 *os << ") and control ("; |
507 control_matcher_.DescribeTo(os); | 507 control_matcher_.DescribeTo(os); |
508 *os << ")"; | 508 *os << ")"; |
509 } | 509 } |
510 | 510 |
511 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 511 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
512 return (NodeMatcher::MatchAndExplain(node, listener) && | 512 return (NodeMatcher::MatchAndExplain(node, listener) && |
513 PrintMatchAndExplain(NodeProperties::GetEffectInput(node, 0), | 513 PrintMatchAndExplain(NodeProperties::GetEffectInput(node, 0), |
514 "effect0", effect0_matcher_, listener) && | 514 "effect0", effect0_matcher_, listener) && |
515 PrintMatchAndExplain(NodeProperties::GetEffectInput(node, 1), | 515 PrintMatchAndExplain(NodeProperties::GetEffectInput(node, 1), |
516 "effect1", effect1_matcher_, listener) && | 516 "effect1", effect1_matcher_, listener) && |
517 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 517 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
518 "control", control_matcher_, listener)); | 518 "control", control_matcher_, listener)); |
519 } | 519 } |
520 | 520 |
521 private: | 521 private: |
522 const Matcher<Node*> effect0_matcher_; | 522 const Matcher<Node*> effect0_matcher_; |
523 const Matcher<Node*> effect1_matcher_; | 523 const Matcher<Node*> effect1_matcher_; |
524 const Matcher<Node*> control_matcher_; | 524 const Matcher<Node*> control_matcher_; |
525 }; | 525 }; |
526 | 526 |
527 | 527 |
528 class IsEffectSetMatcher FINAL : public NodeMatcher { | 528 class IsEffectSetMatcher final : public NodeMatcher { |
529 public: | 529 public: |
530 IsEffectSetMatcher(const Matcher<Node*>& effect0_matcher, | 530 IsEffectSetMatcher(const Matcher<Node*>& effect0_matcher, |
531 const Matcher<Node*>& effect1_matcher) | 531 const Matcher<Node*>& effect1_matcher) |
532 : NodeMatcher(IrOpcode::kEffectSet), | 532 : NodeMatcher(IrOpcode::kEffectSet), |
533 effect0_matcher_(effect0_matcher), | 533 effect0_matcher_(effect0_matcher), |
534 effect1_matcher_(effect1_matcher) {} | 534 effect1_matcher_(effect1_matcher) {} |
535 | 535 |
536 void DescribeTo(std::ostream* os) const FINAL { | 536 void DescribeTo(std::ostream* os) const final { |
537 NodeMatcher::DescribeTo(os); | 537 NodeMatcher::DescribeTo(os); |
538 *os << "), effect0 ("; | 538 *os << "), effect0 ("; |
539 effect0_matcher_.DescribeTo(os); | 539 effect0_matcher_.DescribeTo(os); |
540 *os << ") and effect1 ("; | 540 *os << ") and effect1 ("; |
541 effect1_matcher_.DescribeTo(os); | 541 effect1_matcher_.DescribeTo(os); |
542 *os << ")"; | 542 *os << ")"; |
543 } | 543 } |
544 | 544 |
545 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 545 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
546 if (!NodeMatcher::MatchAndExplain(node, listener)) return false; | 546 if (!NodeMatcher::MatchAndExplain(node, listener)) return false; |
547 | 547 |
548 Node* effect0 = NodeProperties::GetEffectInput(node, 0); | 548 Node* effect0 = NodeProperties::GetEffectInput(node, 0); |
549 Node* effect1 = NodeProperties::GetEffectInput(node, 1); | 549 Node* effect1 = NodeProperties::GetEffectInput(node, 1); |
550 | 550 |
551 { | 551 { |
552 // Try matching in the reverse order first. | 552 // Try matching in the reverse order first. |
553 StringMatchResultListener value_listener; | 553 StringMatchResultListener value_listener; |
554 if (effect0_matcher_.MatchAndExplain(effect1, &value_listener) && | 554 if (effect0_matcher_.MatchAndExplain(effect1, &value_listener) && |
555 effect1_matcher_.MatchAndExplain(effect0, &value_listener)) { | 555 effect1_matcher_.MatchAndExplain(effect0, &value_listener)) { |
556 return true; | 556 return true; |
557 } | 557 } |
558 } | 558 } |
559 | 559 |
560 return PrintMatchAndExplain(effect0, "effect0", effect0_matcher_, | 560 return PrintMatchAndExplain(effect0, "effect0", effect0_matcher_, |
561 listener) && | 561 listener) && |
562 PrintMatchAndExplain(effect1, "effect1", effect1_matcher_, listener); | 562 PrintMatchAndExplain(effect1, "effect1", effect1_matcher_, listener); |
563 } | 563 } |
564 | 564 |
565 private: | 565 private: |
566 const Matcher<Node*> effect0_matcher_; | 566 const Matcher<Node*> effect0_matcher_; |
567 const Matcher<Node*> effect1_matcher_; | 567 const Matcher<Node*> effect1_matcher_; |
568 }; | 568 }; |
569 | 569 |
570 | 570 |
571 class IsProjectionMatcher FINAL : public NodeMatcher { | 571 class IsProjectionMatcher final : public NodeMatcher { |
572 public: | 572 public: |
573 IsProjectionMatcher(const Matcher<size_t>& index_matcher, | 573 IsProjectionMatcher(const Matcher<size_t>& index_matcher, |
574 const Matcher<Node*>& base_matcher) | 574 const Matcher<Node*>& base_matcher) |
575 : NodeMatcher(IrOpcode::kProjection), | 575 : NodeMatcher(IrOpcode::kProjection), |
576 index_matcher_(index_matcher), | 576 index_matcher_(index_matcher), |
577 base_matcher_(base_matcher) {} | 577 base_matcher_(base_matcher) {} |
578 | 578 |
579 void DescribeTo(std::ostream* os) const FINAL { | 579 void DescribeTo(std::ostream* os) const final { |
580 NodeMatcher::DescribeTo(os); | 580 NodeMatcher::DescribeTo(os); |
581 *os << " whose index ("; | 581 *os << " whose index ("; |
582 index_matcher_.DescribeTo(os); | 582 index_matcher_.DescribeTo(os); |
583 *os << ") and base ("; | 583 *os << ") and base ("; |
584 base_matcher_.DescribeTo(os); | 584 base_matcher_.DescribeTo(os); |
585 *os << ")"; | 585 *os << ")"; |
586 } | 586 } |
587 | 587 |
588 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 588 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
589 return (NodeMatcher::MatchAndExplain(node, listener) && | 589 return (NodeMatcher::MatchAndExplain(node, listener) && |
590 PrintMatchAndExplain(OpParameter<size_t>(node), "index", | 590 PrintMatchAndExplain(OpParameter<size_t>(node), "index", |
591 index_matcher_, listener) && | 591 index_matcher_, listener) && |
592 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", | 592 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
593 base_matcher_, listener)); | 593 base_matcher_, listener)); |
594 } | 594 } |
595 | 595 |
596 private: | 596 private: |
597 const Matcher<size_t> index_matcher_; | 597 const Matcher<size_t> index_matcher_; |
598 const Matcher<Node*> base_matcher_; | 598 const Matcher<Node*> base_matcher_; |
599 }; | 599 }; |
600 | 600 |
601 | 601 |
602 class IsCall2Matcher FINAL : public NodeMatcher { | 602 class IsCall2Matcher final : public NodeMatcher { |
603 public: | 603 public: |
604 IsCall2Matcher(const Matcher<CallDescriptor*>& descriptor_matcher, | 604 IsCall2Matcher(const Matcher<CallDescriptor*>& descriptor_matcher, |
605 const Matcher<Node*>& value0_matcher, | 605 const Matcher<Node*>& value0_matcher, |
606 const Matcher<Node*>& value1_matcher, | 606 const Matcher<Node*>& value1_matcher, |
607 const Matcher<Node*>& effect_matcher, | 607 const Matcher<Node*>& effect_matcher, |
608 const Matcher<Node*>& control_matcher) | 608 const Matcher<Node*>& control_matcher) |
609 : NodeMatcher(IrOpcode::kCall), | 609 : NodeMatcher(IrOpcode::kCall), |
610 descriptor_matcher_(descriptor_matcher), | 610 descriptor_matcher_(descriptor_matcher), |
611 value0_matcher_(value0_matcher), | 611 value0_matcher_(value0_matcher), |
612 value1_matcher_(value1_matcher), | 612 value1_matcher_(value1_matcher), |
613 effect_matcher_(effect_matcher), | 613 effect_matcher_(effect_matcher), |
614 control_matcher_(control_matcher) {} | 614 control_matcher_(control_matcher) {} |
615 | 615 |
616 void DescribeTo(std::ostream* os) const FINAL { | 616 void DescribeTo(std::ostream* os) const final { |
617 NodeMatcher::DescribeTo(os); | 617 NodeMatcher::DescribeTo(os); |
618 *os << " whose value0 ("; | 618 *os << " whose value0 ("; |
619 value0_matcher_.DescribeTo(os); | 619 value0_matcher_.DescribeTo(os); |
620 *os << ") and value1 ("; | 620 *os << ") and value1 ("; |
621 value1_matcher_.DescribeTo(os); | 621 value1_matcher_.DescribeTo(os); |
622 *os << ") and effect ("; | 622 *os << ") and effect ("; |
623 effect_matcher_.DescribeTo(os); | 623 effect_matcher_.DescribeTo(os); |
624 *os << ") and control ("; | 624 *os << ") and control ("; |
625 control_matcher_.DescribeTo(os); | 625 control_matcher_.DescribeTo(os); |
626 *os << ")"; | 626 *os << ")"; |
627 } | 627 } |
628 | 628 |
629 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 629 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
630 return (NodeMatcher::MatchAndExplain(node, listener) && | 630 return (NodeMatcher::MatchAndExplain(node, listener) && |
631 PrintMatchAndExplain(OpParameter<CallDescriptor*>(node), | 631 PrintMatchAndExplain(OpParameter<CallDescriptor*>(node), |
632 "descriptor", descriptor_matcher_, listener) && | 632 "descriptor", descriptor_matcher_, listener) && |
633 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | 633 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
634 "value0", value0_matcher_, listener) && | 634 "value0", value0_matcher_, listener) && |
635 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 635 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
636 "value1", value1_matcher_, listener) && | 636 "value1", value1_matcher_, listener) && |
637 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 637 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
638 effect_matcher_, listener) && | 638 effect_matcher_, listener) && |
639 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 639 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
640 "control", control_matcher_, listener)); | 640 "control", control_matcher_, listener)); |
641 } | 641 } |
642 | 642 |
643 private: | 643 private: |
644 const Matcher<CallDescriptor*> descriptor_matcher_; | 644 const Matcher<CallDescriptor*> descriptor_matcher_; |
645 const Matcher<Node*> value0_matcher_; | 645 const Matcher<Node*> value0_matcher_; |
646 const Matcher<Node*> value1_matcher_; | 646 const Matcher<Node*> value1_matcher_; |
647 const Matcher<Node*> effect_matcher_; | 647 const Matcher<Node*> effect_matcher_; |
648 const Matcher<Node*> control_matcher_; | 648 const Matcher<Node*> control_matcher_; |
649 }; | 649 }; |
650 | 650 |
651 | 651 |
652 class IsCall4Matcher FINAL : public NodeMatcher { | 652 class IsCall4Matcher final : public NodeMatcher { |
653 public: | 653 public: |
654 IsCall4Matcher(const Matcher<CallDescriptor*>& descriptor_matcher, | 654 IsCall4Matcher(const Matcher<CallDescriptor*>& descriptor_matcher, |
655 const Matcher<Node*>& value0_matcher, | 655 const Matcher<Node*>& value0_matcher, |
656 const Matcher<Node*>& value1_matcher, | 656 const Matcher<Node*>& value1_matcher, |
657 const Matcher<Node*>& value2_matcher, | 657 const Matcher<Node*>& value2_matcher, |
658 const Matcher<Node*>& value3_matcher, | 658 const Matcher<Node*>& value3_matcher, |
659 const Matcher<Node*>& effect_matcher, | 659 const Matcher<Node*>& effect_matcher, |
660 const Matcher<Node*>& control_matcher) | 660 const Matcher<Node*>& control_matcher) |
661 : NodeMatcher(IrOpcode::kCall), | 661 : NodeMatcher(IrOpcode::kCall), |
662 descriptor_matcher_(descriptor_matcher), | 662 descriptor_matcher_(descriptor_matcher), |
663 value0_matcher_(value0_matcher), | 663 value0_matcher_(value0_matcher), |
664 value1_matcher_(value1_matcher), | 664 value1_matcher_(value1_matcher), |
665 value2_matcher_(value2_matcher), | 665 value2_matcher_(value2_matcher), |
666 value3_matcher_(value3_matcher), | 666 value3_matcher_(value3_matcher), |
667 effect_matcher_(effect_matcher), | 667 effect_matcher_(effect_matcher), |
668 control_matcher_(control_matcher) {} | 668 control_matcher_(control_matcher) {} |
669 | 669 |
670 void DescribeTo(std::ostream* os) const FINAL { | 670 void DescribeTo(std::ostream* os) const final { |
671 NodeMatcher::DescribeTo(os); | 671 NodeMatcher::DescribeTo(os); |
672 *os << " whose value0 ("; | 672 *os << " whose value0 ("; |
673 value0_matcher_.DescribeTo(os); | 673 value0_matcher_.DescribeTo(os); |
674 *os << ") and value1 ("; | 674 *os << ") and value1 ("; |
675 value1_matcher_.DescribeTo(os); | 675 value1_matcher_.DescribeTo(os); |
676 *os << ") and value2 ("; | 676 *os << ") and value2 ("; |
677 value2_matcher_.DescribeTo(os); | 677 value2_matcher_.DescribeTo(os); |
678 *os << ") and value3 ("; | 678 *os << ") and value3 ("; |
679 value3_matcher_.DescribeTo(os); | 679 value3_matcher_.DescribeTo(os); |
680 *os << ") and effect ("; | 680 *os << ") and effect ("; |
681 effect_matcher_.DescribeTo(os); | 681 effect_matcher_.DescribeTo(os); |
682 *os << ") and control ("; | 682 *os << ") and control ("; |
683 control_matcher_.DescribeTo(os); | 683 control_matcher_.DescribeTo(os); |
684 *os << ")"; | 684 *os << ")"; |
685 } | 685 } |
686 | 686 |
687 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 687 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
688 return (NodeMatcher::MatchAndExplain(node, listener) && | 688 return (NodeMatcher::MatchAndExplain(node, listener) && |
689 PrintMatchAndExplain(OpParameter<CallDescriptor*>(node), | 689 PrintMatchAndExplain(OpParameter<CallDescriptor*>(node), |
690 "descriptor", descriptor_matcher_, listener) && | 690 "descriptor", descriptor_matcher_, listener) && |
691 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | 691 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
692 "value0", value0_matcher_, listener) && | 692 "value0", value0_matcher_, listener) && |
693 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 693 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
694 "value1", value1_matcher_, listener) && | 694 "value1", value1_matcher_, listener) && |
695 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), | 695 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), |
696 "value2", value2_matcher_, listener) && | 696 "value2", value2_matcher_, listener) && |
697 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 3), | 697 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 3), |
698 "value3", value3_matcher_, listener) && | 698 "value3", value3_matcher_, listener) && |
699 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 699 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
700 effect_matcher_, listener) && | 700 effect_matcher_, listener) && |
701 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 701 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
702 "control", control_matcher_, listener)); | 702 "control", control_matcher_, listener)); |
703 } | 703 } |
704 | 704 |
705 private: | 705 private: |
706 const Matcher<CallDescriptor*> descriptor_matcher_; | 706 const Matcher<CallDescriptor*> descriptor_matcher_; |
707 const Matcher<Node*> value0_matcher_; | 707 const Matcher<Node*> value0_matcher_; |
708 const Matcher<Node*> value1_matcher_; | 708 const Matcher<Node*> value1_matcher_; |
709 const Matcher<Node*> value2_matcher_; | 709 const Matcher<Node*> value2_matcher_; |
710 const Matcher<Node*> value3_matcher_; | 710 const Matcher<Node*> value3_matcher_; |
711 const Matcher<Node*> effect_matcher_; | 711 const Matcher<Node*> effect_matcher_; |
712 const Matcher<Node*> control_matcher_; | 712 const Matcher<Node*> control_matcher_; |
713 }; | 713 }; |
714 | 714 |
715 | 715 |
716 class IsLoadFieldMatcher FINAL : public NodeMatcher { | 716 class IsLoadFieldMatcher final : public NodeMatcher { |
717 public: | 717 public: |
718 IsLoadFieldMatcher(const Matcher<FieldAccess>& access_matcher, | 718 IsLoadFieldMatcher(const Matcher<FieldAccess>& access_matcher, |
719 const Matcher<Node*>& base_matcher, | 719 const Matcher<Node*>& base_matcher, |
720 const Matcher<Node*>& effect_matcher, | 720 const Matcher<Node*>& effect_matcher, |
721 const Matcher<Node*>& control_matcher) | 721 const Matcher<Node*>& control_matcher) |
722 : NodeMatcher(IrOpcode::kLoadField), | 722 : NodeMatcher(IrOpcode::kLoadField), |
723 access_matcher_(access_matcher), | 723 access_matcher_(access_matcher), |
724 base_matcher_(base_matcher), | 724 base_matcher_(base_matcher), |
725 effect_matcher_(effect_matcher), | 725 effect_matcher_(effect_matcher), |
726 control_matcher_(control_matcher) {} | 726 control_matcher_(control_matcher) {} |
727 | 727 |
728 void DescribeTo(std::ostream* os) const FINAL { | 728 void DescribeTo(std::ostream* os) const final { |
729 NodeMatcher::DescribeTo(os); | 729 NodeMatcher::DescribeTo(os); |
730 *os << " whose access ("; | 730 *os << " whose access ("; |
731 access_matcher_.DescribeTo(os); | 731 access_matcher_.DescribeTo(os); |
732 *os << "), base ("; | 732 *os << "), base ("; |
733 base_matcher_.DescribeTo(os); | 733 base_matcher_.DescribeTo(os); |
734 *os << "), effect ("; | 734 *os << "), effect ("; |
735 effect_matcher_.DescribeTo(os); | 735 effect_matcher_.DescribeTo(os); |
736 *os << ") and control ("; | 736 *os << ") and control ("; |
737 control_matcher_.DescribeTo(os); | 737 control_matcher_.DescribeTo(os); |
738 *os << ")"; | 738 *os << ")"; |
739 } | 739 } |
740 | 740 |
741 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 741 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
742 return (NodeMatcher::MatchAndExplain(node, listener) && | 742 return (NodeMatcher::MatchAndExplain(node, listener) && |
743 PrintMatchAndExplain(OpParameter<FieldAccess>(node), "access", | 743 PrintMatchAndExplain(OpParameter<FieldAccess>(node), "access", |
744 access_matcher_, listener) && | 744 access_matcher_, listener) && |
745 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", | 745 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
746 base_matcher_, listener) && | 746 base_matcher_, listener) && |
747 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 747 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
748 effect_matcher_, listener) && | 748 effect_matcher_, listener) && |
749 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 749 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
750 "control", control_matcher_, listener)); | 750 "control", control_matcher_, listener)); |
751 } | 751 } |
752 | 752 |
753 private: | 753 private: |
754 const Matcher<FieldAccess> access_matcher_; | 754 const Matcher<FieldAccess> access_matcher_; |
755 const Matcher<Node*> base_matcher_; | 755 const Matcher<Node*> base_matcher_; |
756 const Matcher<Node*> effect_matcher_; | 756 const Matcher<Node*> effect_matcher_; |
757 const Matcher<Node*> control_matcher_; | 757 const Matcher<Node*> control_matcher_; |
758 }; | 758 }; |
759 | 759 |
760 | 760 |
761 class IsStoreFieldMatcher FINAL : public NodeMatcher { | 761 class IsStoreFieldMatcher final : public NodeMatcher { |
762 public: | 762 public: |
763 IsStoreFieldMatcher(const Matcher<FieldAccess>& access_matcher, | 763 IsStoreFieldMatcher(const Matcher<FieldAccess>& access_matcher, |
764 const Matcher<Node*>& base_matcher, | 764 const Matcher<Node*>& base_matcher, |
765 const Matcher<Node*>& value_matcher, | 765 const Matcher<Node*>& value_matcher, |
766 const Matcher<Node*>& effect_matcher, | 766 const Matcher<Node*>& effect_matcher, |
767 const Matcher<Node*>& control_matcher) | 767 const Matcher<Node*>& control_matcher) |
768 : NodeMatcher(IrOpcode::kStoreField), | 768 : NodeMatcher(IrOpcode::kStoreField), |
769 access_matcher_(access_matcher), | 769 access_matcher_(access_matcher), |
770 base_matcher_(base_matcher), | 770 base_matcher_(base_matcher), |
771 value_matcher_(value_matcher), | 771 value_matcher_(value_matcher), |
772 effect_matcher_(effect_matcher), | 772 effect_matcher_(effect_matcher), |
773 control_matcher_(control_matcher) {} | 773 control_matcher_(control_matcher) {} |
774 | 774 |
775 void DescribeTo(std::ostream* os) const FINAL { | 775 void DescribeTo(std::ostream* os) const final { |
776 NodeMatcher::DescribeTo(os); | 776 NodeMatcher::DescribeTo(os); |
777 *os << " whose access ("; | 777 *os << " whose access ("; |
778 access_matcher_.DescribeTo(os); | 778 access_matcher_.DescribeTo(os); |
779 *os << "), base ("; | 779 *os << "), base ("; |
780 base_matcher_.DescribeTo(os); | 780 base_matcher_.DescribeTo(os); |
781 *os << "), value ("; | 781 *os << "), value ("; |
782 value_matcher_.DescribeTo(os); | 782 value_matcher_.DescribeTo(os); |
783 *os << "), effect ("; | 783 *os << "), effect ("; |
784 effect_matcher_.DescribeTo(os); | 784 effect_matcher_.DescribeTo(os); |
785 *os << ") and control ("; | 785 *os << ") and control ("; |
786 control_matcher_.DescribeTo(os); | 786 control_matcher_.DescribeTo(os); |
787 *os << ")"; | 787 *os << ")"; |
788 } | 788 } |
789 | 789 |
790 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 790 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
791 return (NodeMatcher::MatchAndExplain(node, listener) && | 791 return (NodeMatcher::MatchAndExplain(node, listener) && |
792 PrintMatchAndExplain(OpParameter<FieldAccess>(node), "access", | 792 PrintMatchAndExplain(OpParameter<FieldAccess>(node), "access", |
793 access_matcher_, listener) && | 793 access_matcher_, listener) && |
794 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", | 794 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
795 base_matcher_, listener) && | 795 base_matcher_, listener) && |
796 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 796 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
797 "value", value_matcher_, listener) && | 797 "value", value_matcher_, listener) && |
798 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 798 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
799 effect_matcher_, listener) && | 799 effect_matcher_, listener) && |
800 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 800 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
801 "control", control_matcher_, listener)); | 801 "control", control_matcher_, listener)); |
802 } | 802 } |
803 | 803 |
804 private: | 804 private: |
805 const Matcher<FieldAccess> access_matcher_; | 805 const Matcher<FieldAccess> access_matcher_; |
806 const Matcher<Node*> base_matcher_; | 806 const Matcher<Node*> base_matcher_; |
807 const Matcher<Node*> value_matcher_; | 807 const Matcher<Node*> value_matcher_; |
808 const Matcher<Node*> effect_matcher_; | 808 const Matcher<Node*> effect_matcher_; |
809 const Matcher<Node*> control_matcher_; | 809 const Matcher<Node*> control_matcher_; |
810 }; | 810 }; |
811 | 811 |
812 | 812 |
813 class IsLoadBufferMatcher FINAL : public NodeMatcher { | 813 class IsLoadBufferMatcher final : public NodeMatcher { |
814 public: | 814 public: |
815 IsLoadBufferMatcher(const Matcher<BufferAccess>& access_matcher, | 815 IsLoadBufferMatcher(const Matcher<BufferAccess>& access_matcher, |
816 const Matcher<Node*>& buffer_matcher, | 816 const Matcher<Node*>& buffer_matcher, |
817 const Matcher<Node*>& offset_matcher, | 817 const Matcher<Node*>& offset_matcher, |
818 const Matcher<Node*>& length_matcher, | 818 const Matcher<Node*>& length_matcher, |
819 const Matcher<Node*>& effect_matcher, | 819 const Matcher<Node*>& effect_matcher, |
820 const Matcher<Node*>& control_matcher) | 820 const Matcher<Node*>& control_matcher) |
821 : NodeMatcher(IrOpcode::kLoadBuffer), | 821 : NodeMatcher(IrOpcode::kLoadBuffer), |
822 access_matcher_(access_matcher), | 822 access_matcher_(access_matcher), |
823 buffer_matcher_(buffer_matcher), | 823 buffer_matcher_(buffer_matcher), |
824 offset_matcher_(offset_matcher), | 824 offset_matcher_(offset_matcher), |
825 length_matcher_(length_matcher), | 825 length_matcher_(length_matcher), |
826 effect_matcher_(effect_matcher), | 826 effect_matcher_(effect_matcher), |
827 control_matcher_(control_matcher) {} | 827 control_matcher_(control_matcher) {} |
828 | 828 |
829 void DescribeTo(std::ostream* os) const FINAL { | 829 void DescribeTo(std::ostream* os) const final { |
830 NodeMatcher::DescribeTo(os); | 830 NodeMatcher::DescribeTo(os); |
831 *os << " whose access ("; | 831 *os << " whose access ("; |
832 access_matcher_.DescribeTo(os); | 832 access_matcher_.DescribeTo(os); |
833 *os << "), buffer ("; | 833 *os << "), buffer ("; |
834 buffer_matcher_.DescribeTo(os); | 834 buffer_matcher_.DescribeTo(os); |
835 *os << "), offset ("; | 835 *os << "), offset ("; |
836 offset_matcher_.DescribeTo(os); | 836 offset_matcher_.DescribeTo(os); |
837 *os << "), length ("; | 837 *os << "), length ("; |
838 length_matcher_.DescribeTo(os); | 838 length_matcher_.DescribeTo(os); |
839 *os << "), effect ("; | 839 *os << "), effect ("; |
840 effect_matcher_.DescribeTo(os); | 840 effect_matcher_.DescribeTo(os); |
841 *os << ") and control ("; | 841 *os << ") and control ("; |
842 control_matcher_.DescribeTo(os); | 842 control_matcher_.DescribeTo(os); |
843 *os << ")"; | 843 *os << ")"; |
844 } | 844 } |
845 | 845 |
846 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 846 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
847 return (NodeMatcher::MatchAndExplain(node, listener) && | 847 return (NodeMatcher::MatchAndExplain(node, listener) && |
848 PrintMatchAndExplain(BufferAccessOf(node->op()), "access", | 848 PrintMatchAndExplain(BufferAccessOf(node->op()), "access", |
849 access_matcher_, listener) && | 849 access_matcher_, listener) && |
850 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | 850 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
851 "buffer", buffer_matcher_, listener) && | 851 "buffer", buffer_matcher_, listener) && |
852 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 852 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
853 "offset", offset_matcher_, listener) && | 853 "offset", offset_matcher_, listener) && |
854 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), | 854 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), |
855 "length", length_matcher_, listener) && | 855 "length", length_matcher_, listener) && |
856 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 856 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
857 effect_matcher_, listener) && | 857 effect_matcher_, listener) && |
858 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 858 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
859 "control", control_matcher_, listener)); | 859 "control", control_matcher_, listener)); |
860 } | 860 } |
861 | 861 |
862 private: | 862 private: |
863 const Matcher<BufferAccess> access_matcher_; | 863 const Matcher<BufferAccess> access_matcher_; |
864 const Matcher<Node*> buffer_matcher_; | 864 const Matcher<Node*> buffer_matcher_; |
865 const Matcher<Node*> offset_matcher_; | 865 const Matcher<Node*> offset_matcher_; |
866 const Matcher<Node*> length_matcher_; | 866 const Matcher<Node*> length_matcher_; |
867 const Matcher<Node*> effect_matcher_; | 867 const Matcher<Node*> effect_matcher_; |
868 const Matcher<Node*> control_matcher_; | 868 const Matcher<Node*> control_matcher_; |
869 }; | 869 }; |
870 | 870 |
871 | 871 |
872 class IsStoreBufferMatcher FINAL : public NodeMatcher { | 872 class IsStoreBufferMatcher final : public NodeMatcher { |
873 public: | 873 public: |
874 IsStoreBufferMatcher(const Matcher<BufferAccess>& access_matcher, | 874 IsStoreBufferMatcher(const Matcher<BufferAccess>& access_matcher, |
875 const Matcher<Node*>& buffer_matcher, | 875 const Matcher<Node*>& buffer_matcher, |
876 const Matcher<Node*>& offset_matcher, | 876 const Matcher<Node*>& offset_matcher, |
877 const Matcher<Node*>& length_matcher, | 877 const Matcher<Node*>& length_matcher, |
878 const Matcher<Node*>& value_matcher, | 878 const Matcher<Node*>& value_matcher, |
879 const Matcher<Node*>& effect_matcher, | 879 const Matcher<Node*>& effect_matcher, |
880 const Matcher<Node*>& control_matcher) | 880 const Matcher<Node*>& control_matcher) |
881 : NodeMatcher(IrOpcode::kStoreBuffer), | 881 : NodeMatcher(IrOpcode::kStoreBuffer), |
882 access_matcher_(access_matcher), | 882 access_matcher_(access_matcher), |
883 buffer_matcher_(buffer_matcher), | 883 buffer_matcher_(buffer_matcher), |
884 offset_matcher_(offset_matcher), | 884 offset_matcher_(offset_matcher), |
885 length_matcher_(length_matcher), | 885 length_matcher_(length_matcher), |
886 value_matcher_(value_matcher), | 886 value_matcher_(value_matcher), |
887 effect_matcher_(effect_matcher), | 887 effect_matcher_(effect_matcher), |
888 control_matcher_(control_matcher) {} | 888 control_matcher_(control_matcher) {} |
889 | 889 |
890 void DescribeTo(std::ostream* os) const FINAL { | 890 void DescribeTo(std::ostream* os) const final { |
891 NodeMatcher::DescribeTo(os); | 891 NodeMatcher::DescribeTo(os); |
892 *os << " whose access ("; | 892 *os << " whose access ("; |
893 access_matcher_.DescribeTo(os); | 893 access_matcher_.DescribeTo(os); |
894 *os << "), buffer ("; | 894 *os << "), buffer ("; |
895 buffer_matcher_.DescribeTo(os); | 895 buffer_matcher_.DescribeTo(os); |
896 *os << "), offset ("; | 896 *os << "), offset ("; |
897 offset_matcher_.DescribeTo(os); | 897 offset_matcher_.DescribeTo(os); |
898 *os << "), length ("; | 898 *os << "), length ("; |
899 length_matcher_.DescribeTo(os); | 899 length_matcher_.DescribeTo(os); |
900 *os << "), value ("; | 900 *os << "), value ("; |
901 value_matcher_.DescribeTo(os); | 901 value_matcher_.DescribeTo(os); |
902 *os << "), effect ("; | 902 *os << "), effect ("; |
903 effect_matcher_.DescribeTo(os); | 903 effect_matcher_.DescribeTo(os); |
904 *os << ") and control ("; | 904 *os << ") and control ("; |
905 control_matcher_.DescribeTo(os); | 905 control_matcher_.DescribeTo(os); |
906 *os << ")"; | 906 *os << ")"; |
907 } | 907 } |
908 | 908 |
909 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 909 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
910 return (NodeMatcher::MatchAndExplain(node, listener) && | 910 return (NodeMatcher::MatchAndExplain(node, listener) && |
911 PrintMatchAndExplain(BufferAccessOf(node->op()), "access", | 911 PrintMatchAndExplain(BufferAccessOf(node->op()), "access", |
912 access_matcher_, listener) && | 912 access_matcher_, listener) && |
913 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | 913 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
914 "buffer", buffer_matcher_, listener) && | 914 "buffer", buffer_matcher_, listener) && |
915 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 915 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
916 "offset", offset_matcher_, listener) && | 916 "offset", offset_matcher_, listener) && |
917 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), | 917 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), |
918 "length", length_matcher_, listener) && | 918 "length", length_matcher_, listener) && |
919 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 3), | 919 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 3), |
920 "value", value_matcher_, listener) && | 920 "value", value_matcher_, listener) && |
921 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 921 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
922 effect_matcher_, listener) && | 922 effect_matcher_, listener) && |
923 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 923 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
924 "control", control_matcher_, listener)); | 924 "control", control_matcher_, listener)); |
925 } | 925 } |
926 | 926 |
927 private: | 927 private: |
928 const Matcher<BufferAccess> access_matcher_; | 928 const Matcher<BufferAccess> access_matcher_; |
929 const Matcher<Node*> buffer_matcher_; | 929 const Matcher<Node*> buffer_matcher_; |
930 const Matcher<Node*> offset_matcher_; | 930 const Matcher<Node*> offset_matcher_; |
931 const Matcher<Node*> length_matcher_; | 931 const Matcher<Node*> length_matcher_; |
932 const Matcher<Node*> value_matcher_; | 932 const Matcher<Node*> value_matcher_; |
933 const Matcher<Node*> effect_matcher_; | 933 const Matcher<Node*> effect_matcher_; |
934 const Matcher<Node*> control_matcher_; | 934 const Matcher<Node*> control_matcher_; |
935 }; | 935 }; |
936 | 936 |
937 | 937 |
938 class IsLoadElementMatcher FINAL : public NodeMatcher { | 938 class IsLoadElementMatcher final : public NodeMatcher { |
939 public: | 939 public: |
940 IsLoadElementMatcher(const Matcher<ElementAccess>& access_matcher, | 940 IsLoadElementMatcher(const Matcher<ElementAccess>& access_matcher, |
941 const Matcher<Node*>& base_matcher, | 941 const Matcher<Node*>& base_matcher, |
942 const Matcher<Node*>& index_matcher, | 942 const Matcher<Node*>& index_matcher, |
943 const Matcher<Node*>& effect_matcher, | 943 const Matcher<Node*>& effect_matcher, |
944 const Matcher<Node*>& control_matcher) | 944 const Matcher<Node*>& control_matcher) |
945 : NodeMatcher(IrOpcode::kLoadElement), | 945 : NodeMatcher(IrOpcode::kLoadElement), |
946 access_matcher_(access_matcher), | 946 access_matcher_(access_matcher), |
947 base_matcher_(base_matcher), | 947 base_matcher_(base_matcher), |
948 index_matcher_(index_matcher), | 948 index_matcher_(index_matcher), |
949 effect_matcher_(effect_matcher), | 949 effect_matcher_(effect_matcher), |
950 control_matcher_(control_matcher) {} | 950 control_matcher_(control_matcher) {} |
951 | 951 |
952 void DescribeTo(std::ostream* os) const FINAL { | 952 void DescribeTo(std::ostream* os) const final { |
953 NodeMatcher::DescribeTo(os); | 953 NodeMatcher::DescribeTo(os); |
954 *os << " whose access ("; | 954 *os << " whose access ("; |
955 access_matcher_.DescribeTo(os); | 955 access_matcher_.DescribeTo(os); |
956 *os << "), base ("; | 956 *os << "), base ("; |
957 base_matcher_.DescribeTo(os); | 957 base_matcher_.DescribeTo(os); |
958 *os << "), index ("; | 958 *os << "), index ("; |
959 index_matcher_.DescribeTo(os); | 959 index_matcher_.DescribeTo(os); |
960 *os << "), effect ("; | 960 *os << "), effect ("; |
961 effect_matcher_.DescribeTo(os); | 961 effect_matcher_.DescribeTo(os); |
962 *os << ") and control ("; | 962 *os << ") and control ("; |
963 control_matcher_.DescribeTo(os); | 963 control_matcher_.DescribeTo(os); |
964 *os << ")"; | 964 *os << ")"; |
965 } | 965 } |
966 | 966 |
967 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 967 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
968 return (NodeMatcher::MatchAndExplain(node, listener) && | 968 return (NodeMatcher::MatchAndExplain(node, listener) && |
969 PrintMatchAndExplain(OpParameter<ElementAccess>(node), "access", | 969 PrintMatchAndExplain(OpParameter<ElementAccess>(node), "access", |
970 access_matcher_, listener) && | 970 access_matcher_, listener) && |
971 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", | 971 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
972 base_matcher_, listener) && | 972 base_matcher_, listener) && |
973 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 973 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
974 "index", index_matcher_, listener) && | 974 "index", index_matcher_, listener) && |
975 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 975 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
976 effect_matcher_, listener) && | 976 effect_matcher_, listener) && |
977 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 977 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
978 "control", control_matcher_, listener)); | 978 "control", control_matcher_, listener)); |
979 } | 979 } |
980 | 980 |
981 private: | 981 private: |
982 const Matcher<ElementAccess> access_matcher_; | 982 const Matcher<ElementAccess> access_matcher_; |
983 const Matcher<Node*> base_matcher_; | 983 const Matcher<Node*> base_matcher_; |
984 const Matcher<Node*> index_matcher_; | 984 const Matcher<Node*> index_matcher_; |
985 const Matcher<Node*> effect_matcher_; | 985 const Matcher<Node*> effect_matcher_; |
986 const Matcher<Node*> control_matcher_; | 986 const Matcher<Node*> control_matcher_; |
987 }; | 987 }; |
988 | 988 |
989 | 989 |
990 class IsStoreElementMatcher FINAL : public NodeMatcher { | 990 class IsStoreElementMatcher final : public NodeMatcher { |
991 public: | 991 public: |
992 IsStoreElementMatcher(const Matcher<ElementAccess>& access_matcher, | 992 IsStoreElementMatcher(const Matcher<ElementAccess>& access_matcher, |
993 const Matcher<Node*>& base_matcher, | 993 const Matcher<Node*>& base_matcher, |
994 const Matcher<Node*>& index_matcher, | 994 const Matcher<Node*>& index_matcher, |
995 const Matcher<Node*>& value_matcher, | 995 const Matcher<Node*>& value_matcher, |
996 const Matcher<Node*>& effect_matcher, | 996 const Matcher<Node*>& effect_matcher, |
997 const Matcher<Node*>& control_matcher) | 997 const Matcher<Node*>& control_matcher) |
998 : NodeMatcher(IrOpcode::kStoreElement), | 998 : NodeMatcher(IrOpcode::kStoreElement), |
999 access_matcher_(access_matcher), | 999 access_matcher_(access_matcher), |
1000 base_matcher_(base_matcher), | 1000 base_matcher_(base_matcher), |
1001 index_matcher_(index_matcher), | 1001 index_matcher_(index_matcher), |
1002 value_matcher_(value_matcher), | 1002 value_matcher_(value_matcher), |
1003 effect_matcher_(effect_matcher), | 1003 effect_matcher_(effect_matcher), |
1004 control_matcher_(control_matcher) {} | 1004 control_matcher_(control_matcher) {} |
1005 | 1005 |
1006 void DescribeTo(std::ostream* os) const FINAL { | 1006 void DescribeTo(std::ostream* os) const final { |
1007 NodeMatcher::DescribeTo(os); | 1007 NodeMatcher::DescribeTo(os); |
1008 *os << " whose access ("; | 1008 *os << " whose access ("; |
1009 access_matcher_.DescribeTo(os); | 1009 access_matcher_.DescribeTo(os); |
1010 *os << "), base ("; | 1010 *os << "), base ("; |
1011 base_matcher_.DescribeTo(os); | 1011 base_matcher_.DescribeTo(os); |
1012 *os << "), index ("; | 1012 *os << "), index ("; |
1013 index_matcher_.DescribeTo(os); | 1013 index_matcher_.DescribeTo(os); |
1014 *os << "), value ("; | 1014 *os << "), value ("; |
1015 value_matcher_.DescribeTo(os); | 1015 value_matcher_.DescribeTo(os); |
1016 *os << "), effect ("; | 1016 *os << "), effect ("; |
1017 effect_matcher_.DescribeTo(os); | 1017 effect_matcher_.DescribeTo(os); |
1018 *os << ") and control ("; | 1018 *os << ") and control ("; |
1019 control_matcher_.DescribeTo(os); | 1019 control_matcher_.DescribeTo(os); |
1020 *os << ")"; | 1020 *os << ")"; |
1021 } | 1021 } |
1022 | 1022 |
1023 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 1023 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
1024 return (NodeMatcher::MatchAndExplain(node, listener) && | 1024 return (NodeMatcher::MatchAndExplain(node, listener) && |
1025 PrintMatchAndExplain(OpParameter<ElementAccess>(node), "access", | 1025 PrintMatchAndExplain(OpParameter<ElementAccess>(node), "access", |
1026 access_matcher_, listener) && | 1026 access_matcher_, listener) && |
1027 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", | 1027 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
1028 base_matcher_, listener) && | 1028 base_matcher_, listener) && |
1029 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 1029 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
1030 "index", index_matcher_, listener) && | 1030 "index", index_matcher_, listener) && |
1031 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), | 1031 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), |
1032 "value", value_matcher_, listener) && | 1032 "value", value_matcher_, listener) && |
1033 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 1033 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
1034 effect_matcher_, listener) && | 1034 effect_matcher_, listener) && |
1035 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 1035 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
1036 "control", control_matcher_, listener)); | 1036 "control", control_matcher_, listener)); |
1037 } | 1037 } |
1038 | 1038 |
1039 private: | 1039 private: |
1040 const Matcher<ElementAccess> access_matcher_; | 1040 const Matcher<ElementAccess> access_matcher_; |
1041 const Matcher<Node*> base_matcher_; | 1041 const Matcher<Node*> base_matcher_; |
1042 const Matcher<Node*> index_matcher_; | 1042 const Matcher<Node*> index_matcher_; |
1043 const Matcher<Node*> value_matcher_; | 1043 const Matcher<Node*> value_matcher_; |
1044 const Matcher<Node*> effect_matcher_; | 1044 const Matcher<Node*> effect_matcher_; |
1045 const Matcher<Node*> control_matcher_; | 1045 const Matcher<Node*> control_matcher_; |
1046 }; | 1046 }; |
1047 | 1047 |
1048 | 1048 |
1049 class IsLoadMatcher FINAL : public NodeMatcher { | 1049 class IsLoadMatcher final : public NodeMatcher { |
1050 public: | 1050 public: |
1051 IsLoadMatcher(const Matcher<LoadRepresentation>& rep_matcher, | 1051 IsLoadMatcher(const Matcher<LoadRepresentation>& rep_matcher, |
1052 const Matcher<Node*>& base_matcher, | 1052 const Matcher<Node*>& base_matcher, |
1053 const Matcher<Node*>& index_matcher, | 1053 const Matcher<Node*>& index_matcher, |
1054 const Matcher<Node*>& effect_matcher, | 1054 const Matcher<Node*>& effect_matcher, |
1055 const Matcher<Node*>& control_matcher) | 1055 const Matcher<Node*>& control_matcher) |
1056 : NodeMatcher(IrOpcode::kLoad), | 1056 : NodeMatcher(IrOpcode::kLoad), |
1057 rep_matcher_(rep_matcher), | 1057 rep_matcher_(rep_matcher), |
1058 base_matcher_(base_matcher), | 1058 base_matcher_(base_matcher), |
1059 index_matcher_(index_matcher), | 1059 index_matcher_(index_matcher), |
1060 effect_matcher_(effect_matcher), | 1060 effect_matcher_(effect_matcher), |
1061 control_matcher_(control_matcher) {} | 1061 control_matcher_(control_matcher) {} |
1062 | 1062 |
1063 void DescribeTo(std::ostream* os) const FINAL { | 1063 void DescribeTo(std::ostream* os) const final { |
1064 NodeMatcher::DescribeTo(os); | 1064 NodeMatcher::DescribeTo(os); |
1065 *os << " whose rep ("; | 1065 *os << " whose rep ("; |
1066 rep_matcher_.DescribeTo(os); | 1066 rep_matcher_.DescribeTo(os); |
1067 *os << "), base ("; | 1067 *os << "), base ("; |
1068 base_matcher_.DescribeTo(os); | 1068 base_matcher_.DescribeTo(os); |
1069 *os << "), index ("; | 1069 *os << "), index ("; |
1070 index_matcher_.DescribeTo(os); | 1070 index_matcher_.DescribeTo(os); |
1071 *os << "), effect ("; | 1071 *os << "), effect ("; |
1072 effect_matcher_.DescribeTo(os); | 1072 effect_matcher_.DescribeTo(os); |
1073 *os << ") and control ("; | 1073 *os << ") and control ("; |
1074 control_matcher_.DescribeTo(os); | 1074 control_matcher_.DescribeTo(os); |
1075 *os << ")"; | 1075 *os << ")"; |
1076 } | 1076 } |
1077 | 1077 |
1078 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 1078 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
1079 return (NodeMatcher::MatchAndExplain(node, listener) && | 1079 return (NodeMatcher::MatchAndExplain(node, listener) && |
1080 PrintMatchAndExplain(OpParameter<LoadRepresentation>(node), "rep", | 1080 PrintMatchAndExplain(OpParameter<LoadRepresentation>(node), "rep", |
1081 rep_matcher_, listener) && | 1081 rep_matcher_, listener) && |
1082 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", | 1082 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
1083 base_matcher_, listener) && | 1083 base_matcher_, listener) && |
1084 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 1084 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
1085 "index", index_matcher_, listener) && | 1085 "index", index_matcher_, listener) && |
1086 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 1086 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
1087 effect_matcher_, listener) && | 1087 effect_matcher_, listener) && |
1088 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 1088 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
1089 "control", control_matcher_, listener)); | 1089 "control", control_matcher_, listener)); |
1090 } | 1090 } |
1091 | 1091 |
1092 private: | 1092 private: |
1093 const Matcher<LoadRepresentation> rep_matcher_; | 1093 const Matcher<LoadRepresentation> rep_matcher_; |
1094 const Matcher<Node*> base_matcher_; | 1094 const Matcher<Node*> base_matcher_; |
1095 const Matcher<Node*> index_matcher_; | 1095 const Matcher<Node*> index_matcher_; |
1096 const Matcher<Node*> effect_matcher_; | 1096 const Matcher<Node*> effect_matcher_; |
1097 const Matcher<Node*> control_matcher_; | 1097 const Matcher<Node*> control_matcher_; |
1098 }; | 1098 }; |
1099 | 1099 |
1100 | 1100 |
1101 class IsToNumberMatcher FINAL : public NodeMatcher { | 1101 class IsToNumberMatcher final : public NodeMatcher { |
1102 public: | 1102 public: |
1103 IsToNumberMatcher(const Matcher<Node*>& base_matcher, | 1103 IsToNumberMatcher(const Matcher<Node*>& base_matcher, |
1104 const Matcher<Node*>& context_matcher, | 1104 const Matcher<Node*>& context_matcher, |
1105 const Matcher<Node*>& effect_matcher, | 1105 const Matcher<Node*>& effect_matcher, |
1106 const Matcher<Node*>& control_matcher) | 1106 const Matcher<Node*>& control_matcher) |
1107 : NodeMatcher(IrOpcode::kJSToNumber), | 1107 : NodeMatcher(IrOpcode::kJSToNumber), |
1108 base_matcher_(base_matcher), | 1108 base_matcher_(base_matcher), |
1109 context_matcher_(context_matcher), | 1109 context_matcher_(context_matcher), |
1110 effect_matcher_(effect_matcher), | 1110 effect_matcher_(effect_matcher), |
1111 control_matcher_(control_matcher) {} | 1111 control_matcher_(control_matcher) {} |
1112 | 1112 |
1113 void DescribeTo(std::ostream* os) const FINAL { | 1113 void DescribeTo(std::ostream* os) const final { |
1114 NodeMatcher::DescribeTo(os); | 1114 NodeMatcher::DescribeTo(os); |
1115 *os << " whose base ("; | 1115 *os << " whose base ("; |
1116 base_matcher_.DescribeTo(os); | 1116 base_matcher_.DescribeTo(os); |
1117 *os << "), context ("; | 1117 *os << "), context ("; |
1118 context_matcher_.DescribeTo(os); | 1118 context_matcher_.DescribeTo(os); |
1119 *os << "), effect ("; | 1119 *os << "), effect ("; |
1120 effect_matcher_.DescribeTo(os); | 1120 effect_matcher_.DescribeTo(os); |
1121 *os << ") and control ("; | 1121 *os << ") and control ("; |
1122 control_matcher_.DescribeTo(os); | 1122 control_matcher_.DescribeTo(os); |
1123 *os << ")"; | 1123 *os << ")"; |
1124 } | 1124 } |
1125 | 1125 |
1126 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 1126 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
1127 return (NodeMatcher::MatchAndExplain(node, listener) && | 1127 return (NodeMatcher::MatchAndExplain(node, listener) && |
1128 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", | 1128 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
1129 base_matcher_, listener) && | 1129 base_matcher_, listener) && |
1130 PrintMatchAndExplain(NodeProperties::GetContextInput(node), | 1130 PrintMatchAndExplain(NodeProperties::GetContextInput(node), |
1131 "context", context_matcher_, listener) && | 1131 "context", context_matcher_, listener) && |
1132 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 1132 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
1133 effect_matcher_, listener) && | 1133 effect_matcher_, listener) && |
1134 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 1134 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
1135 "control", control_matcher_, listener)); | 1135 "control", control_matcher_, listener)); |
1136 } | 1136 } |
1137 | 1137 |
1138 private: | 1138 private: |
1139 const Matcher<Node*> base_matcher_; | 1139 const Matcher<Node*> base_matcher_; |
1140 const Matcher<Node*> context_matcher_; | 1140 const Matcher<Node*> context_matcher_; |
1141 const Matcher<Node*> effect_matcher_; | 1141 const Matcher<Node*> effect_matcher_; |
1142 const Matcher<Node*> control_matcher_; | 1142 const Matcher<Node*> control_matcher_; |
1143 }; | 1143 }; |
1144 | 1144 |
1145 | 1145 |
1146 class IsStoreMatcher FINAL : public NodeMatcher { | 1146 class IsStoreMatcher final : public NodeMatcher { |
1147 public: | 1147 public: |
1148 IsStoreMatcher(const Matcher<StoreRepresentation>& rep_matcher, | 1148 IsStoreMatcher(const Matcher<StoreRepresentation>& rep_matcher, |
1149 const Matcher<Node*>& base_matcher, | 1149 const Matcher<Node*>& base_matcher, |
1150 const Matcher<Node*>& index_matcher, | 1150 const Matcher<Node*>& index_matcher, |
1151 const Matcher<Node*>& value_matcher, | 1151 const Matcher<Node*>& value_matcher, |
1152 const Matcher<Node*>& effect_matcher, | 1152 const Matcher<Node*>& effect_matcher, |
1153 const Matcher<Node*>& control_matcher) | 1153 const Matcher<Node*>& control_matcher) |
1154 : NodeMatcher(IrOpcode::kStore), | 1154 : NodeMatcher(IrOpcode::kStore), |
1155 rep_matcher_(rep_matcher), | 1155 rep_matcher_(rep_matcher), |
1156 base_matcher_(base_matcher), | 1156 base_matcher_(base_matcher), |
1157 index_matcher_(index_matcher), | 1157 index_matcher_(index_matcher), |
1158 value_matcher_(value_matcher), | 1158 value_matcher_(value_matcher), |
1159 effect_matcher_(effect_matcher), | 1159 effect_matcher_(effect_matcher), |
1160 control_matcher_(control_matcher) {} | 1160 control_matcher_(control_matcher) {} |
1161 | 1161 |
1162 void DescribeTo(std::ostream* os) const FINAL { | 1162 void DescribeTo(std::ostream* os) const final { |
1163 NodeMatcher::DescribeTo(os); | 1163 NodeMatcher::DescribeTo(os); |
1164 *os << " whose rep ("; | 1164 *os << " whose rep ("; |
1165 rep_matcher_.DescribeTo(os); | 1165 rep_matcher_.DescribeTo(os); |
1166 *os << "), base ("; | 1166 *os << "), base ("; |
1167 base_matcher_.DescribeTo(os); | 1167 base_matcher_.DescribeTo(os); |
1168 *os << "), index ("; | 1168 *os << "), index ("; |
1169 index_matcher_.DescribeTo(os); | 1169 index_matcher_.DescribeTo(os); |
1170 *os << "), value ("; | 1170 *os << "), value ("; |
1171 value_matcher_.DescribeTo(os); | 1171 value_matcher_.DescribeTo(os); |
1172 *os << "), effect ("; | 1172 *os << "), effect ("; |
1173 effect_matcher_.DescribeTo(os); | 1173 effect_matcher_.DescribeTo(os); |
1174 *os << ") and control ("; | 1174 *os << ") and control ("; |
1175 control_matcher_.DescribeTo(os); | 1175 control_matcher_.DescribeTo(os); |
1176 *os << ")"; | 1176 *os << ")"; |
1177 } | 1177 } |
1178 | 1178 |
1179 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 1179 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
1180 return (NodeMatcher::MatchAndExplain(node, listener) && | 1180 return (NodeMatcher::MatchAndExplain(node, listener) && |
1181 PrintMatchAndExplain(OpParameter<StoreRepresentation>(node), "rep", | 1181 PrintMatchAndExplain(OpParameter<StoreRepresentation>(node), "rep", |
1182 rep_matcher_, listener) && | 1182 rep_matcher_, listener) && |
1183 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", | 1183 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
1184 base_matcher_, listener) && | 1184 base_matcher_, listener) && |
1185 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 1185 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
1186 "index", index_matcher_, listener) && | 1186 "index", index_matcher_, listener) && |
1187 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), | 1187 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), |
1188 "value", value_matcher_, listener) && | 1188 "value", value_matcher_, listener) && |
1189 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 1189 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
1190 effect_matcher_, listener) && | 1190 effect_matcher_, listener) && |
1191 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 1191 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
1192 "control", control_matcher_, listener)); | 1192 "control", control_matcher_, listener)); |
1193 } | 1193 } |
1194 | 1194 |
1195 private: | 1195 private: |
1196 const Matcher<StoreRepresentation> rep_matcher_; | 1196 const Matcher<StoreRepresentation> rep_matcher_; |
1197 const Matcher<Node*> base_matcher_; | 1197 const Matcher<Node*> base_matcher_; |
1198 const Matcher<Node*> index_matcher_; | 1198 const Matcher<Node*> index_matcher_; |
1199 const Matcher<Node*> value_matcher_; | 1199 const Matcher<Node*> value_matcher_; |
1200 const Matcher<Node*> effect_matcher_; | 1200 const Matcher<Node*> effect_matcher_; |
1201 const Matcher<Node*> control_matcher_; | 1201 const Matcher<Node*> control_matcher_; |
1202 }; | 1202 }; |
1203 | 1203 |
1204 | 1204 |
1205 class IsBinopMatcher FINAL : public NodeMatcher { | 1205 class IsBinopMatcher final : public NodeMatcher { |
1206 public: | 1206 public: |
1207 IsBinopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& lhs_matcher, | 1207 IsBinopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& lhs_matcher, |
1208 const Matcher<Node*>& rhs_matcher) | 1208 const Matcher<Node*>& rhs_matcher) |
1209 : NodeMatcher(opcode), | 1209 : NodeMatcher(opcode), |
1210 lhs_matcher_(lhs_matcher), | 1210 lhs_matcher_(lhs_matcher), |
1211 rhs_matcher_(rhs_matcher) {} | 1211 rhs_matcher_(rhs_matcher) {} |
1212 | 1212 |
1213 void DescribeTo(std::ostream* os) const FINAL { | 1213 void DescribeTo(std::ostream* os) const final { |
1214 NodeMatcher::DescribeTo(os); | 1214 NodeMatcher::DescribeTo(os); |
1215 *os << " whose lhs ("; | 1215 *os << " whose lhs ("; |
1216 lhs_matcher_.DescribeTo(os); | 1216 lhs_matcher_.DescribeTo(os); |
1217 *os << ") and rhs ("; | 1217 *os << ") and rhs ("; |
1218 rhs_matcher_.DescribeTo(os); | 1218 rhs_matcher_.DescribeTo(os); |
1219 *os << ")"; | 1219 *os << ")"; |
1220 } | 1220 } |
1221 | 1221 |
1222 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 1222 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
1223 return (NodeMatcher::MatchAndExplain(node, listener) && | 1223 return (NodeMatcher::MatchAndExplain(node, listener) && |
1224 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs", | 1224 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs", |
1225 lhs_matcher_, listener) && | 1225 lhs_matcher_, listener) && |
1226 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", | 1226 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", |
1227 rhs_matcher_, listener)); | 1227 rhs_matcher_, listener)); |
1228 } | 1228 } |
1229 | 1229 |
1230 private: | 1230 private: |
1231 const Matcher<Node*> lhs_matcher_; | 1231 const Matcher<Node*> lhs_matcher_; |
1232 const Matcher<Node*> rhs_matcher_; | 1232 const Matcher<Node*> rhs_matcher_; |
1233 }; | 1233 }; |
1234 | 1234 |
1235 | 1235 |
1236 class IsUnopMatcher FINAL : public NodeMatcher { | 1236 class IsUnopMatcher final : public NodeMatcher { |
1237 public: | 1237 public: |
1238 IsUnopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& input_matcher) | 1238 IsUnopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& input_matcher) |
1239 : NodeMatcher(opcode), input_matcher_(input_matcher) {} | 1239 : NodeMatcher(opcode), input_matcher_(input_matcher) {} |
1240 | 1240 |
1241 void DescribeTo(std::ostream* os) const FINAL { | 1241 void DescribeTo(std::ostream* os) const final { |
1242 NodeMatcher::DescribeTo(os); | 1242 NodeMatcher::DescribeTo(os); |
1243 *os << " whose input ("; | 1243 *os << " whose input ("; |
1244 input_matcher_.DescribeTo(os); | 1244 input_matcher_.DescribeTo(os); |
1245 *os << ")"; | 1245 *os << ")"; |
1246 } | 1246 } |
1247 | 1247 |
1248 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 1248 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
1249 return (NodeMatcher::MatchAndExplain(node, listener) && | 1249 return (NodeMatcher::MatchAndExplain(node, listener) && |
1250 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | 1250 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
1251 "input", input_matcher_, listener)); | 1251 "input", input_matcher_, listener)); |
1252 } | 1252 } |
1253 | 1253 |
1254 private: | 1254 private: |
1255 const Matcher<Node*> input_matcher_; | 1255 const Matcher<Node*> input_matcher_; |
1256 }; | 1256 }; |
1257 | 1257 |
1258 } // namespace | 1258 } // namespace |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1637 IS_UNOP_MATCHER(NumberToInt32) | 1637 IS_UNOP_MATCHER(NumberToInt32) |
1638 IS_UNOP_MATCHER(NumberToUint32) | 1638 IS_UNOP_MATCHER(NumberToUint32) |
1639 IS_UNOP_MATCHER(ObjectIsSmi) | 1639 IS_UNOP_MATCHER(ObjectIsSmi) |
1640 IS_UNOP_MATCHER(ObjectIsNonNegativeSmi) | 1640 IS_UNOP_MATCHER(ObjectIsNonNegativeSmi) |
1641 IS_UNOP_MATCHER(Word32Clz) | 1641 IS_UNOP_MATCHER(Word32Clz) |
1642 #undef IS_UNOP_MATCHER | 1642 #undef IS_UNOP_MATCHER |
1643 | 1643 |
1644 } // namespace compiler | 1644 } // namespace compiler |
1645 } // namespace internal | 1645 } // namespace internal |
1646 } // namespace v8 | 1646 } // namespace v8 |
OLD | NEW |