diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-05-14 09:43:38 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2014-05-16 09:07:31 +0100 |
commit | 0d3f578909d0d1ea072ca68d78301b6fb7a44451 (patch) | |
tree | 5a90ec26839afa06294a46e67a4c4481982c47bf /compiler/optimizing/ssa_liveness_analysis.h | |
parent | c2ffcecb61e474f29f3c6a8721dfd00e0252b1f8 (diff) | |
download | art-0d3f578909d0d1ea072ca68d78301b6fb7a44451.zip art-0d3f578909d0d1ea072ca68d78301b6fb7a44451.tar.gz art-0d3f578909d0d1ea072ca68d78301b6fb7a44451.tar.bz2 |
Linearize the graph before creating live ranges.
Change-Id: I02eb5671e3304ab062286131745c1366448aff58
Diffstat (limited to 'compiler/optimizing/ssa_liveness_analysis.h')
-rw-r--r-- | compiler/optimizing/ssa_liveness_analysis.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/optimizing/ssa_liveness_analysis.h b/compiler/optimizing/ssa_liveness_analysis.h index 6a901d1..b8695ba 100644 --- a/compiler/optimizing/ssa_liveness_analysis.h +++ b/compiler/optimizing/ssa_liveness_analysis.h @@ -48,6 +48,7 @@ class SsaLivenessAnalysis : public ValueObject { public: explicit SsaLivenessAnalysis(const HGraph& graph) : graph_(graph), + linear_post_order_(graph.GetArena(), graph.GetBlocks().Size()), block_infos_(graph.GetArena(), graph.GetBlocks().Size()), number_of_ssa_values_(0) { block_infos_.SetSize(graph.GetBlocks().Size()); @@ -67,7 +68,17 @@ class SsaLivenessAnalysis : public ValueObject { return &block_infos_.Get(block.GetBlockId())->kill_; } + const GrowableArray<HBasicBlock*>& GetLinearPostOrder() const { + return linear_post_order_; + } + private: + // Linearize the graph so that: + // (1): a block is always after its dominator, + // (2): blocks of loops are contiguous. + // This creates a natural and efficient ordering when visualizing live ranges. + void LinearizeGraph(); + // Give an SSA number to each instruction that defines a value used by another instruction. void NumberInstructions(); @@ -90,6 +101,7 @@ class SsaLivenessAnalysis : public ValueObject { bool UpdateLiveOut(const HBasicBlock& block); const HGraph& graph_; + GrowableArray<HBasicBlock*> linear_post_order_; GrowableArray<BlockInfo*> block_infos_; size_t number_of_ssa_values_; |