Index: src/compiler/graph-reducer.h |
diff --git a/src/compiler/graph-reducer.h b/src/compiler/graph-reducer.h |
index 1c90b3018babceb2fe657307a9d3b341d35dd86f..aee2bca878f1b12b08ced8d2a4daf19898fe9f2b 100644 |
--- a/src/compiler/graph-reducer.h |
+++ b/src/compiler/graph-reducer.h |
@@ -74,6 +74,12 @@ class AdvancedReducer : public Reducer { |
virtual void Replace(Node* node, Node* replacement) = 0; |
// Revisit the {node} again later. |
virtual void Revisit(Node* node) = 0; |
+ // Replace value uses of {node} with {value} and effect uses of {node} with |
+ // {effect}. If {effect == NULL}, then use the effect input to {node}. All |
+ // control uses will be relaxed assuming {node} cannot throw. |
+ virtual void ReplaceWithValue(Node* node, Node* value, |
+ Node* effect = nullptr, |
+ Node* control = nullptr) = 0; |
}; |
explicit AdvancedReducer(Editor* editor) : editor_(editor) {} |
@@ -91,6 +97,11 @@ class AdvancedReducer : public Reducer { |
DCHECK_NOT_NULL(editor_); |
editor_->Revisit(node); |
} |
+ void ReplaceWithValue(Node* node, Node* value, Node* effect = nullptr, |
+ Node* control = nullptr) { |
+ DCHECK_NOT_NULL(editor_); |
+ editor_->ReplaceWithValue(node, value, effect, control); |
+ } |
private: |
Editor* const editor_; |
@@ -126,6 +137,13 @@ class GraphReducer final : public AdvancedReducer::Editor { |
// Replace {node} with {replacement}. |
void Replace(Node* node, Node* replacement) final; |
+ |
+ // Replace value uses of {node} with {value} and effect uses of {node} with |
+ // {effect}. If {effect == NULL}, then use the effect input to {node}. All |
+ // control uses will be relaxed assuming {node} cannot throw. |
+ void ReplaceWithValue(Node* node, Node* value, Node* effect = nullptr, |
+ Node* control = nullptr) final; |
+ |
// Replace all uses of {node} with {replacement} if the id of {replacement} is |
// less than or equal to {max_id}. Otherwise, replace all uses of {node} whose |
// id is less than or equal to {max_id} with the {replacement}. |