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