Lines Matching refs:Node
12 #include "src/compiler/node.h"
13 #include "src/compiler/node-matchers.h"
14 #include "src/compiler/node-properties.h"
24 Decision DecideCondition(Node* const cond) {
56 Reduction CommonOperatorReducer::Reduce(Node* node) {
57 switch (node->opcode()) {
59 return ReduceBranch(node);
61 return ReduceMerge(node);
63 return ReduceEffectPhi(node);
65 return ReducePhi(node);
67 return ReduceReturn(node);
69 return ReduceSelect(node);
71 return ReduceGuard(node);
79 Reduction CommonOperatorReducer::ReduceBranch(Node* node) {
80 DCHECK_EQ(IrOpcode::kBranch, node->opcode());
81 Node* const cond = node->InputAt(0);
87 for (Node* const use : node->uses()) {
102 node->ReplaceInput(0, cond->InputAt(0));
105 node, common()->Branch(NegateBranchHint(BranchHintOf(node->op()))));
106 return Changed(node);
110 Node* const control = node->InputAt(1);
111 for (Node* const use : node->uses()) {
127 Reduction CommonOperatorReducer::ReduceMerge(Node* node) {
128 DCHECK_EQ(IrOpcode::kMerge, node->opcode());
138 if (node->InputCount() == 2) {
139 for (Node* const use : node->uses()) {
142 Node* if_true = node->InputAt(0);
143 Node* if_false = node->InputAt(1);
147 if_true->InputAt(0) == if_false->InputAt(0) && if_true->OwnedBy(node) &&
148 if_false->OwnedBy(node)) {
149 Node* const branch = if_true->InputAt(0);
152 Node* const control = branch->InputAt(1);
163 Reduction CommonOperatorReducer::ReduceEffectPhi(Node* node) {
164 DCHECK_EQ(IrOpcode::kEffectPhi, node->opcode());
165 int const input_count = node->InputCount() - 1;
167 Node* const merge = node->InputAt(input_count);
170 Node* const effect = node->InputAt(0);
171 DCHECK_NE(node, effect);
173 Node* const input = node->InputAt(i);
174 if (input == node) {
181 // We might now be able to further reduce the {merge} node.
187 Reduction CommonOperatorReducer::ReducePhi(Node* node) {
188 DCHECK_EQ(IrOpcode::kPhi, node->opcode());
189 int const input_count = node->InputCount() - 1;
191 Node* const merge = node->InputAt(input_count);
195 Node* vtrue = node->InputAt(0);
196 Node* vfalse = node->InputAt(1);
197 Node* if_true = merge->InputAt(0);
198 Node* if_false = merge->InputAt(1);
206 Node* const branch = if_true->InputAt(0);
209 Node* const cond = branch->InputAt(0);
216 // We might now be able to further reduce the {merge} node.
218 return Change(node, machine()->Float32Abs(), vtrue);
223 // We might now be able to further reduce the {merge} node.
225 return Change(node, machine()->Float32Min().op(), vtrue, vfalse);
228 // We might now be able to further reduce the {merge} node.
230 return Change(node, machine()->Float32Max().op(), vtrue, vfalse);
238 // We might now be able to further reduce the {merge} node.
240 return Change(node, machine()->Float64Abs(), vtrue);
245 // We might now be able to further reduce the {merge} node.
247 return Change(node, machine()->Float64Min().op(), vtrue, vfalse);
250 // We might now be able to further reduce the {merge} node.
252 return Change(node, machine()->Float64Max().op(), vtrue, vfalse);
257 Node* const value = node->InputAt(0);
258 DCHECK_NE(node, value);
260 Node* const input = node->InputAt(i);
261 if (input == node) {
268 // We might now be able to further reduce the {merge} node.
274 Reduction CommonOperatorReducer::ReduceReturn(Node* node) {
275 DCHECK_EQ(IrOpcode::kReturn, node->opcode());
276 Node* const value = node->InputAt(0);
277 Node* const effect = node->InputAt(1);
278 Node* const control = node->InputAt(2);
292 // {end} as revisit, because we mark {node} as {Dead} below, which was
295 Node* ret = graph()->NewNode(common()->Return(), value->InputAt(i),
299 // Mark the merge {control} and return {node} as {dead}.
307 Reduction CommonOperatorReducer::ReduceSelect(Node* node) {
308 DCHECK_EQ(IrOpcode::kSelect, node->opcode());
309 Node* const cond = node->InputAt(0);
310 Node* const vtrue = node->InputAt(1);
311 Node* const vfalse = node->InputAt(2);
328 return Change(node, machine()->Float32Abs(), vtrue);
333 return Change(node, machine()->Float32Min().op(), vtrue, vfalse);
336 return Change(node, machine()->Float32Max().op(), vtrue, vfalse);
346 return Change(node, machine()->Float64Abs(), vtrue);
351 return Change(node, machine()->Float64Min().op(), vtrue, vfalse);
354 return Change(node, machine()->Float64Max().op(), vtrue, vfalse);
365 Reduction CommonOperatorReducer::ReduceGuard(Node* node) {
366 DCHECK_EQ(IrOpcode::kGuard, node->opcode());
367 Node* const input = NodeProperties::GetValueInput(node, 0);
369 Type* const guard_type = OpParameter<Type*>(node);
375 Reduction CommonOperatorReducer::Change(Node* node, Operator const* op,
376 Node* a) {
377 node->ReplaceInput(0, a);
378 node->TrimInputCount(1);
379 NodeProperties::ChangeOp(node, op);
380 return Changed(node);
384 Reduction CommonOperatorReducer::Change(Node* node, Operator const* op, Node* a,
385 Node* b) {
386 node->ReplaceInput(0, a);
387 node->ReplaceInput(1, b);
388 node->TrimInputCount(2);
389 NodeProperties::ChangeOp(node, op);
390 return Changed(node);