Home | History | Annotate | Download | only in compiler

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}.
77 // All control uses will be relaxed assuming {node} cannot throw.
78 virtual void ReplaceWithValue(Node* node, Node* value, Node* effect,
79 Node* control) = 0;
85 // Helper functions for subclasses to produce reductions for a node.
86 static Reduction Replace(Node* node) { return Reducer::Replace(node); }
89 void Replace(Node* node, Node* replacement) {
91 editor_->Replace(node, replacement);
93 void Revisit(Node* node) {
95 editor_->Revisit(node);
97 void ReplaceWithValue(Node* node, Node* value, Node* effect = nullptr,
98 Node* control = nullptr) {
100 editor_->ReplaceWithValue(node, value, effect, control);
103 // Relax the effects of {node} by immediately replacing effect and control
104 // uses of {node} with the effect and control input to {node}.
105 // TODO(turbofan): replace the effect input to {node} with {graph->start()}.
106 void RelaxEffectsAndControls(Node* node) {
107 ReplaceWithValue(node, node, nullptr, nullptr);
110 // Relax the control uses of {node} by immediately replacing them with the
111 // control input to {node}.
112 void RelaxControls(Node* node) {
113 ReplaceWithValue(node, node, node, nullptr);
121 // Performs an iterative reduction of a node graph.
124 GraphReducer(Zone* zone, Graph* graph, Node* dead = nullptr);
131 // Reduce a single node.
132 void ReduceNode(Node* const);
139 Node* node;
143 // Reduce a single node.
144 Reduction Reduce(Node* const);
145 // Reduce the node on top of the stack.
148 // Replace {node} with {replacement}.
149 void Replace(Node* node, Node* replacement) final;
151 // Replace value uses of {node} with {value} and effect uses of {node} with
152 // {effect}. If {effect == nullptr}, then use the effect input to {node}. All
153 // control uses will be relaxed assuming {node} cannot throw.
154 void ReplaceWithValue(Node* node, Node* value, Node* effect,
155 Node* control) final;
157 // Replace all uses of {node} with {replacement} if the id of {replacement} is
158 // less than or equal to {max_id}. Otherwise, replace all uses of {node} whose
160 void Replace(Node* node, Node* replacement, NodeId max_id);
162 // Node stack operations.
164 void Push(Node* node);
167 bool Recurse(Node* node);
168 void Revisit(Node* node) final;
171 Node* const dead_;
174 ZoneStack<Node*> revisit_;