Lines Matching refs:node
10 #include "src/compiler/node.h"
24 // A facade that simplifies access to the different kinds of inputs to a node.
30 // 0 [ values, context, frame state, effects, control ] node->InputCount()
32 static int FirstValueIndex(const Node* node) { return 0; }
33 static int FirstContextIndex(Node* node) { return PastValueIndex(node); }
34 static int FirstFrameStateIndex(Node* node) { return PastContextIndex(node); }
35 static int FirstEffectIndex(Node* node) { return PastFrameStateIndex(node); }
36 static int FirstControlIndex(Node* node) { return PastEffectIndex(node); }
38 static int PastValueIndex(Node* node) {
39 return FirstValueIndex(node) + node->op()->ValueInputCount();
42 static int PastContextIndex(Node* node) {
43 return FirstContextIndex(node) +
44 OperatorProperties::GetContextInputCount(node->op());
47 static int PastFrameStateIndex(Node* node) {
48 return FirstFrameStateIndex(node) +
49 OperatorProperties::GetFrameStateInputCount(node->op());
52 static int PastEffectIndex(Node* node) {
53 return FirstEffectIndex(node) + node->op()->EffectInputCount();
56 static int PastControlIndex(Node* node) {
57 return FirstControlIndex(node) + node->op()->ControlInputCount();
63 static Node* GetValueInput(Node* node, int index) {
65 CHECK_LT(index, node->op()->ValueInputCount());
66 return node->InputAt(FirstValueIndex(node) + index);
69 static const Node* GetValueInput(const Node* node, int index) {
71 CHECK_LT(index, node->op()->ValueInputCount());
72 return node->InputAt(FirstValueIndex(node) + index);
75 static Node* GetContextInput(Node* node) {
76 CHECK(OperatorProperties::HasContextInput(node->op()));
77 return node->InputAt(FirstContextIndex(node));
80 static Node* GetFrameStateInput(Node* node) {
81 CHECK(OperatorProperties::HasFrameStateInput(node->op()));
82 return node->InputAt(FirstFrameStateIndex(node));
85 static Node* GetEffectInput(Node* node, int index = 0) {
87 CHECK_LT(index, node->op()->EffectInputCount());
88 return node->InputAt(FirstEffectIndex(node) + index);
91 static Node* GetControlInput(Node* node, int index = 0) {
93 CHECK_LT(index, node->op()->ControlInputCount());
94 return node->InputAt(FirstControlIndex(node) + index);
109 static bool IsCommon(Node* node) {
110 return IrOpcode::IsCommonOpcode(node->opcode());
112 static bool IsControl(Node* node) {
113 return IrOpcode::IsControlOpcode(node->opcode());
115 static bool IsConstant(Node* node) {
116 return IrOpcode::IsConstantOpcode(node->opcode());
118 static bool IsPhi(Node* node) {
119 return IrOpcode::IsPhiOpcode(node->opcode());
122 // Determines whether exceptions thrown by the given node are handled locally
125 static bool IsExceptionalCall(Node* node, Node** out_exception = nullptr);
127 // Returns the node producing the successful control output of {node}. This is
128 // the IfSuccess projection of {node} if present and {node} itself otherwise.
129 static Node* FindSuccessfulControlProjection(Node* node);
131 // Returns whether the node acts as the identity function on a value
133 static bool IsValueIdentity(Node* node, Node** out_value) {
134 switch (node->opcode()) {
136 *out_value = GetValueInput(node, 0);
139 *out_value = GetValueInput(node, 1);
146 // Determines if {node} has an allocating opcode, or is a builtin known to
148 static bool IsFreshObject(Node* node);
153 static void ReplaceValueInput(Node* node, Node* value, int index);
154 static void ReplaceContextInput(Node* node, Node* context);
155 static void ReplaceControlInput(Node* node, Node* control, int index = 0);
156 static void ReplaceEffectInput(Node* node, Node* effect, int index = 0);
157 static void ReplaceFrameStateInput(Node* node, Node* frame_state);
158 static void RemoveNonValueInputs(Node* node);
159 static void RemoveValueInputs(Node* node);
161 // Replaces all value inputs of {node} with the single input {value}.
162 static void ReplaceValueInputs(Node* node, Node* value);
164 // Merge the control node {node} into the end of the graph, introducing a
165 // merge node or expanding an existing merge node if necessary.
167 Node* node);
169 // Removes the control node {node} from the end of the graph, reducing the
170 // existing merge node's input count.
172 Node* node);
174 // Replace all uses of {node} with the given replacement nodes. All occurring
177 static void ReplaceUses(Node* node, Node* value, Node* effect = nullptr,
180 // Safe wrapper to mutate the operator of a node. Checks that the node is
182 static void ChangeOp(Node* node, const Operator* new_op);
187 // Find the last frame state that is effect-wise before the given node. This
188 // assumes a linear effect-chain up to a {CheckPoint} node in the graph.
189 // Returns {unreachable_sentinel} if {node} is determined to be unreachable.
190 static Node* FindFrameStateBefore(Node* node, Node* unreachable_sentinel);
193 static Node* FindProjection(Node* node, size_t projection_index);
195 // Collect the value projections from a node.
196 static void CollectValueProjections(Node* node, Node** proj, size_t count);
198 // Collect the branch-related projections from a node, such as IfTrue,
203 static void CollectControlProjections(Node* node, Node** proj, size_t count);
212 static size_t HashCode(Node* node);
250 // Walk up the context chain from the given {node} until we reduce the {depth}
251 // to 0 or hit a node that does not extend the context chain ({depth} will be
253 static Node* GetOuterContext(Node* node, size_t* depth);
258 static bool IsTyped(const Node* node) { return !node->type().IsInvalid(); }
259 static Type GetType(const Node* node) {
260 DCHECK(IsTyped(node));
261 return node->type();
263 static Type GetTypeOrAny(const Node* node);
264 static void SetType(Node* node, Type type) {
266 node->set_type(type);
268 static void RemoveType(Node* node) { node->set_type(Type::Invalid()); }
269 static bool AllValueInputsAreTyped(Node* node);