Home | History | Annotate | Download | only in compiler

Lines Matching refs:node

9 #include "src/compiler/node-marker.h"
19 class Node;
23 // out-of-line data associated with each node.
27 // Represents the result of trying to reduce a node in the graph.
30 explicit Reduction(Node* replacement = nullptr) : replacement_(replacement) {}
32 Node* replacement() const { return replacement_; }
36 Node* replacement_;
40 // A reducer can reduce or simplify a given node based on its operator and
49 // Try to reduce a node if possible.
50 virtual Reduction Reduce(Node* node) = 0;
57 // Helper functions for subclasses to produce reductions for a node.
59 static Reduction Replace(Node* node) { return Reduction(node); }
60 static Reduction Changed(Node* node) { return Reduction(node); }
73 // Replace {node} with {replacement}.
74 virtual void Replace(Node* node, Node* replacement) = 0;
75 // Revisit the {node} again later.
76 virtual void Revisit(Node* node) = 0;
77 // Replace value uses of {node} with {value} and effect uses of {node} with
78 // {effect}. If {effect == nullptr}, then use the effect input to {node}.
79 // All control uses will be relaxed assuming {node} cannot throw.
80 virtual void ReplaceWithValue(Node* node, Node* value, Node* effect,
81 Node* control) = 0;
87 // Helper functions for subclasses to produce reductions for a node.
88 static Reduction Replace(Node* node) { return Reducer::Replace(node); }
91 void Replace(Node* node, Node* replacement) {
93 editor_->Replace(node, replacement);
95 void Revisit(Node* node) {
97 editor_->Revisit(node);
99 void ReplaceWithValue(Node* node, Node* value, Node* effect = nullptr,
100 Node* control = nullptr) {
102 editor_->ReplaceWithValue(node, value, effect, control);
105 // Relax the effects of {node} by immediately replacing effect and control
106 // uses of {node} with the effect and control input to {node}.
107 // TODO(turbofan): replace the effect input to {node} with {graph->start()}.
108 void RelaxEffectsAndControls(Node* node) {
109 ReplaceWithValue(node, node, nullptr, nullptr);
112 // Relax the control uses of {node} by immediately replacing them with the
113 // control input to {node}.
114 void RelaxControls(Node* node) {
115 ReplaceWithValue(node, node, node, nullptr);
123 // Performs an iterative reduction of a node graph.
127 GraphReducer(Zone* zone, Graph* graph, Node* dead = nullptr);
134 // Reduce a single node.
135 void ReduceNode(Node* const);
142 Node* node;
146 // Reduce a single node.
147 Reduction Reduce(Node* const);
148 // Reduce the node on top of the stack.
151 // Replace {node} with {replacement}.
152 void Replace(Node* node, Node* replacement) final;
154 // Replace value uses of {node} with {value} and effect uses of {node} with
155 // {effect}. If {effect == nullptr}, then use the effect input to {node}. All
156 // control uses will be relaxed assuming {node} cannot throw.
157 void ReplaceWithValue(Node* node, Node* value, Node* effect,
158 Node* control) final;
160 // Replace all uses of {node} with {replacement} if the id of {replacement} is
161 // less than or equal to {max_id}. Otherwise, replace all uses of {node} whose
163 void Replace(Node* node, Node* replacement, NodeId max_id);
165 // Node stack operations.
167 void Push(Node* node);
170 bool Recurse(Node* node);
171 void Revisit(Node* node) final;
174 Node* const dead_;
177 ZoneStack<Node*> revisit_;