control-reducer.h 1.39 KB
Newer Older
1 2 3 4 5 6 7 8 9
// 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 {
10 11 12 13 14

// Forward declarations.
class Zone;


15 16
namespace compiler {

17
// Forward declarations.
18 19
class JSGraph;
class CommonOperatorBuilder;
20
class Node;
21 22 23 24

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

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

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

36 37 38
  // Testing interface.
  static Node* ReducePhiForTesting(JSGraph* graph,
                                   CommonOperatorBuilder* builder, Node* node);
39
  static Node* ReduceIfNodeForTesting(JSGraph* graph,
40 41
                                      CommonOperatorBuilder* builder,
                                      Node* node);
42 43 44 45 46 47
};
}
}
}  // namespace v8::internal::compiler

#endif  // V8_COMPILER_CONTROL_REDUCER_H_