Chromium Code Reviews| 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(); |
| 74 void ComputeSSAForInlining(intptr_t callers_max_virtual_register_number); | |
|
Kevin Millikin (Google)
2012/08/29 14:01:04
I'd call this something like 'next_virtual_registe
zerny-google
2012/08/30 07:31:40
Done.
| |
| 67 void ComputeUseLists(); | 75 void ComputeUseLists(); |
| 68 | 76 |
| 77 void InlineCall(BindInstr* caller_instr, | |
| 78 StaticCallComp* caller_comp, | |
| 79 FlowGraph* callee_graph); | |
| 80 | |
| 69 // TODO(zerny): Once the SSA is feature complete this should be removed. | 81 // TODO(zerny): Once the SSA is feature complete this should be removed. |
| 70 void Bailout(const char* reason) const; | 82 void Bailout(const char* reason) const; |
| 71 | 83 |
| 72 #ifdef DEBUG | 84 #ifdef DEBUG |
| 73 // Validation methods for debugging. | 85 // Validation methods for debugging. |
| 74 bool ResetUseLists(); | 86 bool ResetUseLists(); |
| 75 bool ValidateUseLists(); | 87 bool ValidateUseLists(); |
| 76 #endif // DEBUG | 88 #endif // DEBUG |
| 77 | 89 |
| 78 private: | 90 private: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 | 126 |
| 115 // Flow graph fields. | 127 // Flow graph fields. |
| 116 const ParsedFunction& parsed_function_; | 128 const ParsedFunction& parsed_function_; |
| 117 const intptr_t copied_parameter_count_; | 129 const intptr_t copied_parameter_count_; |
| 118 const intptr_t non_copied_parameter_count_; | 130 const intptr_t non_copied_parameter_count_; |
| 119 const intptr_t stack_local_count_; | 131 const intptr_t stack_local_count_; |
| 120 GraphEntryInstr* graph_entry_; | 132 GraphEntryInstr* graph_entry_; |
| 121 GrowableArray<BlockEntryInstr*> preorder_; | 133 GrowableArray<BlockEntryInstr*> preorder_; |
| 122 GrowableArray<BlockEntryInstr*> postorder_; | 134 GrowableArray<BlockEntryInstr*> postorder_; |
| 123 GrowableArray<BlockEntryInstr*> reverse_postorder_; | 135 GrowableArray<BlockEntryInstr*> reverse_postorder_; |
| 136 ZoneGrowableArray<ReturnInstr*>* exits_; | |
| 124 }; | 137 }; |
| 125 | 138 |
| 126 } // namespace dart | 139 } // namespace dart |
| 127 | 140 |
| 128 #endif // VM_FLOW_GRAPH_H_ | 141 #endif // VM_FLOW_GRAPH_H_ |
| OLD | NEW |