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; | 18 class ReturnInstr; |
| 19 class StaticCallInstr; |
21 | 20 |
22 // Class to incapsulate the construction and manipulation of the flow graph. | 21 // Class to incapsulate the construction and manipulation of the flow graph. |
23 class FlowGraph: public ZoneAllocated { | 22 class FlowGraph: public ZoneAllocated { |
24 public: | 23 public: |
25 FlowGraph(const FlowGraphBuilder& builder, GraphEntryInstr* graph_entry); | 24 FlowGraph(const FlowGraphBuilder& builder, GraphEntryInstr* graph_entry); |
26 | 25 |
27 // Function properties. | 26 // Function properties. |
28 const ParsedFunction& parsed_function() const { | 27 const ParsedFunction& parsed_function() const { |
29 return parsed_function_; | 28 return parsed_function_; |
30 } | 29 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 64 |
66 ZoneGrowableArray<ReturnInstr*>* exits() const { return exits_; } | 65 ZoneGrowableArray<ReturnInstr*>* exits() const { return exits_; } |
67 void set_exits(ZoneGrowableArray<ReturnInstr*>* exits) { exits_ = exits; } | 66 void set_exits(ZoneGrowableArray<ReturnInstr*>* exits) { exits_ = exits; } |
68 | 67 |
69 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } | 68 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } |
70 | 69 |
71 // Operations on the flow graph. | 70 // Operations on the flow graph. |
72 void ComputeSSA(intptr_t next_virtual_register_number = 0); | 71 void ComputeSSA(intptr_t next_virtual_register_number = 0); |
73 void ComputeUseLists(); | 72 void ComputeUseLists(); |
74 | 73 |
75 void InlineCall(BindInstr* caller_instr, | 74 void InlineCall(StaticCallInstr* call, FlowGraph* callee_graph); |
76 StaticCallComp* caller_comp, | |
77 FlowGraph* callee_graph); | |
78 | 75 |
79 // TODO(zerny): Once the SSA is feature complete this should be removed. | 76 // TODO(zerny): Once the SSA is feature complete this should be removed. |
80 void Bailout(const char* reason) const; | 77 void Bailout(const char* reason) const; |
81 | 78 |
82 #ifdef DEBUG | 79 #ifdef DEBUG |
83 // Validation methods for debugging. | 80 // Validation methods for debugging. |
84 bool ResetUseLists(); | 81 bool ResetUseLists(); |
85 bool ValidateUseLists(); | 82 bool ValidateUseLists(); |
86 #endif // DEBUG | 83 #endif // DEBUG |
87 | 84 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 GraphEntryInstr* graph_entry_; | 127 GraphEntryInstr* graph_entry_; |
131 GrowableArray<BlockEntryInstr*> preorder_; | 128 GrowableArray<BlockEntryInstr*> preorder_; |
132 GrowableArray<BlockEntryInstr*> postorder_; | 129 GrowableArray<BlockEntryInstr*> postorder_; |
133 GrowableArray<BlockEntryInstr*> reverse_postorder_; | 130 GrowableArray<BlockEntryInstr*> reverse_postorder_; |
134 ZoneGrowableArray<ReturnInstr*>* exits_; | 131 ZoneGrowableArray<ReturnInstr*>* exits_; |
135 }; | 132 }; |
136 | 133 |
137 } // namespace dart | 134 } // namespace dart |
138 | 135 |
139 #endif // VM_FLOW_GRAPH_H_ | 136 #endif // VM_FLOW_GRAPH_H_ |
OLD | NEW |