| 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 1803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1814 // Printing support. | 1814 // Printing support. |
| 1815 virtual void PrintTo(BufferFormatter* f) const = 0; | 1815 virtual void PrintTo(BufferFormatter* f) const = 0; |
| 1816 virtual void PrintToVisualizer(BufferFormatter* f) const = 0; | 1816 virtual void PrintToVisualizer(BufferFormatter* f) const = 0; |
| 1817 | 1817 |
| 1818 #define INSTRUCTION_TYPE_CHECK(type) \ | 1818 #define INSTRUCTION_TYPE_CHECK(type) \ |
| 1819 virtual bool Is##type() const { return false; } \ | 1819 virtual bool Is##type() const { return false; } \ |
| 1820 virtual type##Instr* As##type() { return NULL; } | 1820 virtual type##Instr* As##type() { return NULL; } |
| 1821 FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK) | 1821 FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK) |
| 1822 #undef INSTRUCTION_TYPE_CHECK | 1822 #undef INSTRUCTION_TYPE_CHECK |
| 1823 | 1823 |
| 1824 // Static type of the instruction. | |
| 1825 virtual RawAbstractType* StaticType() const { | |
| 1826 UNREACHABLE(); | |
| 1827 return AbstractType::null(); | |
| 1828 } | |
| 1829 | |
| 1830 // Returns structure describing location constraints required | 1824 // Returns structure describing location constraints required |
| 1831 // to emit native code for this instruction. | 1825 // to emit native code for this instruction. |
| 1832 virtual LocationSummary* locs() { | 1826 virtual LocationSummary* locs() { |
| 1833 // TODO(vegorov): This should be pure virtual method. | 1827 // TODO(vegorov): This should be pure virtual method. |
| 1834 // However we are temporary using NULL for instructions that | 1828 // However we are temporary using NULL for instructions that |
| 1835 // were not converted to the location based code generation yet. | 1829 // were not converted to the location based code generation yet. |
| 1836 return NULL; | 1830 return NULL; |
| 1837 } | 1831 } |
| 1838 | 1832 |
| 1839 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 1833 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2151 intptr_t temp_index() const { return temp_index_; } | 2145 intptr_t temp_index() const { return temp_index_; } |
| 2152 void set_temp_index(intptr_t index) { temp_index_ = index; } | 2146 void set_temp_index(intptr_t index) { temp_index_ = index; } |
| 2153 | 2147 |
| 2154 intptr_t ssa_temp_index() const { return ssa_temp_index_; } | 2148 intptr_t ssa_temp_index() const { return ssa_temp_index_; } |
| 2155 void set_ssa_temp_index(intptr_t index) { | 2149 void set_ssa_temp_index(intptr_t index) { |
| 2156 ASSERT(index >= 0); | 2150 ASSERT(index >= 0); |
| 2157 ssa_temp_index_ = index; | 2151 ssa_temp_index_ = index; |
| 2158 } | 2152 } |
| 2159 bool HasSSATemp() const { return ssa_temp_index_ >= 0; } | 2153 bool HasSSATemp() const { return ssa_temp_index_ >= 0; } |
| 2160 | 2154 |
| 2155 // Static type of the definition. |
| 2156 virtual RawAbstractType* StaticType() const = 0; |
| 2157 |
| 2161 private: | 2158 private: |
| 2162 intptr_t temp_index_; | 2159 intptr_t temp_index_; |
| 2163 intptr_t ssa_temp_index_; | 2160 intptr_t ssa_temp_index_; |
| 2164 | 2161 |
| 2165 DISALLOW_COPY_AND_ASSIGN(Definition); | 2162 DISALLOW_COPY_AND_ASSIGN(Definition); |
| 2166 }; | 2163 }; |
| 2167 | 2164 |
| 2168 | 2165 |
| 2169 Definition* UseVal::definition() const { | 2166 Definition* UseVal::definition() const { |
| 2170 // Check that the definition is either a Phi or a linked in the the IR. | 2167 // Check that the definition is either a Phi or a linked in the the IR. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2211 | 2208 |
| 2212 | 2209 |
| 2213 class PhiInstr : public Definition { | 2210 class PhiInstr : public Definition { |
| 2214 public: | 2211 public: |
| 2215 explicit PhiInstr(intptr_t num_inputs) : inputs_(num_inputs) { | 2212 explicit PhiInstr(intptr_t num_inputs) : inputs_(num_inputs) { |
| 2216 for (intptr_t i = 0; i < num_inputs; ++i) { | 2213 for (intptr_t i = 0; i < num_inputs; ++i) { |
| 2217 inputs_.Add(NULL); | 2214 inputs_.Add(NULL); |
| 2218 } | 2215 } |
| 2219 } | 2216 } |
| 2220 | 2217 |
| 2218 // Least upper bound of the static types of the inputs. |
| 2219 virtual RawAbstractType* StaticType() const; |
| 2220 |
| 2221 DECLARE_INSTRUCTION(Phi) | 2221 DECLARE_INSTRUCTION(Phi) |
| 2222 | 2222 |
| 2223 private: | 2223 private: |
| 2224 GrowableArray<Value*> inputs_; | 2224 GrowableArray<Value*> inputs_; |
| 2225 | 2225 |
| 2226 DISALLOW_COPY_AND_ASSIGN(PhiInstr); | 2226 DISALLOW_COPY_AND_ASSIGN(PhiInstr); |
| 2227 }; | 2227 }; |
| 2228 | 2228 |
| 2229 | 2229 |
| 2230 class ParameterInstr : public Definition { | 2230 class ParameterInstr : public Definition { |
| 2231 public: | 2231 public: |
| 2232 explicit ParameterInstr(intptr_t index) : index_(index) { } | 2232 explicit ParameterInstr(intptr_t index) : index_(index) { } |
| 2233 | 2233 |
| 2234 intptr_t index() const { return index_; } | 2234 intptr_t index() const { return index_; } |
| 2235 | 2235 |
| 2236 // Static type of the passed-in parameter. |
| 2237 virtual RawAbstractType* StaticType() const; |
| 2238 |
| 2236 DECLARE_INSTRUCTION(Parameter) | 2239 DECLARE_INSTRUCTION(Parameter) |
| 2237 | 2240 |
| 2238 private: | 2241 private: |
| 2239 const intptr_t index_; | 2242 const intptr_t index_; |
| 2240 | 2243 |
| 2241 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); | 2244 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); |
| 2242 }; | 2245 }; |
| 2243 | 2246 |
| 2244 | 2247 |
| 2245 class PushArgumentInstr : public InstructionWithInputs { | 2248 class PushArgumentInstr : public InstructionWithInputs { |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2608 const GrowableArray<BlockEntryInstr*>& block_order_; | 2611 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 2609 | 2612 |
| 2610 private: | 2613 private: |
| 2611 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 2614 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 2612 }; | 2615 }; |
| 2613 | 2616 |
| 2614 | 2617 |
| 2615 } // namespace dart | 2618 } // namespace dart |
| 2616 | 2619 |
| 2617 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 2620 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |