| 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 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 class BindInstr; |
| 13 class BlockEntryInstr; | 14 class BlockEntryInstr; |
| 15 class StaticCallComp; |
| 14 class Definition; | 16 class Definition; |
| 15 class FlowGraphBuilder; | 17 class FlowGraphBuilder; |
| 16 class GraphEntryInstr; | 18 class GraphEntryInstr; |
| 17 class PhiInstr; | 19 class PhiInstr; |
| 20 class ReturnInstr; |
| 21 class Value; |
| 18 | 22 |
| 19 // Class to incapsulate the construction and manipulation of the flow graph. | 23 // Class to incapsulate the construction and manipulation of the flow graph. |
| 20 class FlowGraph: public ZoneAllocated { | 24 class FlowGraph: public ZoneAllocated { |
| 21 public: | 25 public: |
| 22 FlowGraph(const FlowGraphBuilder& builder, GraphEntryInstr* graph_entry); | 26 FlowGraph(const FlowGraphBuilder& builder, GraphEntryInstr* graph_entry); |
| 23 | 27 |
| 24 // Function properties. | 28 // Function properties. |
| 25 const ParsedFunction& parsed_function() const { | 29 const ParsedFunction& parsed_function() const { |
| 26 return parsed_function_; | 30 return parsed_function_; |
| 27 } | 31 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 53 } | 57 } |
| 54 | 58 |
| 55 intptr_t max_virtual_register_number() const { | 59 intptr_t max_virtual_register_number() const { |
| 56 return current_ssa_temp_index(); | 60 return current_ssa_temp_index(); |
| 57 } | 61 } |
| 58 | 62 |
| 59 GraphEntryInstr* graph_entry() const { | 63 GraphEntryInstr* graph_entry() const { |
| 60 return graph_entry_; | 64 return graph_entry_; |
| 61 } | 65 } |
| 62 | 66 |
| 67 ZoneGrowableArray<ReturnInstr*>* exits() const { return exits_; } |
| 68 void set_exits(ZoneGrowableArray<ReturnInstr*>* exits) { exits_ = exits; } |
| 69 |
| 63 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } | 70 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } |
| 64 | 71 |
| 65 // Operations on the flow graph. | 72 // Operations on the flow graph. |
| 66 void ComputeSSA(); | 73 void ComputeSSA(intptr_t next_virtual_register_number = 0); |
| 67 void ComputeUseLists(); | 74 void ComputeUseLists(); |
| 68 | 75 |
| 76 void InlineCall(BindInstr* caller_instr, |
| 77 StaticCallComp* caller_comp, |
| 78 FlowGraph* callee_graph); |
| 79 |
| 69 // TODO(zerny): Once the SSA is feature complete this should be removed. | 80 // TODO(zerny): Once the SSA is feature complete this should be removed. |
| 70 void Bailout(const char* reason) const; | 81 void Bailout(const char* reason) const; |
| 71 | 82 |
| 72 #ifdef DEBUG | 83 #ifdef DEBUG |
| 73 // Validation methods for debugging. | 84 // Validation methods for debugging. |
| 74 bool ResetUseLists(); | 85 bool ResetUseLists(); |
| 75 bool ValidateUseLists(); | 86 bool ValidateUseLists(); |
| 76 #endif // DEBUG | 87 #endif // DEBUG |
| 77 | 88 |
| 78 private: | 89 private: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 125 |
| 115 // Flow graph fields. | 126 // Flow graph fields. |
| 116 const ParsedFunction& parsed_function_; | 127 const ParsedFunction& parsed_function_; |
| 117 const intptr_t copied_parameter_count_; | 128 const intptr_t copied_parameter_count_; |
| 118 const intptr_t non_copied_parameter_count_; | 129 const intptr_t non_copied_parameter_count_; |
| 119 const intptr_t stack_local_count_; | 130 const intptr_t stack_local_count_; |
| 120 GraphEntryInstr* graph_entry_; | 131 GraphEntryInstr* graph_entry_; |
| 121 GrowableArray<BlockEntryInstr*> preorder_; | 132 GrowableArray<BlockEntryInstr*> preorder_; |
| 122 GrowableArray<BlockEntryInstr*> postorder_; | 133 GrowableArray<BlockEntryInstr*> postorder_; |
| 123 GrowableArray<BlockEntryInstr*> reverse_postorder_; | 134 GrowableArray<BlockEntryInstr*> reverse_postorder_; |
| 135 ZoneGrowableArray<ReturnInstr*>* exits_; |
| 124 }; | 136 }; |
| 125 | 137 |
| 126 } // namespace dart | 138 } // namespace dart |
| 127 | 139 |
| 128 #endif // VM_FLOW_GRAPH_H_ | 140 #endif // VM_FLOW_GRAPH_H_ |
| OLD | NEW |