1// 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_SELECT_LOWERING_H_
6#define V8_COMPILER_SELECT_LOWERING_H_
7
8#include "src/compiler/graph-reducer.h"
9
10namespace v8 {
11namespace internal {
12namespace compiler {
13
14// Forward declarations.
15class JSGraphAssembler;
16
17// Lowers Select nodes to diamonds.
18class SelectLowering final : public Reducer {
19 public:
20  SelectLowering(JSGraphAssembler* graph_assembler, Graph* graph);
21  ~SelectLowering() override;
22
23  const char* reducer_name() const override { return "SelectLowering"; }
24
25  Reduction Reduce(Node* node) override;
26
27 private:
28  Reduction LowerSelect(Node* node);
29
30  JSGraphAssembler* gasm() const { return graph_assembler_; }
31  Node* start() const { return start_; }
32
33  JSGraphAssembler* graph_assembler_;
34  Node* start_;
35};
36
37}  // namespace compiler
38}  // namespace internal
39}  // namespace v8
40
41#endif  // V8_COMPILER_SELECT_LOWERING_H_
42