blob: 92c6dd01ba20fbbd54a67b0d122f1ba04d6e3da1 [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 CommonOperatorBuilder;
15class Graph;
16
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,
20 CommonOperatorBuilder* common)
21 : AdvancedReducer(editor), graph_(graph), common_(common) {}
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 Murdochda12d292016-06-02 14:46:10 +010027 CommonOperatorBuilder* common() const { return common_; }
28 Graph* graph() { return graph_; }
29
Emily Bernierd0a1eb72015-03-24 16:35:39 -040030 Reduction ReduceLoadField(Node* node);
Ben Murdochda12d292016-06-02 14:46:10 +010031 Graph* graph_;
32 CommonOperatorBuilder* common_;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040033};
34
35} // namespace compiler
36} // namespace internal
37} // namespace v8
38
39#endif // V8_COMPILER_LOAD_ELIMINATION_H_