Lines Matching defs:node

13 #include "src/compiler/node-matchers.h"
14 #include "src/compiler/node-properties.h"
15 #include "src/compiler/node.h"
39 Reduction CommonOperatorReducer::Reduce(Node* node) {
41 switch (node->opcode()) {
43 return ReduceBranch(node);
46 return ReduceDeoptimizeConditional(node);
48 return ReduceMerge(node);
50 return ReduceEffectPhi(node);
52 return ReducePhi(node);
54 return ReduceReturn(node);
56 return ReduceSelect(node);
58 return ReduceSwitch(node);
60 return ReduceStaticAssert(node);
63 return ReduceTrapConditional(node);
92 Reduction CommonOperatorReducer::ReduceBranch(Node* node) {
93 DCHECK_EQ(IrOpcode::kBranch, node->opcode());
94 Node* const cond = node->InputAt(0);
104 for (Node* const use : node->uses()) {
119 node->ReplaceInput(0, cond->InputAt(0));
122 node, common()->Branch(NegateBranchHint(BranchHintOf(node->op()))));
123 return Changed(node);
127 Node* const control = node->InputAt(1);
128 for (Node* const use : node->uses()) {
143 Reduction CommonOperatorReducer::ReduceDeoptimizeConditional(Node* node) {
144 DCHECK(node->opcode() == IrOpcode::kDeoptimizeIf ||
145 node->opcode() == IrOpcode::kDeoptimizeUnless);
146 bool condition_is_true = node->opcode() == IrOpcode::kDeoptimizeUnless;
147 DeoptimizeParameters p = DeoptimizeParametersOf(node->op());
148 Node* condition = NodeProperties::GetValueInput(node, 0);
149 Node* frame_state = NodeProperties::GetValueInput(node, 1);
150 Node* effect = NodeProperties::GetEffectInput(node);
151 Node* control = NodeProperties::GetControlInput(node);
152 // Swap DeoptimizeIf/DeoptimizeUnless on {node} if {cond} is a BooleaNot
153 // and use the input to BooleanNot as new condition for {node}. Note we
157 NodeProperties::ReplaceValueInput(node, condition->InputAt(0), 0);
159 node, condition_is_true
162 return Changed(node);
167 ReplaceWithValue(node, dead(), effect, control);
178 Reduction CommonOperatorReducer::ReduceMerge(Node* node) {
179 DCHECK_EQ(IrOpcode::kMerge, node->opcode());
189 if (node->InputCount() == 2) {
190 for (Node* const use : node->uses()) {
193 Node* if_true = node->InputAt(0);
194 Node* if_false = node->InputAt(1);
198 if_true->InputAt(0) == if_false->InputAt(0) && if_true->OwnedBy(node) &&
199 if_false->OwnedBy(node)) {
214 Reduction CommonOperatorReducer::ReduceEffectPhi(Node* node) {
215 DCHECK_EQ(IrOpcode::kEffectPhi, node->opcode());
216 Node::Inputs inputs = node->inputs();
223 DCHECK_NE(node, effect);
226 if (input == node) {
233 // We might now be able to further reduce the {merge} node.
239 Reduction CommonOperatorReducer::ReducePhi(Node* node) {
240 DCHECK_EQ(IrOpcode::kPhi, node->opcode());
241 Node::Inputs inputs = node->inputs();
270 // We might now be able to further reduce the {merge} node.
272 return Change(node, machine()->Float32Abs(), vtrue);
281 // We might now be able to further reduce the {merge} node.
283 return Change(node, machine()->Float64Abs(), vtrue);
290 DCHECK_NE(node, value);
293 if (input == node) {
300 // We might now be able to further reduce the {merge} node.
305 Reduction CommonOperatorReducer::ReduceReturn(Node* node) {
306 DCHECK_EQ(IrOpcode::kReturn, node->opcode());
307 Node* effect = NodeProperties::GetEffectInput(node);
309 // Any {Return} node can never be used to insert a deoptimization point,
312 NodeProperties::ReplaceEffectInput(node, effect);
313 return Changed(node).FollowedBy(ReduceReturn(node));
316 if (ValueInputCountOfReturn(node->op()) != 1) {
319 Node* pop_count = NodeProperties::GetValueInput(node, 0);
320 Node* value = NodeProperties::GetValueInput(node, 1);
321 Node* control = NodeProperties::GetControlInput(node);
344 // Now the effect input to the {Return} node can be either an {EffectPhi}
355 if (control->OwnedBy(node, value) && value->OwnedBy(node)) {
358 // {end} as revisit, because we mark {node} as {Dead} below, which was
361 Node* ret = graph()->NewNode(node->op(), pop_count, value_inputs[i],
365 // Mark the Merge {control} and Return {node} as {dead}.
374 // {end} as revisit, because we mark {node} as {Dead} below, which was
377 Node* ret = graph()->NewNode(node->op(), pop_count, value_inputs[i],
381 // Mark the Merge {control} and Return {node} as {dead}.
389 Reduction CommonOperatorReducer::ReduceSelect(Node* node) {
390 DCHECK_EQ(IrOpcode::kSelect, node->opcode());
391 Node* const cond = node->InputAt(0);
392 Node* const vtrue = node->InputAt(1);
393 Node* const vfalse = node->InputAt(2);
410 return Change(node, machine()->Float32Abs(), vtrue);
421 return Change(node, machine()->Float64Abs(), vtrue);
432 Reduction CommonOperatorReducer::ReduceSwitch(Node* node) {
433 DCHECK_EQ(IrOpcode::kSwitch, node->opcode());
434 Node* const switched_value = node->InputAt(0);
435 Node* const control = node->InputAt(1);
445 size_t const projection_count = node->op()->ControlOutputCount();
447 NodeProperties::CollectControlProjections(node, projections,
469 Reduction CommonOperatorReducer::ReduceStaticAssert(Node* node) {
470 DCHECK_EQ(IrOpcode::kStaticAssert, node->opcode());
471 Node* const cond = node->InputAt(0);
474 RelaxEffectsAndControls(node);
475 return Changed(node);
505 Reduction CommonOperatorReducer::Change(Node* node, Operator const* op,
507 node->ReplaceInput(0, a);
508 node->TrimInputCount(1);
509 NodeProperties::ChangeOp(node, op);
510 return Changed(node);
514 Reduction CommonOperatorReducer::Change(Node* node, Operator const* op, Node* a,
516 node->ReplaceInput(0, a);
517 node->ReplaceInput(1, b);
518 node->TrimInputCount(2);
519 NodeProperties::ChangeOp(node, op);
520 return Changed(node);