Home | History | Annotate | Download | only in compiler

Lines Matching refs:node

12 #include "src/compiler/node.h"
21 explicit NodeMatcher(Node* node) : node_(node) {}
23 Node* node() const { return node_; }
24 const Operator* op() const { return node()->op(); }
25 IrOpcode::Value opcode() const { return node()->opcode(); }
30 Node* InputAt(int index) const { return node()->InputAt(index); }
32 bool Equals(const Node* node) const { return node_ == node; }
42 Node* node_;
51 explicit ValueMatcher(Node* node)
52 : NodeMatcher(node), value_(), has_value_(opcode() == kOpcode) {
54 value_ = OpParameter<T>(node);
72 Node* node)
73 : NodeMatcher(node),
77 value_ = static_cast<uint32_t>(OpParameter<int32_t>(node));
83 inline ValueMatcher<int64_t, IrOpcode::kInt64Constant>::ValueMatcher(Node* node)
84 : NodeMatcher(node), value_(), has_value_(false) {
86 value_ = OpParameter<int32_t>(node);
89 value_ = OpParameter<int64_t>(node);
97 Node* node)
98 : NodeMatcher(node), value_(), has_value_(false) {
100 value_ = static_cast<uint32_t>(OpParameter<int32_t>(node));
103 value_ = static_cast<uint64_t>(OpParameter<int64_t>(node));
112 explicit IntMatcher(Node* node) : ValueMatcher<T, kOpcode>(node) {}
149 explicit FloatMatcher(Node* node) : ValueMatcher<T, kOpcode>(node) {}
172 explicit HeapObjectMatcher(Node* node)
173 : ValueMatcher<Handle<HeapObject>, IrOpcode::kHeapConstant>(node) {}
180 explicit ExternalReferenceMatcher(Node* node)
181 : ValueMatcher<ExternalReference, IrOpcode::kExternalConstant>(node) {}
192 explicit LoadMatcher(Node* node)
193 : NodeMatcher(node), object_(InputAt(0)), index_(InputAt(1)) {}
211 explicit BinopMatcher(Node* node)
212 : NodeMatcher(node), left_(InputAt(0)), right_(InputAt(1)) {
215 BinopMatcher(Node* node, bool allow_input_swap)
216 : NodeMatcher(node), left_(InputAt(0)), right_(InputAt(1)) {
227 bool LeftEqualsRight() const { return left().node() == right().node(); }
232 node()->ReplaceInput(0, left().node());
233 node()->ReplaceInput(1, right().node());
261 explicit ScaleMatcher(Node* node, bool allow_power_of_two_plus_one = false)
263 if (node->InputCount() < 2) return;
264 BinopMatcher m(node);
265 if (node->opcode() == kShiftOpcode) {
273 } else if (node->opcode() == kMulOpcode) {
322 AddMatcher(Node* node, bool allow_input_swap)
323 : BinopMatcher(node, allow_input_swap),
326 Initialize(node, allow_input_swap);
328 explicit AddMatcher(Node* node)
329 : BinopMatcher(node, node->op()->HasProperty(Operator::kCommutative)),
332 Initialize(node, node->op()->HasProperty(Operator::kCommutative));
336 Node* IndexInput() const {
338 return this->left().node()->InputAt(0);
347 void Initialize(Node* node, bool allow_input_swap) {
348 Matcher left_matcher(this->left().node(), true);
359 Matcher right_matcher(this->right().node(), true);
385 BaseWithIndexAndDisplacementMatcher(Node* node, bool allow_input_swap)
391 Initialize(node, allow_input_swap);
394 explicit BaseWithIndexAndDisplacementMatcher(Node* node)
400 Initialize(node, node->op()->HasProperty(Operator::kCommutative));
404 Node* index() const { return index_; }
406 Node* base() const { return base_; }
407 Node* displacement() const { return displacement_; }
411 Node* index_;
413 Node* base_;
414 Node* displacement_;
416 void Initialize(Node* node, bool allow_input_swap) {
419 // enumerating all possible patterns by brute force, checking for node
433 if (node->InputCount() < 2) return;
434 AddMatcher m(node, allow_input_swap);
435 Node* left = m.left().node();
436 Node* right = m.right().node();
437 Node* displacement = nullptr;
438 Node* base = nullptr;
439 Node* index = nullptr;
440 Node* scale_expression = nullptr;
443 if (m.HasIndexInput() && left->OwnedBy(node)) {
448 if (right->opcode() == AddMatcher::kOpcode && right->OwnedBy(node)) {
452 base = right_matcher.left().node();
453 displacement = right_matcher.right().node();
466 if (left->opcode() == AddMatcher::kOpcode && left->OwnedBy(node)) {
468 Node* left_left = left_matcher.left().node();
469 Node* left_right = left_matcher.right().node();
566 explicit BranchMatcher(Node* branch);
570 Node* Branch() const { return node(); }
571 Node* IfTrue() const { return if_true_; }
572 Node* IfFalse() const { return if_false_; }
575 Node* if_true_;
576 Node* if_false_;
581 explicit DiamondMatcher(Node* merge);
585 return if_true_->OwnedBy(node()) && if_false_->OwnedBy(node());
588 Node* Branch() const { return branch_; }
589 Node* IfTrue() const { return if_true_; }
590 Node* IfFalse() const { return if_false_; }
591 Node* Merge() const { return node(); }
593 Node* TrueInputOf(Node* phi) const {
600 Node* FalseInputOf(Node* phi) const {
608 Node* branch_;
609 Node* if_true_;
610 Node* if_false_;