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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 V(_Float32x4, withX, Float32x4WithX, 795284225) \ | 120 V(_Float32x4, withX, Float32x4WithX, 795284225) \ |
121 V(_Float32x4, withY, Float32x4WithY, 1806065938) \ | 121 V(_Float32x4, withY, Float32x4WithY, 1806065938) \ |
122 V(_Float32x4, withZ, Float32x4WithZ, 320659034) \ | 122 V(_Float32x4, withZ, Float32x4WithZ, 320659034) \ |
123 V(_Float32x4, withW, Float32x4WithW, 1108437255) \ | 123 V(_Float32x4, withW, Float32x4WithW, 1108437255) \ |
124 V(Float64x2, Float64x2., Float64x2Constructor, 1283521526) \ | 124 V(Float64x2, Float64x2., Float64x2Constructor, 1283521526) \ |
125 V(Float64x2, Float64x2.zero, Float64x2Zero, 1971574037) \ | 125 V(Float64x2, Float64x2.zero, Float64x2Zero, 1971574037) \ |
126 V(Float64x2, Float64x2.splat, Float64x2Splat, 823230813) \ | 126 V(Float64x2, Float64x2.splat, Float64x2Splat, 823230813) \ |
127 V(Float64x2, Float64x2.fromFloat32x4, Float64x2FromFloat32x4, 1383666060) \ | 127 V(Float64x2, Float64x2.fromFloat32x4, Float64x2FromFloat32x4, 1383666060) \ |
128 V(_Float64x2, get:x, Float64x2GetX, 176817227) \ | 128 V(_Float64x2, get:x, Float64x2GetX, 176817227) \ |
129 V(_Float64x2, get:y, Float64x2GetY, 1858031019) \ | 129 V(_Float64x2, get:y, Float64x2GetY, 1858031019) \ |
| 130 V(_Float64x2, _negate, Float64x2Negate, 1345265430) \ |
| 131 V(_Float64x2, abs, Float64x2Abs, 778551930) \ |
| 132 V(_Float64x2, sqrt, Float64x2Sqrt, 591345168) \ |
| 133 V(_Float64x2, get:signMask, Float64x2GetSignMask, 601579087) \ |
130 V(Int32x4, Int32x4.bool, Int32x4BoolConstructor, 295910141) \ | 134 V(Int32x4, Int32x4.bool, Int32x4BoolConstructor, 295910141) \ |
131 V(Int32x4, Int32x4.fromFloat32x4Bits, Int32x4FromFloat32x4Bits, \ | 135 V(Int32x4, Int32x4.fromFloat32x4Bits, Int32x4FromFloat32x4Bits, \ |
132 893850947) \ | 136 893850947) \ |
133 V(_Int32x4, get:flagX, Int32x4GetFlagX, 729265594) \ | 137 V(_Int32x4, get:flagX, Int32x4GetFlagX, 729265594) \ |
134 V(_Int32x4, get:flagY, Int32x4GetFlagY, 430870640) \ | 138 V(_Int32x4, get:flagY, Int32x4GetFlagY, 430870640) \ |
135 V(_Int32x4, get:flagZ, Int32x4GetFlagZ, 1981106287) \ | 139 V(_Int32x4, get:flagZ, Int32x4GetFlagZ, 1981106287) \ |
136 V(_Int32x4, get:flagW, Int32x4GetFlagW, 629385890) \ | 140 V(_Int32x4, get:flagW, Int32x4GetFlagW, 629385890) \ |
137 V(_Int32x4, get:signMask, Int32x4GetSignMask, 1598817537) \ | 141 V(_Int32x4, get:signMask, Int32x4GetSignMask, 1598817537) \ |
138 V(_Int32x4, shuffle, Int32x4Shuffle, 599391160) \ | 142 V(_Int32x4, shuffle, Int32x4Shuffle, 599391160) \ |
139 V(_Int32x4, shuffleMix, Int32x4ShuffleMix, 1491641197) \ | 143 V(_Int32x4, shuffleMix, Int32x4ShuffleMix, 1491641197) \ |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 M(TestSmi) \ | 764 M(TestSmi) \ |
761 M(BoxFloat64x2) \ | 765 M(BoxFloat64x2) \ |
762 M(UnboxFloat64x2) \ | 766 M(UnboxFloat64x2) \ |
763 M(BinaryFloat64x2Op) \ | 767 M(BinaryFloat64x2Op) \ |
764 M(Float64x2Zero) \ | 768 M(Float64x2Zero) \ |
765 M(Float64x2Constructor) \ | 769 M(Float64x2Constructor) \ |
766 M(Float64x2Splat) \ | 770 M(Float64x2Splat) \ |
767 M(Float32x4ToFloat64x2) \ | 771 M(Float32x4ToFloat64x2) \ |
768 M(Float64x2ToFloat32x4) \ | 772 M(Float64x2ToFloat32x4) \ |
769 M(Simd64x2Shuffle) \ | 773 M(Simd64x2Shuffle) \ |
| 774 M(Float64x2ZeroArg) \ |
770 | 775 |
771 | 776 |
772 #define FORWARD_DECLARATION(type) class type##Instr; | 777 #define FORWARD_DECLARATION(type) class type##Instr; |
773 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) | 778 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) |
774 #undef FORWARD_DECLARATION | 779 #undef FORWARD_DECLARATION |
775 | 780 |
776 | 781 |
777 // Functions required in all concrete instruction classes. | 782 // Functions required in all concrete instruction classes. |
778 #define DECLARE_INSTRUCTION(type) \ | 783 #define DECLARE_INSTRUCTION(type) \ |
779 virtual Tag tag() const { return k##type; } \ | 784 virtual Tag tag() const { return k##type; } \ |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 friend class Float32x4ConstructorInstr; | 1050 friend class Float32x4ConstructorInstr; |
1046 friend class Float32x4ComparisonInstr; | 1051 friend class Float32x4ComparisonInstr; |
1047 friend class Float32x4MinMaxInstr; | 1052 friend class Float32x4MinMaxInstr; |
1048 friend class Float32x4ScaleInstr; | 1053 friend class Float32x4ScaleInstr; |
1049 friend class Float32x4SqrtInstr; | 1054 friend class Float32x4SqrtInstr; |
1050 friend class Float32x4ZeroArgInstr; | 1055 friend class Float32x4ZeroArgInstr; |
1051 friend class Float32x4ClampInstr; | 1056 friend class Float32x4ClampInstr; |
1052 friend class Float32x4WithInstr; | 1057 friend class Float32x4WithInstr; |
1053 friend class Float32x4ToInt32x4Instr; | 1058 friend class Float32x4ToInt32x4Instr; |
1054 friend class Simd64x2ShuffleInstr; | 1059 friend class Simd64x2ShuffleInstr; |
| 1060 friend class Float64x2ZeroArgInstr; |
1055 friend class Float32x4ToFloat64x2Instr; | 1061 friend class Float32x4ToFloat64x2Instr; |
1056 friend class Float64x2ToFloat32x4Instr; | 1062 friend class Float64x2ToFloat32x4Instr; |
1057 friend class Float64x2ZeroInstr; | 1063 friend class Float64x2ZeroInstr; |
1058 friend class Float64x2SplatInstr; | 1064 friend class Float64x2SplatInstr; |
1059 friend class Float64x2ConstructorInstr; | 1065 friend class Float64x2ConstructorInstr; |
1060 friend class Int32x4BoolConstructorInstr; | 1066 friend class Int32x4BoolConstructorInstr; |
1061 friend class Int32x4GetFlagInstr; | 1067 friend class Int32x4GetFlagInstr; |
1062 friend class Int32x4SetFlagInstr; | 1068 friend class Int32x4SetFlagInstr; |
1063 friend class Int32x4SelectInstr; | 1069 friend class Int32x4SelectInstr; |
1064 friend class Int32x4ToFloat32x4Instr; | 1070 friend class Int32x4ToFloat32x4Instr; |
(...skipping 4990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6055 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 6061 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
6056 virtual bool AttributesEqual(Instruction* other) const { return true; } | 6062 virtual bool AttributesEqual(Instruction* other) const { return true; } |
6057 | 6063 |
6058 virtual bool MayThrow() const { return false; } | 6064 virtual bool MayThrow() const { return false; } |
6059 | 6065 |
6060 private: | 6066 private: |
6061 DISALLOW_COPY_AND_ASSIGN(Float64x2ZeroInstr); | 6067 DISALLOW_COPY_AND_ASSIGN(Float64x2ZeroInstr); |
6062 }; | 6068 }; |
6063 | 6069 |
6064 | 6070 |
| 6071 class Float64x2ZeroArgInstr : public TemplateDefinition<1> { |
| 6072 public: |
| 6073 Float64x2ZeroArgInstr(MethodRecognizer::Kind op_kind, Value* left, |
| 6074 intptr_t deopt_id) : op_kind_(op_kind) { |
| 6075 SetInputAt(0, left); |
| 6076 deopt_id_ = deopt_id; |
| 6077 } |
| 6078 |
| 6079 Value* left() const { return inputs_[0]; } |
| 6080 |
| 6081 MethodRecognizer::Kind op_kind() const { return op_kind_; } |
| 6082 |
| 6083 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 6084 |
| 6085 virtual bool CanDeoptimize() const { return false; } |
| 6086 |
| 6087 virtual Representation representation() const { |
| 6088 if (op_kind() == MethodRecognizer::kFloat64x2GetSignMask) { |
| 6089 // Smi. |
| 6090 return kTagged; |
| 6091 } |
| 6092 return kUnboxedFloat64x2; |
| 6093 } |
| 6094 |
| 6095 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 6096 ASSERT(idx == 0); |
| 6097 return kUnboxedFloat64x2; |
| 6098 } |
| 6099 |
| 6100 virtual intptr_t DeoptimizationTarget() const { |
| 6101 // Direct access since this instruction cannot deoptimize, and the deopt-id |
| 6102 // was inherited from another instruction that could deoptimize. |
| 6103 return deopt_id_; |
| 6104 } |
| 6105 |
| 6106 DECLARE_INSTRUCTION(Float64x2ZeroArg) |
| 6107 virtual CompileType ComputeType() const; |
| 6108 |
| 6109 virtual bool AllowsCSE() const { return true; } |
| 6110 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 6111 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
| 6112 virtual bool AttributesEqual(Instruction* other) const { |
| 6113 return op_kind() == other->AsFloat64x2ZeroArg()->op_kind(); |
| 6114 } |
| 6115 |
| 6116 virtual bool MayThrow() const { return false; } |
| 6117 |
| 6118 private: |
| 6119 const MethodRecognizer::Kind op_kind_; |
| 6120 |
| 6121 DISALLOW_COPY_AND_ASSIGN(Float64x2ZeroArgInstr); |
| 6122 }; |
| 6123 |
| 6124 |
6065 class Int32x4BoolConstructorInstr : public TemplateDefinition<4> { | 6125 class Int32x4BoolConstructorInstr : public TemplateDefinition<4> { |
6066 public: | 6126 public: |
6067 Int32x4BoolConstructorInstr(Value* value0, Value* value1, Value* value2, | 6127 Int32x4BoolConstructorInstr(Value* value0, Value* value1, Value* value2, |
6068 Value* value3, intptr_t deopt_id) { | 6128 Value* value3, intptr_t deopt_id) { |
6069 SetInputAt(0, value0); | 6129 SetInputAt(0, value0); |
6070 SetInputAt(1, value1); | 6130 SetInputAt(1, value1); |
6071 SetInputAt(2, value2); | 6131 SetInputAt(2, value2); |
6072 SetInputAt(3, value3); | 6132 SetInputAt(3, value3); |
6073 deopt_id_ = deopt_id; | 6133 deopt_id_ = deopt_id; |
6074 } | 6134 } |
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7556 ForwardInstructionIterator* current_iterator_; | 7616 ForwardInstructionIterator* current_iterator_; |
7557 | 7617 |
7558 private: | 7618 private: |
7559 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 7619 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
7560 }; | 7620 }; |
7561 | 7621 |
7562 | 7622 |
7563 } // namespace dart | 7623 } // namespace dart |
7564 | 7624 |
7565 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 7625 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |