Home | History | Annotate | Download | only in compiler

Lines Matching refs:node

11 #include "src/compiler/node-matchers.h"
12 #include "src/compiler/node-properties.h"
14 #include "src/compiler/node.h"
50 if (top.input_index == top.node->InputCount()) {
53 state_.Set(top.node, State::kVisited);
54 LowerNode(top.node);
57 Node* input = top.node->InputAt(top.input_index++);
103 void Int64Lowering::GetIndexNodes(Node* index, Node*& index_low,
104 Node*& index_high) {
124 void Int64Lowering::LowerNode(Node* node) {
125 switch (node->opcode()) {
127 int64_t value = OpParameter<int64_t>(node);
128 Node* low_node = graph()->NewNode(
130 Node* high_node = graph()->NewNode(
132 ReplaceNode(node, low_node, high_node);
136 LoadRepresentation load_rep = LoadRepresentationOf(node->op());
139 Node* base = node->InputAt(0);
140 Node* index = node->InputAt(1);
141 Node* index_low;
142 Node* index_high;
145 Node* high_node;
146 if (node->InputCount() > 2) {
147 Node* effect_high = node->InputAt(2);
148 Node* control_high = node->InputAt(3);
153 node->ReplaceInput(2, high_node);
157 node->ReplaceInput(1, index_low);
158 NodeProperties::ChangeOp(node, load_op);
159 ReplaceNode(node, node, high_node);
161 DefaultLowering(node);
166 StoreRepresentation store_rep = StoreRepresentationOf(node->op());
168 // We change the original store node to store the low word, and create
169 // a new store node to store the high word. The effect and control edges
170 // are copied from the original store to the new store node, the effect
174 Node* base = node->InputAt(0);
175 Node* index = node->InputAt(1);
176 Node* index_low;
177 Node* index_high;
179 Node* value = node->InputAt(2);
186 Node* high_node;
187 if (node->InputCount() > 3) {
188 Node* effect_high = node->InputAt(3);
189 Node* control_high = node->InputAt(4);
193 node->ReplaceInput(3, high_node);
200 node->ReplaceInput(1, index_low);
201 node->ReplaceInput(2, GetReplacementLow(value));
202 NodeProperties::ChangeOp(node, store_op);
203 ReplaceNode(node, node, high_node);
205 if (HasReplacementLow(node->InputAt(2))) {
206 node->ReplaceInput(2, GetReplacementLow(node->InputAt(2)));
213 // Only exchange the node if the parameter count actually changed.
217 int new_output_count = node->op()->ValueOutputCount() + delta;
218 NodeProperties::ChangeOp(node, common()->Start(new_output_count));
223 DCHECK(node->InputCount() == 1);
224 // Only exchange the node if the parameter count actually changed. We do
225 // not even have to do the default lowering because the the start node,
226 // the only input of a parameter node, only changes if the parameter count
230 int old_index = ParameterIndexOf(node->op());
232 NodeProperties::ChangeOp(node, common()->Parameter(new_index));
234 Node* high_node = nullptr;
240 ReplaceNode(node, node, high_node);
245 DefaultLowering(node);
248 NodeProperties::ChangeOp(node, common()->Return(new_return_count));
255 const_cast<CallDescriptor*>(CallDescriptorOf(node->op()));
256 if (DefaultLowering(node) ||
262 NodeProperties::ChangeOp(node, op);
267 Node* low_node =
268 graph()->NewNode(common()->Projection(0), node, graph()->start());
269 Node* high_node =
270 graph()->NewNode(common()->Projection(1), node, graph()->start());
271 ReplaceNode(node, low_node, high_node);
276 DCHECK(node->InputCount() == 2);
277 Node* left = node->InputAt(0);
278 Node* right = node->InputAt(1);
280 Node* low_node =
283 Node* high_node =
286 ReplaceNode(node, low_node, high_node);
290 DCHECK(node->InputCount() == 1);
291 Node* input = node->InputAt(0);
292 ReplaceNode(node, GetReplacementLow(input), nullptr);
293 node->NullAllInputs();
297 DCHECK(node->InputCount() == 2);
299 Node* right = node->InputAt(1);
300 node->ReplaceInput(1, GetReplacementLow(right));
301 node->AppendInput(zone(), GetReplacementHigh(right));
303 Node* left = node->InputAt(0);
304 node->ReplaceInput(0, GetReplacementLow(left));
305 node->InsertInput(zone(), 1, GetReplacementHigh(left));
307 NodeProperties::ChangeOp(node, machine()->Int32PairAdd());
309 Node* low_node =
310 graph()->NewNode(common()->Projection(0), node, graph()->start());
311 Node* high_node =
312 graph()->NewNode(common()->Projection(1), node, graph()->start());
313 ReplaceNode(node, low_node, high_node);
317 DCHECK(node->InputCount() == 2);
319 Node* right = node->InputAt(1);
320 node->ReplaceInput(1, GetReplacementLow(right));
321 node->AppendInput(zone(), GetReplacementHigh(right));
323 Node* left = node->InputAt(0);
324 node->ReplaceInput(0, GetReplacementLow(left));
325 node->InsertInput(zone(), 1, GetReplacementHigh(left));
327 NodeProperties::ChangeOp(node, machine()->Int32PairSub());
329 Node* low_node =
330 graph()->NewNode(common()->Projection(0), node, graph()->start());
331 Node* high_node =
332 graph()->NewNode(common()->Projection(1), node, graph()->start());
333 ReplaceNode(node, low_node, high_node);
337 DCHECK(node->InputCount() == 2);
339 Node* right = node->InputAt(1);
340 node->ReplaceInput(1, GetReplacementLow(right));
341 node->AppendInput(zone(), GetReplacementHigh(right));
343 Node* left = node->InputAt(0);
344 node->ReplaceInput(0, GetReplacementLow(left));
345 node->InsertInput(zone(), 1, GetReplacementHigh(left));
347 NodeProperties::ChangeOp(node, machine()->Int32PairMul());
349 Node* low_node =
350 graph()->NewNode(common()->Projection(0), node, graph()->start());
351 Node* high_node =
352 graph()->NewNode(common()->Projection(1), node, graph()->start());
353 ReplaceNode(node, low_node, high_node);
357 DCHECK(node->InputCount() == 2);
358 Node* left = node->InputAt(0);
359 Node* right = node->InputAt(1);
361 Node* low_node =
364 Node* high_node =
367 ReplaceNode(node, low_node, high_node);
371 DCHECK(node->InputCount() == 2);
372 Node* left = node->InputAt(0);
373 Node* right = node->InputAt(1);
375 Node* low_node =
378 Node* high_node =
381 ReplaceNode(node, low_node, high_node);
387 DCHECK(node->InputCount() == 2);
388 Node* shift = node->InputAt(1);
392 node->ReplaceInput(1, GetReplacementLow(shift));
395 Node* value = node->InputAt(0);
396 node->ReplaceInput(0, GetReplacementLow(value));
397 node->InsertInput(zone(), 1, GetReplacementHigh(value));
399 NodeProperties::ChangeOp(node, machine()->Word32PairShl());
401 Node* low_node =
402 graph()->NewNode(common()->Projection(0), node, graph()->start());
403 Node* high_node =
404 graph()->NewNode(common()->Projection(1), node, graph()->start());
405 ReplaceNode(node, low_node, high_node);
411 DCHECK(node->InputCount() == 2);
412 Node* shift = node->InputAt(1);
416 node->ReplaceInput(1, GetReplacementLow(shift));
419 Node* value = node->InputAt(0);
420 node->ReplaceInput(0, GetReplacementLow(value));
421 node->InsertInput(zone(), 1, GetReplacementHigh(value));
423 node, machine()->Word32PairShr());
425 Node* low_node =
426 graph()->NewNode(common()->Projection(0), node, graph()->start());
427 Node* high_node =
428 graph()->NewNode(common()->Projection(1), node, graph()->start());
429 ReplaceNode(node, low_node, high_node);
435 DCHECK(node->InputCount() == 2);
436 Node* shift = node->InputAt(1);
440 node->ReplaceInput(1, GetReplacementLow(shift));
443 Node* value = node->InputAt(0);
444 node->ReplaceInput(0, GetReplacementLow(value));
445 node->InsertInput(zone(), 1, GetReplacementHigh(value));
447 NodeProperties::ChangeOp(node, machine()->Word32PairSar());
449 Node* low_node =
450 graph()->NewNode(common()->Projection(0), node, graph()->start());
451 Node* high_node =
452 graph()->NewNode(common()->Projection(1), node, graph()->start());
453 ReplaceNode(node, low_node, high_node);
457 DCHECK(node->InputCount() == 2);
458 Node* left = node->InputAt(0);
459 Node* right = node->InputAt(1);
462 Node* replacement = graph()->NewNode(
472 ReplaceNode(node, replacement, nullptr);
476 LowerComparison(node, machine()->Int32LessThan(),
481 LowerComparison(node, machine()->Int32LessThan(),
486 LowerComparison(node, machine()->Uint32LessThan(),
491 LowerComparison(node, machine()->Uint32LessThan(),
496 DCHECK(node->InputCount() == 1);
497 Node* input = node->InputAt(0);
503 node, input,
506 node->NullAllInputs();
510 DCHECK(node->InputCount() == 1);
511 Node* input = node->InputAt(0);
515 ReplaceNode(node, input, graph()->NewNode(common()->Int32Constant(0)));
516 node->NullAllInputs();
520 DCHECK(node->InputCount() == 1);
521 Node* input = node->InputAt(0);
522 Node* stack_slot = graph()->NewNode(
525 Node* store_high_word = graph()->NewNode(
533 Node* store_low_word = graph()->NewNode(
541 Node* load =
546 ReplaceNode(node, load, nullptr);
550 DCHECK(node->InputCount() == 1);
551 Node* input = node->InputAt(0);
555 Node* stack_slot = graph()->NewNode(
557 Node* store = graph()->NewNode(
564 Node* high_node = graph()->NewNode(
569 Node* low_node = graph()->NewNode(
573 ReplaceNode(node, low_node, high_node);
577 DCHECK(node->InputCount() == 2);
578 Node* input = node->InputAt(0);
579 Node* shift = HasReplacementLow(node->InputAt(1))
580 ? GetReplacementLow(node->InputAt(1))
581 : node->InputAt(1);
587 ReplaceNode(node, GetReplacementLow(input),
590 ReplaceNode(node, GetReplacementHigh(input),
593 Node* low_input;
594 Node* high_input;
603 Node* masked_shift =
605 Node* inv_shift = graph()->NewNode(
608 Node* low_node = graph()->NewNode(
612 Node* high_node = graph()->NewNode(
616 ReplaceNode(node, low_node, high_node);
619 Node* safe_shift = shift;
628 Node* inv_mask = graph()->NewNode(
636 Node* bit_mask =
643 Node* masked_shift6 = shift;
658 Node* input_low =
661 Node* input_high =
665 Node* rotate_low =
667 Node* rotate_high =
670 Node* low_node = graph()->NewNode(
675 Node* high_node = graph()->NewNode(
680 ReplaceNode(node, low_node, high_node);
685 DCHECK(node->InputCount() == 1);
686 Node* input = node->InputAt(0);
692 Node* low_node = d.Phi(
699 ReplaceNode(node, low_node, graph()->NewNode(common()->Int32Constant(0)));
703 DCHECK(node->InputCount() == 1);
705 Node* input = node->InputAt(0);
710 Node* low_node =
718 ReplaceNode(node, low_node, graph()->NewNode(common()->Int32Constant(0)));
722 DCHECK(node->InputCount() == 1);
723 Node* input = node->InputAt(0);
724 // We assume that a Word64Popcnt node only has been created if
727 ReplaceNode(node, graph()->NewNode(
737 MachineRepresentation rep = PhiRepresentationOf(node->op());
741 Node* low_node = GetReplacementLow(node);
742 Node* high_node = GetReplacementHigh(node);
743 for (int i = 0; i < node->op()->ValueInputCount(); i++) {
744 low_node->ReplaceInput(i, GetReplacementLow(node->InputAt(i)));
745 high_node->ReplaceInput(i, GetReplacementHigh(node->InputAt(i)));
748 DefaultLowering(node);
753 default: { DefaultLowering(node); }
757 void Int64Lowering::LowerComparison(Node* node, const Operator* high_word_op,
759 DCHECK(node->InputCount() == 2);
760 Node* left = node->InputAt(0);
761 Node* right = node->InputAt(1);
762 Node* replacement = graph()->NewNode(
773 ReplaceNode(node, replacement, nullptr);
776 bool Int64Lowering::DefaultLowering(Node* node) {
778 for (int i = NodeProperties::PastValueIndex(node) - 1; i >= 0; i--) {
779 Node* input = node->InputAt(i);
782 node->ReplaceInput(i, GetReplacementLow(input));
786 node->InsertInput(zone(), i + 1, GetReplacementHigh(input));
792 void Int64Lowering::ReplaceNode(Node* old, Node* new_low, Node* new_high) {
799 bool Int64Lowering::HasReplacementLow(Node* node) {
800 return replacements_[node->id()].low != nullptr;
803 Node* Int64Lowering::GetReplacementLow(Node* node) {
804 Node* result = replacements_[node->id()].low;
809 bool Int64Lowering::HasReplacementHigh(Node* node) {
810 return replacements_[node->id()].high != nullptr;
813 Node* Int64Lowering::GetReplacementHigh(Node* node) {
814 Node* result = replacements_[node->id()].high;
819 void Int64Lowering::PreparePhiReplacement(Node* phi) {
822 node before we actually
824 // input nodes do not exist yet, so we use a placeholder node to pass the
827 Node** inputs_low = zone()->NewArray<Node*>(value_count + 1);
828 Node** inputs_high = zone()->NewArray<Node*>(value_count + 1);