| 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 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1806 // Printing support. | 1806 // Printing support. |
| 1807 virtual void PrintTo(BufferFormatter* f) const = 0; | 1807 virtual void PrintTo(BufferFormatter* f) const = 0; |
| 1808 virtual void PrintToVisualizer(BufferFormatter* f) const = 0; | 1808 virtual void PrintToVisualizer(BufferFormatter* f) const = 0; |
| 1809 | 1809 |
| 1810 #define INSTRUCTION_TYPE_CHECK(type) \ | 1810 #define INSTRUCTION_TYPE_CHECK(type) \ |
| 1811 virtual bool Is##type() const { return false; } \ | 1811 virtual bool Is##type() const { return false; } \ |
| 1812 virtual type##Instr* As##type() { return NULL; } | 1812 virtual type##Instr* As##type() { return NULL; } |
| 1813 FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK) | 1813 FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK) |
| 1814 #undef INSTRUCTION_TYPE_CHECK | 1814 #undef INSTRUCTION_TYPE_CHECK |
| 1815 | 1815 |
| 1816 // Static type of the instruction. | |
| 1817 virtual RawAbstractType* StaticType() const { | |
| 1818 UNREACHABLE(); | |
| 1819 return AbstractType::null(); | |
| 1820 } | |
| 1821 | |
| 1822 // Returns structure describing location constraints required | 1816 // Returns structure describing location constraints required |
| 1823 // to emit native code for this instruction. | 1817 // to emit native code for this instruction. |
| 1824 virtual LocationSummary* locs() { | 1818 virtual LocationSummary* locs() { |
| 1825 // TODO(vegorov): This should be pure virtual method. | 1819 // TODO(vegorov): This should be pure virtual method. |
| 1826 // However we are temporary using NULL for instructions that | 1820 // However we are temporary using NULL for instructions that |
| 1827 // were not converted to the location based code generation yet. | 1821 // were not converted to the location based code generation yet. |
| 1828 return NULL; | 1822 return NULL; |
| 1829 } | 1823 } |
| 1830 | 1824 |
| 1831 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 1825 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2133 intptr_t temp_index() const { return temp_index_; } | 2127 intptr_t temp_index() const { return temp_index_; } |
| 2134 void set_temp_index(intptr_t index) { temp_index_ = index; } | 2128 void set_temp_index(intptr_t index) { temp_index_ = index; } |
| 2135 | 2129 |
| 2136 intptr_t ssa_temp_index() const { return ssa_temp_index_; } | 2130 intptr_t ssa_temp_index() const { return ssa_temp_index_; } |
| 2137 void set_ssa_temp_index(intptr_t index) { | 2131 void set_ssa_temp_index(intptr_t index) { |
| 2138 ASSERT(index >= 0); | 2132 ASSERT(index >= 0); |
| 2139 ssa_temp_index_ = index; | 2133 ssa_temp_index_ = index; |
| 2140 } | 2134 } |
| 2141 bool HasSSATemp() const { return ssa_temp_index_ >= 0; } | 2135 bool HasSSATemp() const { return ssa_temp_index_ >= 0; } |
| 2142 | 2136 |
| 2137 // Static type of the definition. |
| 2138 virtual RawAbstractType* StaticType() const = 0; |
| 2139 |
| 2143 private: | 2140 private: |
| 2144 intptr_t temp_index_; | 2141 intptr_t temp_index_; |
| 2145 intptr_t ssa_temp_index_; | 2142 intptr_t ssa_temp_index_; |
| 2146 | 2143 |
| 2147 DISALLOW_COPY_AND_ASSIGN(Definition); | 2144 DISALLOW_COPY_AND_ASSIGN(Definition); |
| 2148 }; | 2145 }; |
| 2149 | 2146 |
| 2150 | 2147 |
| 2151 Definition* UseVal::definition() const { | 2148 Definition* UseVal::definition() const { |
| 2152 // Check that the definition is either a Phi or a linked in the the IR. | 2149 // Check that the definition is either a Phi or a linked in the the IR. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2192 | 2189 |
| 2193 | 2190 |
| 2194 class PhiInstr : public Definition { | 2191 class PhiInstr : public Definition { |
| 2195 public: | 2192 public: |
| 2196 explicit PhiInstr(intptr_t num_inputs) : inputs_(num_inputs) { | 2193 explicit PhiInstr(intptr_t num_inputs) : inputs_(num_inputs) { |
| 2197 for (intptr_t i = 0; i < num_inputs; ++i) { | 2194 for (intptr_t i = 0; i < num_inputs; ++i) { |
| 2198 inputs_.Add(NULL); | 2195 inputs_.Add(NULL); |
| 2199 } | 2196 } |
| 2200 } | 2197 } |
| 2201 | 2198 |
| 2199 // Least upper bound of the static types of the inputs. |
| 2200 virtual RawAbstractType* StaticType() const; |
| 2201 |
| 2202 DECLARE_INSTRUCTION(Phi) | 2202 DECLARE_INSTRUCTION(Phi) |
| 2203 | 2203 |
| 2204 private: | 2204 private: |
| 2205 GrowableArray<Value*> inputs_; | 2205 GrowableArray<Value*> inputs_; |
| 2206 | 2206 |
| 2207 DISALLOW_COPY_AND_ASSIGN(PhiInstr); | 2207 DISALLOW_COPY_AND_ASSIGN(PhiInstr); |
| 2208 }; | 2208 }; |
| 2209 | 2209 |
| 2210 | 2210 |
| 2211 class ParameterInstr : public Definition { | 2211 class ParameterInstr : public Definition { |
| 2212 public: | 2212 public: |
| 2213 explicit ParameterInstr(intptr_t index) : index_(index) { } | 2213 explicit ParameterInstr(intptr_t index) : index_(index) { } |
| 2214 | 2214 |
| 2215 intptr_t index() const { return index_; } | 2215 intptr_t index() const { return index_; } |
| 2216 | 2216 |
| 2217 // Static type of the passed-in parameter. |
| 2218 virtual RawAbstractType* StaticType() const; |
| 2219 |
| 2217 DECLARE_INSTRUCTION(Parameter) | 2220 DECLARE_INSTRUCTION(Parameter) |
| 2218 | 2221 |
| 2219 private: | 2222 private: |
| 2220 const intptr_t index_; | 2223 const intptr_t index_; |
| 2221 | 2224 |
| 2222 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); | 2225 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); |
| 2223 }; | 2226 }; |
| 2224 | 2227 |
| 2225 | 2228 |
| 2226 class ReturnInstr : public InstructionWithInputs { | 2229 class ReturnInstr : public InstructionWithInputs { |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2560 const GrowableArray<BlockEntryInstr*>& block_order_; | 2563 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 2561 | 2564 |
| 2562 private: | 2565 private: |
| 2563 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 2566 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 2564 }; | 2567 }; |
| 2565 | 2568 |
| 2566 | 2569 |
| 2567 } // namespace dart | 2570 } // namespace dart |
| 2568 | 2571 |
| 2569 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 2572 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |