blob: 4a1323b279491fb2423cab77a1ea49e5eabe8c9a [file] [log] [blame]
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001// Copyright 2014 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_COMPILER_LOAD_ELIMINATION_H_
6#define V8_COMPILER_LOAD_ELIMINATION_H_
7
8#include "src/compiler/graph-reducer.h"
9
10namespace v8 {
11namespace internal {
12namespace compiler {
13
Ben Murdochda12d292016-06-02 14:46:10 +010014class Graph;
Ben Murdochc5610432016-08-08 18:44:38 +010015class SimplifiedOperatorBuilder;
Ben Murdochda12d292016-06-02 14:46:10 +010016
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000017class LoadElimination final : public AdvancedReducer {
Emily Bernierd0a1eb72015-03-24 16:35:39 -040018 public:
Ben Murdochda12d292016-06-02 14:46:10 +010019 explicit LoadElimination(Editor* editor, Graph* graph,
Ben Murdochc5610432016-08-08 18:44:38 +010020 SimplifiedOperatorBuilder* simplified)
21 : AdvancedReducer(editor), graph_(graph), simplified_(simplified) {}
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000022 ~LoadElimination() final;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040023
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000024 Reduction Reduce(Node* node) final;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040025
26 private:
Ben Murdochc5610432016-08-08 18:44:38 +010027 SimplifiedOperatorBuilder* simplified() const { return simplified_; }
28 Graph* graph() const { return graph_; }
Ben Murdochda12d292016-06-02 14:46:10 +010029
Emily Bernierd0a1eb72015-03-24 16:35:39 -040030 Reduction ReduceLoadField(Node* node);
Ben Murdochc5610432016-08-08 18:44:38 +010031
32 Graph* const graph_;
33 SimplifiedOperatorBuilder* const simplified_;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040034};
35
36} // namespace compiler
37} // namespace internal
38} // namespace v8
39
40#endif // V8_COMPILER_LOAD_ELIMINATION_H_