Lines Matching refs:Node
8 #include "src/compiler/node-matchers.h"
9 #include "src/compiler/node-properties.h"
11 #include "src/compiler/node.h"
47 if (top.input_index == top.node->InputCount()) {
50 state_.Set(top.node, State::kVisited);
51 LowerNode(top.node);
54 Node* input = top.node->InputAt(top.input_index++);
56 SetLoweredType(input, top.node);
86 void SimdScalarLowering::SetLoweredType(Node* node, Node* output) {
87 switch (node->opcode()) {
93 replacements_[node->id()].type = SimdType::kInt32;
97 replacements_[node->id()].type = SimdType::kFloat32;
102 replacements_[node->id()].type = replacements_[output->id()].type;
140 void SimdScalarLowering::GetIndexNodes(Node* index, Node** new_indices) {
149 void SimdScalarLowering::LowerLoadOp(MachineRepresentation rep, Node* node,
152 Node* base = node->InputAt(0);
153 Node* index = node->InputAt(1);
154 Node* indices[kMaxLanes];
156 Node* rep_nodes[kMaxLanes];
157 rep_nodes[0] = node;
159 if (node->InputCount() > 2) {
160 DCHECK(node->InputCount() > 3);
161 Node* effect_input = node->InputAt(2);
162 Node* control_input = node->InputAt(3);
175 ReplaceNode(node, rep_nodes);
177 DefaultLowering(node);
181 void SimdScalarLowering::LowerStoreOp(MachineRepresentation rep, Node* node,
185 Node* base = node->InputAt(0);
186 Node* index = node->InputAt(1);
187 Node* indices[kMaxLanes];
189 DCHECK(node->InputCount() > 2);
190 Node* value = node->InputAt(2);
192 Node* rep_nodes[kMaxLanes];
193 rep_nodes[0] = node;
194 Node** rep_inputs = GetReplacementsWithType(value, rep_type);
196 NodeProperties::ChangeOp(node, store_op);
197 if (node->InputCount() > 3) {
198 DCHECK(node->InputCount() > 4);
199 Node* effect_input = node->InputAt(3);
200 Node* control_input = node->InputAt(4);
216 ReplaceNode(node, rep_nodes);
218 DefaultLowering(node);
222 void SimdScalarLowering::LowerBinaryOp(Node* node, SimdType rep_type,
224 DCHECK(node->InputCount() == 2);
225 Node** rep_left = GetReplacementsWithType(node->InputAt(0), rep_type);
226 Node** rep_right = GetReplacementsWithType(node->InputAt(1), rep_type);
227 Node* rep_node[kMaxLanes];
231 ReplaceNode(node, rep_node);
234 void SimdScalarLowering::LowerNode(Node* node) {
235 SimdType rep_type = ReplacementType(node);
236 switch (node->opcode()) {
239 // Only exchange the node if the parameter count actually changed.
243 int new_output_count = node->op()->ValueOutputCount() + delta;
244 NodeProperties::ChangeOp(node, common()->Start(new_output_count));
249 DCHECK(node->InputCount() == 1);
250 // Only exchange the node if the parameter count actually changed. We do
251 // not even have to do the default lowering because the the start node,
252 // the only input of a parameter node, only changes if the parameter count
256 int old_index = ParameterIndexOf(node->op());
259 NodeProperties::ChangeOp(node, common()->Parameter(new_index));
261 Node* new_node[kMaxLanes];
265 new_node[0] = node;
273 ReplaceNode(node, new_node);
280 LoadRepresentationOf(node->op()).representation();
287 LowerLoadOp(rep, node, load_op);
292 UnalignedLoadRepresentationOf(node->op()).representation();
299 LowerLoadOp(rep, node, load_op);
304 StoreRepresentationOf(node->op()).representation();
306 StoreRepresentationOf(node->op()).write_barrier_kind();
315 LowerStoreOp(rep, node, store_op, rep_type);
319 MachineRepresentation rep = UnalignedStoreRepresentationOf(node->op());
326 LowerStoreOp(rep, node, store_op, rep_type);
330 DefaultLowering(node);
333 NodeProperties::ChangeOp(node, common()->Return(new_return_count));
340 const_cast<CallDescriptor*>(CallDescriptorOf(node->op()));
341 if (DefaultLowering(node) ||
348 NodeProperties::ChangeOp(node, op);
353 Node* rep_node[kMaxLanes];
356 graph()->NewNode(common()->Projection(i), node, graph()->start());
358 ReplaceNode(node, rep_node);
363 MachineRepresentation rep = PhiRepresentationOf(node->op());
367 Node** rep_node = GetReplacements(node);
368 for (int i = 0; i < node->op()->ValueInputCount(); ++i) {
369 Node** rep_input =
370 GetReplacementsWithType(node->InputAt(i), rep_type);
376 DefaultLowering(node);
381 LowerBinaryOp(node, rep_type, machine()->Int32Add());
385 LowerBinaryOp(node, rep_type, machine()->Float32Add());
390 Node* rep_node[kMaxLanes];
392 if (HasReplacement(0, node->InputAt(i))) {
393 rep_node[i] = GetReplacements(node->InputAt(i))[0];
395 rep_node[i] = node->InputAt(i);
398 ReplaceNode(node, rep_node);
403 int32_t lane = OpParameter<int32_t>(node);
404 Node* rep_node[kMaxLanes] = {
405 GetReplacementsWithType(node->InputAt(0), rep_type)[lane], nullptr,
407 ReplaceNode(node, rep_node);
412 DCHECK_EQ(2, node->InputCount());
413 Node* repNode = node->InputAt(1);
414 int32_t lane = OpParameter<int32_t>(node);
416 Node** rep_node = GetReplacementsWithType(node->InputAt(0), rep_type);
422 ReplaceNode(node, rep_node);
425 default: { DefaultLowering(node); }
429 bool SimdScalarLowering::DefaultLowering(Node* node) {
431 for (int i = NodeProperties::PastValueIndex(node) - 1; i >= 0; i--) {
432 Node* input = node->InputAt(i);
435 node->ReplaceInput(i, GetReplacements(input)[0]);
440 node->InsertInput(zone(), i + j, GetReplacements(input)[j]);
447 Node* old, Node** new_node) {
453 replacements_[old->id()].node[i] = new_node[i];
457 bool SimdScalarLowering::HasReplacement(size_t index, Node* node) {
458 return replacements_[node->id()].node[index] != nullptr;
461 SimdScalarLowering::SimdType SimdScalarLowering::ReplacementType(Node* node) {
462 return replacements_[node->id()].type;
465 Node** SimdScalarLowering::GetReplacements(Node* node) {
466 Node** result = replacements_[node->id()].node;
471 Node** SimdScalarLowering::GetReplacementsWithType(Node* node, SimdType type) {
472 Node** replacements = GetReplacements(node);
473 if (ReplacementType(node) == type) {
474 return GetReplacements(node);
476 Node** result = zone()->NewArray<Node*>(kMaxLanes);
477 if (ReplacementType(node) == SimdType::kInt32 && type == SimdType::kFloat32) {
499 void SimdScalarLowering::PreparePhiReplacement(Node* phi) {
502 // We have to create the replacements for a phi node before we actually
504 // input nodes do not exist yet, so we use a placeholder node to pass the
508 Node** inputs_rep[kMaxLanes];
510 inputs_rep[i] = zone()->NewArray<Node*>(value_count + 1);
518 Node* rep_nodes[kMaxLanes];