Lines Matching refs:node
8 #include "src/compiler/node-marker.h"
17 class Node;
21 // out-of-line data associated with each node.
25 // Represents the result of trying to reduce a node in the graph.
28 explicit Reduction(Node* replacement = nullptr) : replacement_(replacement) {}
30 Node* replacement() const { return replacement_; }
34 Node* replacement_;
38 // A reducer can reduce or simplify a given node based on its operator and
47 // Try to reduce a node if possible.
48 virtual Reduction Reduce(Node* node) = 0;
55 // Helper functions for subclasses to produce reductions for a node.
57 static Reduction Replace(Node* node) { return Reduction(node); }
58 static Reduction Changed(Node* node) { return Reduction(node); }
71 // Replace {node} with {replacement}.
72 virtual void Replace(Node* node, Node* replacement) = 0;
73 // Revisit the {node} again later.
74 virtual void Revisit(Node* node) = 0;
75 // Replace value uses of {node} with {value} and effect uses of {node} with
76 // {effect}. If {effect == nullptr}, then use the effect input to {node}.
78 // control uses will be relaxed assuming {node} cannot throw.
79 virtual void ReplaceWithValue(Node* node, Node* value, Node* effect,
80 Node* control) = 0;
86 // Helper functions for subclasses to produce reductions for a node.
87 static Reduction Replace(Node* node) { return Reducer::Replace(node); }
90 void Replace(Node* node, Node* replacement) {
92 editor_->Replace(node, replacement);
94 void Revisit(Node* node) {
96 editor_->Revisit(node);
98 void ReplaceWithValue(Node* node, Node* value, Node* effect = nullptr,
99 Node* control = nullptr) {
101 editor_->ReplaceWithValue(node, value, effect, control);
104 // Relax the effects of {node} by immediately replacing effect and control
105 // uses of {node} with the effect and control input to {node}.
106 // TODO(turbofan): replace the effect input to {node} with {graph->start()}.
107 void RelaxEffectsAndControls(Node* node) {
108 ReplaceWithValue(node, node, nullptr, nullptr);
111 // Relax the control uses of {node} by immediately replacing them with the
112 // control input to {node}.
113 void RelaxControls(Node* node) {
114 ReplaceWithValue(node, node, node, nullptr);
122 // Performs an iterative reduction of a node graph.
125 GraphReducer(Zone* zone, Graph* graph, Node* dead = nullptr);
132 // Reduce a single node.
133 void ReduceNode(Node* const);
140 Node* node;
144 // Reduce a single node.
145 Reduction Reduce(Node* const);
146 // Reduce the node on top of the stack.
149 // Replace {node} with {replacement}.
150 void Replace(Node* node, Node* replacement) final;
152 // Replace value uses of {node} with {value} and effect uses of {node} with
153 // {effect}. If {effect == nullptr}, then use the effect input to {node}. All
154 // control uses will be relaxed assuming {node} cannot throw.
155 void ReplaceWithValue(Node* node, Node* value, Node* effect,
156 Node* control) final;
158 // Replace all uses of {node} with {replacement} if the id of {replacement} is
159 // less than or equal to {max_id}. Otherwise, replace all uses of {node} whose
161 void Replace(Node* node, Node* replacement, NodeId max_id);
163 // Node stack operations.
165 void Push(Node* node);
168 bool Recurse(Node* node);
169 void Revisit(Node* node) final;
172 Node* const dead_;
175 ZoneStack<Node*> revisit_;