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

Unified Diff: runtime/vm/flow_graph_allocator.h

Issue 12638040: Compute local variable liveness before translation to SSA. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph.cc ('k') | runtime/vm/flow_graph_allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_allocator.h
diff --git a/runtime/vm/flow_graph_allocator.h b/runtime/vm/flow_graph_allocator.h
index 526db56a66fcd7343b14848fc9a3c6d31f73f185..239bae43bc7fa0cb94828d7488c50fa2d64321b0 100644
--- a/runtime/vm/flow_graph_allocator.h
+++ b/runtime/vm/flow_graph_allocator.h
@@ -5,6 +5,7 @@
#ifndef VM_FLOW_GRAPH_ALLOCATOR_H_
#define VM_FLOW_GRAPH_ALLOCATOR_H_
+#include "vm/flow_graph.h"
#include "vm/growable_array.h"
#include "vm/intermediate_language.h"
@@ -35,6 +36,21 @@ class ReachingDefs : public ValueObject {
};
+class SSALivenessAnalysis : public LivenessAnalysis {
+ public:
+ explicit SSALivenessAnalysis(const FlowGraph& flow_graph)
+ : LivenessAnalysis(flow_graph.max_virtual_register_number(),
+ flow_graph.postorder()),
+ graph_entry_(flow_graph.graph_entry()) { }
+
+ private:
+ // Compute initial values for live-out, kill and live-in sets.
+ virtual void ComputeInitialSets();
+
+ GraphEntryInstr* graph_entry_;
+};
+
+
class FlowGraphAllocator : public ValueObject {
public:
// Number of stack slots needed for a double spill slot.
@@ -44,9 +60,6 @@ class FlowGraphAllocator : public ValueObject {
void AllocateRegisters();
- // Build live-in and live-out sets for each block.
- void AnalyzeLiveness();
-
// Map a virtual register number to its live range.
LiveRange* GetLiveRange(intptr_t vreg);
@@ -56,27 +69,6 @@ class FlowGraphAllocator : public ValueObject {
// Eliminate unnecessary environments from the IL.
void EliminateEnvironments();
- // Compute initial values for live-out, kill and live-in sets.
- void ComputeInitialSets();
-
- // Update live-out set for the given block: live-out should contain
- // all values that are live-in for block's successors.
- // Returns true if live-out set was changed.
- bool UpdateLiveOut(const BlockEntryInstr& instr);
-
- // Update live-in set for the given block: live-in should contain
- // all values that are live-out from the block and are not defined
- // by this block.
- // Returns true if live-in set was changed.
- bool UpdateLiveIn(const BlockEntryInstr& instr);
-
- // Perform fix-point iteration updating live-out and live-in sets
- // for blocks until they stop changing.
- void ComputeLiveInAndLiveOutSets();
-
- // Print results of liveness analysis.
- void DumpLiveness();
-
// Visit blocks in the code generation order (reverse post order) and
// linearly assign consequent lifetime positions to every instruction.
// We assign position as follows:
@@ -249,19 +241,7 @@ class FlowGraphAllocator : public ValueObject {
// Mapping between lifetime positions and blocks containing them.
GrowableArray<BlockInfo*> block_info_;
- // Live-out sets for each block. They contain indices of SSA values
- // that are live out from this block: that is values that were either
- // defined in this block or live into it and that are used in some
- // successor block.
- GrowableArray<BitVector*> live_out_;
-
- // Kill sets for each block. They contain indices of SSA values that
- // are defined by this block.
- GrowableArray<BitVector*> kill_;
-
- // Live-in sets for each block. They contain indices of SSA values
- // that are used by this block or its successors.
- GrowableArray<BitVector*> live_in_;
+ SSALivenessAnalysis liveness_;
// Number of virtual registers. Currently equal to the number of
// SSA values.
« no previous file with comments | « runtime/vm/flow_graph.cc ('k') | runtime/vm/flow_graph_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698