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

Unified Diff: runtime/vm/flow_graph_optimizer.h

Issue 820883004: Move ConstantPropagator from flow_graph_optimizer.cc/.h into separate files. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/constant_propagator.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.h
===================================================================
--- runtime/vm/flow_graph_optimizer.h (revision 42566)
+++ runtime/vm/flow_graph_optimizer.h (working copy)
@@ -316,83 +316,6 @@
};
-// Sparse conditional constant propagation and unreachable code elimination.
-// Assumes that use lists are computed and preserves them.
-class ConstantPropagator : public FlowGraphVisitor {
- public:
- ConstantPropagator(FlowGraph* graph,
- const GrowableArray<BlockEntryInstr*>& ignored);
-
- static void Optimize(FlowGraph* graph);
-
- // (1) Visit branches to optimize away unreachable blocks discovered by range
- // analysis.
- // (2) Eliminate branches that have the same true- and false-target: For
- // example, this occurs after expressions like
- //
- // if (a == null || b == null) {
- // ...
- // }
- //
- // where b is known to be null.
- static void OptimizeBranches(FlowGraph* graph);
-
- // Used to initialize the abstract value of definitions.
- static RawObject* Unknown() { return Object::unknown_constant().raw(); }
-
- private:
- void Analyze();
- void Transform();
- void EliminateRedundantBranches();
-
- void SetReachable(BlockEntryInstr* block);
- bool SetValue(Definition* definition, const Object& value);
-
- Definition* UnwrapPhi(Definition* defn);
- void MarkPhi(Definition* defn);
-
- // Assign the join (least upper bound) of a pair of abstract values to the
- // first one.
- void Join(Object* left, const Object& right);
-
- bool IsUnknown(const Object& value) {
- return value.raw() == unknown_.raw();
- }
- bool IsNonConstant(const Object& value) {
- return value.raw() == non_constant_.raw();
- }
- bool IsConstant(const Object& value) {
- return !IsNonConstant(value) && !IsUnknown(value);
- }
-
- void VisitBinaryIntegerOp(BinaryIntegerOpInstr* binary_op);
-
- virtual void VisitBlocks() { UNREACHABLE(); }
-
-#define DECLARE_VISIT(type) virtual void Visit##type(type##Instr* instr);
- FOR_EACH_INSTRUCTION(DECLARE_VISIT)
-#undef DECLARE_VISIT
-
- Isolate* isolate() const { return graph_->isolate(); }
-
- FlowGraph* graph_;
-
- // Sentinels for unknown constant and non-constant values.
- const Object& unknown_;
- const Object& non_constant_;
-
- // Analysis results. For each block, a reachability bit. Indexed by
- // preorder number.
- BitVector* reachable_;
-
- BitVector* marked_phis_;
-
- // Worklists of blocks and definitions.
- GrowableArray<BlockEntryInstr*> block_worklist_;
- DefinitionWorklist definition_worklist_;
-};
-
-
// Rewrite branches to eliminate materialization of boolean values after
// inlining, and to expose other optimizations (e.g., constant folding of
// branches, unreachable code elimination).
« no previous file with comments | « runtime/vm/constant_propagator.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698