Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1742 enum AliasIdentity { | 1742 enum AliasIdentity { |
| 1743 kIdentityUnknown, | 1743 kIdentityUnknown, |
| 1744 kIdentityAliased, | 1744 kIdentityAliased, |
| 1745 kIdentityNotAliased | 1745 kIdentityNotAliased |
| 1746 }; | 1746 }; |
| 1747 | 1747 |
| 1748 | 1748 |
| 1749 // Abstract super-class of all instructions that define a value (Bind, Phi). | 1749 // Abstract super-class of all instructions that define a value (Bind, Phi). |
| 1750 class Definition : public Instruction { | 1750 class Definition : public Instruction { |
| 1751 public: | 1751 public: |
| 1752 enum UseKind { kEffect, kValue }; | |
| 1753 | |
| 1754 Definition(); | 1752 Definition(); |
| 1755 | 1753 |
| 1756 virtual Definition* AsDefinition() { return this; } | 1754 virtual Definition* AsDefinition() { return this; } |
| 1757 | 1755 |
| 1758 bool IsComparison() { return (AsComparison() != NULL); } | 1756 bool IsComparison() { return (AsComparison() != NULL); } |
| 1759 virtual ComparisonInstr* AsComparison() { return NULL; } | 1757 virtual ComparisonInstr* AsComparison() { return NULL; } |
| 1760 | 1758 |
| 1761 // Overridden by definitions that push arguments. | 1759 // Overridden by definitions that push arguments. |
| 1762 virtual intptr_t ArgumentCount() const { return 0; } | 1760 virtual intptr_t ArgumentCount() const { return 0; } |
| 1763 | 1761 |
| 1764 // Overridden by definitions that have call counts. | 1762 // Overridden by definitions that have call counts. |
| 1765 virtual intptr_t CallCount() const { | 1763 virtual intptr_t CallCount() const { |
| 1766 UNREACHABLE(); | 1764 UNREACHABLE(); |
| 1767 return -1; | 1765 return -1; |
| 1768 } | 1766 } |
| 1769 | 1767 |
| 1770 intptr_t temp_index() const { return temp_index_; } | 1768 intptr_t temp_index() const { return temp_index_; } |
| 1771 void set_temp_index(intptr_t index) { temp_index_ = index; } | 1769 void set_temp_index(intptr_t index) { temp_index_ = index; } |
| 1772 void ClearTempIndex() { temp_index_ = -1; } | 1770 void ClearTempIndex() { temp_index_ = -1; } |
| 1771 bool HasTemp() const { return temp_index_ >= 0; } | |
| 1773 | 1772 |
| 1774 intptr_t ssa_temp_index() const { return ssa_temp_index_; } | 1773 intptr_t ssa_temp_index() const { return ssa_temp_index_; } |
| 1775 void set_ssa_temp_index(intptr_t index) { | 1774 void set_ssa_temp_index(intptr_t index) { |
| 1776 ASSERT(index >= 0); | 1775 ASSERT(index >= 0); |
| 1777 ASSERT(is_used()); | |
| 1778 ssa_temp_index_ = index; | 1776 ssa_temp_index_ = index; |
| 1779 } | 1777 } |
| 1780 bool HasSSATemp() const { return ssa_temp_index_ >= 0; } | 1778 bool HasSSATemp() const { return ssa_temp_index_ >= 0; } |
|
srdjan
2014/05/20 16:03:48
Do we want to make a comment somewhere that only d
Florian Schneider
2014/05/21 14:03:45
In SSA form, we have use lists to check where a de
| |
| 1781 void ClearSSATempIndex() { ssa_temp_index_ = -1; } | 1779 void ClearSSATempIndex() { ssa_temp_index_ = -1; } |
| 1782 bool HasPairRepresentation() const { | 1780 bool HasPairRepresentation() const { |
| 1783 return (representation() == kPairOfTagged) || | 1781 return (representation() == kPairOfTagged) || |
| 1784 (representation() == kPairOfUnboxedDouble); | 1782 (representation() == kPairOfUnboxedDouble); |
| 1785 } | 1783 } |
| 1786 bool is_used() const { return (use_kind_ != kEffect); } | |
| 1787 void set_use_kind(UseKind kind) { use_kind_ = kind; } | |
| 1788 | 1784 |
| 1789 // Compile time type of the definition, which may be requested before type | 1785 // Compile time type of the definition, which may be requested before type |
| 1790 // propagation during graph building. | 1786 // propagation during graph building. |
| 1791 CompileType* Type() { | 1787 CompileType* Type() { |
| 1792 if (type_ == NULL) { | 1788 if (type_ == NULL) { |
| 1793 type_ = ComputeInitialType(); | 1789 type_ = ComputeInitialType(); |
| 1794 } | 1790 } |
| 1795 return type_; | 1791 return type_; |
| 1796 } | 1792 } |
| 1797 | 1793 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1903 friend class Value; | 1899 friend class Value; |
| 1904 | 1900 |
| 1905 Range* range_; | 1901 Range* range_; |
| 1906 CompileType* type_; | 1902 CompileType* type_; |
| 1907 | 1903 |
| 1908 private: | 1904 private: |
| 1909 intptr_t temp_index_; | 1905 intptr_t temp_index_; |
| 1910 intptr_t ssa_temp_index_; | 1906 intptr_t ssa_temp_index_; |
| 1911 Value* input_use_list_; | 1907 Value* input_use_list_; |
| 1912 Value* env_use_list_; | 1908 Value* env_use_list_; |
| 1913 UseKind use_kind_; | |
| 1914 | 1909 |
| 1915 Object& constant_value_; | 1910 Object& constant_value_; |
| 1916 | 1911 |
| 1917 DISALLOW_COPY_AND_ASSIGN(Definition); | 1912 DISALLOW_COPY_AND_ASSIGN(Definition); |
| 1918 }; | 1913 }; |
| 1919 | 1914 |
| 1920 | 1915 |
| 1921 // Change a value's definition after use lists have been computed. | 1916 // Change a value's definition after use lists have been computed. |
| 1922 inline void Value::BindTo(Definition* def) { | 1917 inline void Value::BindTo(Definition* def) { |
| 1923 RemoveFromUseList(); | 1918 RemoveFromUseList(); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2065 BlockEntryInstr* block_; | 2060 BlockEntryInstr* block_; |
| 2066 | 2061 |
| 2067 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); | 2062 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); |
| 2068 }; | 2063 }; |
| 2069 | 2064 |
| 2070 | 2065 |
| 2071 class PushArgumentInstr : public Definition { | 2066 class PushArgumentInstr : public Definition { |
| 2072 public: | 2067 public: |
| 2073 explicit PushArgumentInstr(Value* value) { | 2068 explicit PushArgumentInstr(Value* value) { |
| 2074 SetInputAt(0, value); | 2069 SetInputAt(0, value); |
| 2075 set_use_kind(kEffect); // Override the default. | |
| 2076 } | 2070 } |
| 2077 | 2071 |
| 2078 DECLARE_INSTRUCTION(PushArgument) | 2072 DECLARE_INSTRUCTION(PushArgument) |
| 2079 | 2073 |
| 2080 intptr_t InputCount() const { return 1; } | 2074 intptr_t InputCount() const { return 1; } |
| 2081 Value* InputAt(intptr_t i) const { | 2075 Value* InputAt(intptr_t i) const { |
| 2082 ASSERT(i == 0); | 2076 ASSERT(i == 0); |
| 2083 return value_; | 2077 return value_; |
| 2084 } | 2078 } |
| 2085 | 2079 |
| (...skipping 5879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7965 ForwardInstructionIterator* current_iterator_; | 7959 ForwardInstructionIterator* current_iterator_; |
| 7966 | 7960 |
| 7967 private: | 7961 private: |
| 7968 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 7962 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 7969 }; | 7963 }; |
| 7970 | 7964 |
| 7971 | 7965 |
| 7972 } // namespace dart | 7966 } // namespace dart |
| 7973 | 7967 |
| 7974 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 7968 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |