1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "src/compiler/node.h"
7 #include "src/compiler/generic-node-inl.h"
13 void Node::CollectProjections(int projection_count, Node** projections) {
14 for (int i = 0; i < projection_count; ++i) projections[i] = NULL;
15 for (UseIter i = uses().begin(); i != uses().end(); ++i) {
16 if ((*i)->opcode() != IrOpcode::kProjection) continue;
17 int32_t index = OpParameter<int32_t>(*i);
19 DCHECK_LT(index, projection_count);
20 DCHECK_EQ(NULL, projections[index]);
21 projections[index] = *i;
26 Node* Node::FindProjection(int32_t projection_index) {
27 for (UseIter i = uses().begin(); i != uses().end(); ++i) {
28 if ((*i)->opcode() == IrOpcode::kProjection &&
29 OpParameter<int32_t>(*i) == projection_index) {
37 OStream& operator<<(OStream& os, const Operator& op) { return op.PrintTo(os); }
40 OStream& operator<<(OStream& os, const Node& n) {
41 os << n.id() << ": " << *n.op();
42 if (n.op()->InputCount() != 0) {
44 for (int i = 0; i < n.op()->InputCount(); ++i) {
45 if (i != 0) os << ", ";
46 os << n.InputAt(i)->id();
53 } // namespace compiler
54 } // namespace internal