| 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_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ |
| 6 #define VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define VM_INTERMEDIATE_LANGUAGE_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 // Returns -1 if pred is not in the list. | 935 // Returns -1 if pred is not in the list. |
| 936 intptr_t IndexOfPredecessor(BlockEntryInstr* pred) const; | 936 intptr_t IndexOfPredecessor(BlockEntryInstr* pred) const; |
| 937 | 937 |
| 938 ZoneGrowableArray<PhiInstr*>* phis() const { return phis_; } | 938 ZoneGrowableArray<PhiInstr*>* phis() const { return phis_; } |
| 939 | 939 |
| 940 virtual void PrepareEntry(FlowGraphCompiler* compiler); | 940 virtual void PrepareEntry(FlowGraphCompiler* compiler); |
| 941 | 941 |
| 942 void InsertPhi(intptr_t var_index, intptr_t var_count); | 942 void InsertPhi(intptr_t var_index, intptr_t var_count); |
| 943 void RemoveDeadPhis(); | 943 void RemoveDeadPhis(); |
| 944 | 944 |
| 945 void InsertPhi(PhiInstr* phi); |
| 946 |
| 945 intptr_t phi_count() const { return phi_count_; } | 947 intptr_t phi_count() const { return phi_count_; } |
| 946 | 948 |
| 947 virtual void PrintTo(BufferFormatter* f) const; | 949 virtual void PrintTo(BufferFormatter* f) const; |
| 948 | 950 |
| 949 private: | 951 private: |
| 950 friend class FlowGraph; // Access to predecessors_ when inlining. | 952 friend class FlowGraph; // Access to predecessors_ when inlining. |
| 951 virtual void ClearPredecessors() { predecessors_.Clear(); } | 953 virtual void ClearPredecessors() { predecessors_.Clear(); } |
| 952 virtual void AddPredecessor(BlockEntryInstr* predecessor); | 954 virtual void AddPredecessor(BlockEntryInstr* predecessor); |
| 953 | 955 |
| 954 GrowableArray<BlockEntryInstr*> predecessors_; | 956 GrowableArray<BlockEntryInstr*> predecessors_; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 | 1134 |
| 1133 virtual void InferRange(); | 1135 virtual void InferRange(); |
| 1134 | 1136 |
| 1135 Range* range() const { return range_; } | 1137 Range* range() const { return range_; } |
| 1136 | 1138 |
| 1137 // Definitions can be canonicalized only into definitions to ensure | 1139 // Definitions can be canonicalized only into definitions to ensure |
| 1138 // this check statically we override base Canonicalize with a Canonicalize | 1140 // this check statically we override base Canonicalize with a Canonicalize |
| 1139 // returning Definition (return type is covariant). | 1141 // returning Definition (return type is covariant). |
| 1140 virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); | 1142 virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); |
| 1141 | 1143 |
| 1144 static const intptr_t kReplacementMarker = -2; |
| 1145 |
| 1146 Definition* Replacement() { |
| 1147 if (ssa_temp_index_ == kReplacementMarker) { |
| 1148 return reinterpret_cast<Definition*>(temp_index_); |
| 1149 } |
| 1150 return this; |
| 1151 } |
| 1152 |
| 1153 void SetReplacement(Definition* other) { |
| 1154 ASSERT(ssa_temp_index_ >= 0); |
| 1155 ASSERT(WasEliminated()); |
| 1156 ssa_temp_index_ = kReplacementMarker; |
| 1157 temp_index_ = reinterpret_cast<intptr_t>(other); |
| 1158 } |
| 1159 |
| 1142 protected: | 1160 protected: |
| 1143 friend class RangeAnalysis; | 1161 friend class RangeAnalysis; |
| 1144 | 1162 |
| 1145 Range* range_; | 1163 Range* range_; |
| 1146 | 1164 |
| 1147 private: | 1165 private: |
| 1148 intptr_t temp_index_; | 1166 intptr_t temp_index_; |
| 1149 intptr_t ssa_temp_index_; | 1167 intptr_t ssa_temp_index_; |
| 1150 // TODO(regis): GrowableArray<const AbstractType*> propagated_types_; | 1168 // TODO(regis): GrowableArray<const AbstractType*> propagated_types_; |
| 1151 // For now: | 1169 // For now: |
| (...skipping 3149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4301 ForwardInstructionIterator* current_iterator_; | 4319 ForwardInstructionIterator* current_iterator_; |
| 4302 | 4320 |
| 4303 private: | 4321 private: |
| 4304 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4322 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4305 }; | 4323 }; |
| 4306 | 4324 |
| 4307 | 4325 |
| 4308 } // namespace dart | 4326 } // namespace dart |
| 4309 | 4327 |
| 4310 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4328 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |