summaryrefslogtreecommitdiff
path: root/chromium/v8/src/compiler/control-reducer.h
blob: 06fb9e5df450625bb4b80b601e3eb889ec8750f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_COMPILER_CONTROL_REDUCER_H_
#define V8_COMPILER_CONTROL_REDUCER_H_

namespace v8 {
namespace internal {

// Forward declarations.
class Zone;


namespace compiler {

// Forward declarations.
class JSGraph;
class CommonOperatorBuilder;
class Node;

class ControlReducer {
 public:
  // Perform branch folding and dead code elimination on the graph.
  static void ReduceGraph(Zone* zone, JSGraph* graph,
                          int max_phis_for_select = 0);

  // Trim nodes in the graph that are not reachable from end.
  static void TrimGraph(Zone* zone, JSGraph* graph);

  // Reduces a single merge node and attached phis.
  static Node* ReduceMerge(JSGraph* graph, Node* node,
                           int max_phis_for_select = 0);

  // Testing interface.
  static Node* ReducePhiForTesting(JSGraph* graph, Node* node);
  static Node* ReduceIfNodeForTesting(JSGraph* graph, Node* node);
};
}
}
}  // namespace v8::internal::compiler

#endif  // V8_COMPILER_CONTROL_REDUCER_H_