OLD | NEW |
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_H_ | 5 #ifndef VM_FLOW_GRAPH_H_ |
6 #define VM_FLOW_GRAPH_H_ | 6 #define VM_FLOW_GRAPH_H_ |
7 | 7 |
8 #include "vm/growable_array.h" | 8 #include "vm/growable_array.h" |
9 #include "vm/parser.h" | 9 #include "vm/parser.h" |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 } | 53 } |
54 | 54 |
55 intptr_t max_virtual_register_number() const { | 55 intptr_t max_virtual_register_number() const { |
56 return current_ssa_temp_index(); | 56 return current_ssa_temp_index(); |
57 } | 57 } |
58 | 58 |
59 GraphEntryInstr* graph_entry() const { | 59 GraphEntryInstr* graph_entry() const { |
60 return graph_entry_; | 60 return graph_entry_; |
61 } | 61 } |
62 | 62 |
| 63 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } |
| 64 |
63 // Operations on the flow graph. | 65 // Operations on the flow graph. |
64 void ComputeSSA(); | 66 void ComputeSSA(); |
65 void ComputeUseLists(); | 67 void ComputeUseLists(); |
66 | 68 |
67 // TODO(zerny): Once the SSA is feature complete this should be removed. | 69 // TODO(zerny): Once the SSA is feature complete this should be removed. |
68 void Bailout(const char* reason) const; | 70 void Bailout(const char* reason) const; |
69 | 71 |
70 private: | 72 private: |
71 void DiscoverBlocks(); | 73 void DiscoverBlocks(); |
72 | 74 |
(...skipping 16 matching lines...) Expand all Loading... |
89 GrowableArray<PhiInstr*>* live_phis); | 91 GrowableArray<PhiInstr*>* live_phis); |
90 | 92 |
91 void InsertPhis( | 93 void InsertPhis( |
92 const GrowableArray<BlockEntryInstr*>& preorder, | 94 const GrowableArray<BlockEntryInstr*>& preorder, |
93 const GrowableArray<BitVector*>& assigned_vars, | 95 const GrowableArray<BitVector*>& assigned_vars, |
94 const GrowableArray<BitVector*>& dom_frontier); | 96 const GrowableArray<BitVector*>& dom_frontier); |
95 | 97 |
96 void MarkLivePhis(GrowableArray<PhiInstr*>* live_phis); | 98 void MarkLivePhis(GrowableArray<PhiInstr*>* live_phis); |
97 | 99 |
98 intptr_t current_ssa_temp_index() const { return current_ssa_temp_index_; } | 100 intptr_t current_ssa_temp_index() const { return current_ssa_temp_index_; } |
99 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } | |
100 | 101 |
101 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used | 102 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used |
102 // if/when computing SSA. | 103 // if/when computing SSA. |
103 GrowableArray<intptr_t> parent_; | 104 GrowableArray<intptr_t> parent_; |
104 GrowableArray<BitVector*> assigned_vars_; | 105 GrowableArray<BitVector*> assigned_vars_; |
105 | 106 |
106 intptr_t current_ssa_temp_index_; | 107 intptr_t current_ssa_temp_index_; |
107 | 108 |
108 // Flow graph fields. | 109 // Flow graph fields. |
109 const ParsedFunction& parsed_function_; | 110 const ParsedFunction& parsed_function_; |
110 const intptr_t copied_parameter_count_; | 111 const intptr_t copied_parameter_count_; |
111 const intptr_t non_copied_parameter_count_; | 112 const intptr_t non_copied_parameter_count_; |
112 const intptr_t stack_local_count_; | 113 const intptr_t stack_local_count_; |
113 GraphEntryInstr* graph_entry_; | 114 GraphEntryInstr* graph_entry_; |
114 GrowableArray<BlockEntryInstr*> preorder_; | 115 GrowableArray<BlockEntryInstr*> preorder_; |
115 GrowableArray<BlockEntryInstr*> postorder_; | 116 GrowableArray<BlockEntryInstr*> postorder_; |
116 GrowableArray<BlockEntryInstr*> reverse_postorder_; | 117 GrowableArray<BlockEntryInstr*> reverse_postorder_; |
117 }; | 118 }; |
118 | 119 |
119 } // namespace dart | 120 } // namespace dart |
120 | 121 |
121 #endif // VM_FLOW_GRAPH_H_ | 122 #endif // VM_FLOW_GRAPH_H_ |
OLD | NEW |