Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Side by Side Diff: runtime/vm/branch_optimizer.h

Issue 1679833002: VM: Move branch optimizations into a separate file. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/branch_optimizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 #ifndef VM_BRANCH_OPTIMIZER_H_
6 #define VM_BRANCH_OPTIMIZER_H_
7
8 #include "vm/allocation.h"
9
10 namespace dart {
11
12 class FlowGraph;
13 class JoinEntryInstr;
14 class Zone;
15 class TargetEntryInstr;
16 class Value;
17 class BranchInstr;
18
19 // Rewrite branches to eliminate materialization of boolean values after
20 // inlining, and to expose other optimizations (e.g., constant folding of
21 // branches, unreachable code elimination).
22 class BranchSimplifier : public AllStatic {
23 public:
24 static void Simplify(FlowGraph* flow_graph);
25
26 // Replace a target entry instruction with a join entry instruction. Does
27 // not update the original target's predecessors to point to the new block
28 // and does not replace the target in already computed block order lists.
29 static JoinEntryInstr* ToJoinEntry(Zone* zone,
30 TargetEntryInstr* target);
31
32 private:
33 // Match an instance of the pattern to rewrite. See the implementation
34 // for the patterns that are handled by this pass.
35 static bool Match(JoinEntryInstr* block);
36
37 // Duplicate a branch while replacing its comparison's left and right
38 // inputs.
39 static BranchInstr* CloneBranch(Zone* zone,
40 BranchInstr* branch,
41 Value* new_left,
42 Value* new_right);
43 };
44
45
46 // Rewrite diamond control flow patterns that materialize values to use more
47 // efficient branchless code patterns if such are supported on the current
48 // platform.
49 class IfConverter : public AllStatic {
50 public:
51 static void Simplify(FlowGraph* flow_graph);
52 };
53
54 } // namespace dart
55
56 #endif // VM_BRANCH_OPTIMIZER_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/branch_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698