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

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

Issue 14021016: Track side-effect free paths in the graph to allow CSE and LICM for instructions that depend on som… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph.cc ('k') | runtime/vm/flow_graph_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
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_FLOW_GRAPH_OPTIMIZER_H_ 5 #ifndef VM_FLOW_GRAPH_OPTIMIZER_H_
6 #define VM_FLOW_GRAPH_OPTIMIZER_H_ 6 #define VM_FLOW_GRAPH_OPTIMIZER_H_
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 #include "vm/flow_graph.h" 9 #include "vm/flow_graph.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 class CSEInstructionMap;
13 template <typename T> class GrowableArray; 14 template <typename T> class GrowableArray;
14 template <typename T> class DirectChainedHashMap; 15 class ParsedFunction;
15 template <typename T> class PointerKeyValueTrait;
16 16
17 class FlowGraphOptimizer : public FlowGraphVisitor { 17 class FlowGraphOptimizer : public FlowGraphVisitor {
18 public: 18 public:
19 FlowGraphOptimizer(FlowGraph* flow_graph, 19 FlowGraphOptimizer(FlowGraph* flow_graph,
20 GrowableArray<Field*>* guarded_fields) 20 GrowableArray<Field*>* guarded_fields)
21 : FlowGraphVisitor(flow_graph->reverse_postorder()), 21 : FlowGraphVisitor(flow_graph->reverse_postorder()),
22 flow_graph_(flow_graph), 22 flow_graph_(flow_graph),
23 guarded_fields_(guarded_fields) { } 23 guarded_fields_(guarded_fields) { }
24 virtual ~FlowGraphOptimizer() {} 24 virtual ~FlowGraphOptimizer() {}
25 25
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 void AddToGuardedFields(Field* field); 171 void AddToGuardedFields(Field* field);
172 172
173 FlowGraph* flow_graph_; 173 FlowGraph* flow_graph_;
174 GrowableArray<Field*>* guarded_fields_; 174 GrowableArray<Field*>* guarded_fields_;
175 175
176 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); 176 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer);
177 }; 177 };
178 178
179 179
180 class ParsedFunction;
181
182
183 // Loop invariant code motion. 180 // Loop invariant code motion.
184 class LICM : public ValueObject { 181 class LICM : public ValueObject {
185 public: 182 public:
186 explicit LICM(FlowGraph* flow_graph); 183 explicit LICM(FlowGraph* flow_graph);
187 184
188 void Optimize(); 185 void Optimize();
189 186
190 private: 187 private:
191 FlowGraph* flow_graph() const { return flow_graph_; } 188 FlowGraph* flow_graph() const { return flow_graph_; }
192 189
(...skipping 15 matching lines...) Expand all
208 class DominatorBasedCSE : public AllStatic { 205 class DominatorBasedCSE : public AllStatic {
209 public: 206 public:
210 // Return true, if the optimization changed the flow graph. 207 // Return true, if the optimization changed the flow graph.
211 // False, if nothing changed. 208 // False, if nothing changed.
212 static bool Optimize(FlowGraph* graph); 209 static bool Optimize(FlowGraph* graph);
213 210
214 private: 211 private:
215 static bool OptimizeRecursive( 212 static bool OptimizeRecursive(
216 FlowGraph* graph, 213 FlowGraph* graph,
217 BlockEntryInstr* entry, 214 BlockEntryInstr* entry,
218 DirectChainedHashMap<PointerKeyValueTrait<Instruction> >* map); 215 CSEInstructionMap* map);
219 }; 216 };
220 217
221 218
222 // Sparse conditional constant propagation and unreachable code elimination. 219 // Sparse conditional constant propagation and unreachable code elimination.
223 // Assumes that use lists are computed and preserves them. 220 // Assumes that use lists are computed and preserves them.
224 class ConstantPropagator : public FlowGraphVisitor { 221 class ConstantPropagator : public FlowGraphVisitor {
225 public: 222 public:
226 ConstantPropagator(FlowGraph* graph, 223 ConstantPropagator(FlowGraph* graph,
227 const GrowableArray<BlockEntryInstr*>& ignored); 224 const GrowableArray<BlockEntryInstr*>& ignored);
228 225
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 // platform. 315 // platform.
319 class IfConverter : public AllStatic { 316 class IfConverter : public AllStatic {
320 public: 317 public:
321 static void Simplify(FlowGraph* flow_graph); 318 static void Simplify(FlowGraph* flow_graph);
322 }; 319 };
323 320
324 321
325 } // namespace dart 322 } // namespace dart
326 323
327 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ 324 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698