Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 14781002: Inline remaining Float32x4 operations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 V(_Float32x4, _cmpgte, Float32x4GreaterThanOrEqual, 548944488) \ 87 V(_Float32x4, _cmpgte, Float32x4GreaterThanOrEqual, 548944488) \
88 V(_Float32x4, _cmplt, Float32x4LessThan, 548944488) \ 88 V(_Float32x4, _cmplt, Float32x4LessThan, 548944488) \
89 V(_Float32x4, _cmplte, Float32x4LessThanOrEqual, 548944488) \ 89 V(_Float32x4, _cmplte, Float32x4LessThanOrEqual, 548944488) \
90 V(_Float32x4, _cmpnequal, Float32x4NotEqual, 548944488) \ 90 V(_Float32x4, _cmpnequal, Float32x4NotEqual, 548944488) \
91 V(_Float32x4, _min, Float32x4Min, 342800599) \ 91 V(_Float32x4, _min, Float32x4Min, 342800599) \
92 V(_Float32x4, _max, Float32x4Max, 342800599) \ 92 V(_Float32x4, _max, Float32x4Max, 342800599) \
93 V(_Float32x4, _scale, Float32x4Scale, 219466242) \ 93 V(_Float32x4, _scale, Float32x4Scale, 219466242) \
94 V(_Float32x4, _sqrt, Float32x4Sqrt, 42621627) \ 94 V(_Float32x4, _sqrt, Float32x4Sqrt, 42621627) \
95 V(_Float32x4, _reciprocalSqrt, Float32x4ReciprocalSqrt, 42621627) \ 95 V(_Float32x4, _reciprocalSqrt, Float32x4ReciprocalSqrt, 42621627) \
96 V(_Float32x4, _reciprocal, Float32x4Reciprocal, 42621627) \ 96 V(_Float32x4, _reciprocal, Float32x4Reciprocal, 42621627) \
97 V(_Float32x4, _negate, Float32x4Negate, 42621627) \
98 V(_Float32x4, _abs, Float32x4Absolute, 42621627) \
99 V(_Float32x4, _clamp, Float32x4Clamp, 615895313) \
100 V(_Float32x4, withX, Float32x4WithX, 219466242) \
101 V(_Float32x4, withY, Float32x4WithY, 219466242) \
102 V(_Float32x4, withZ, Float32x4WithZ, 219466242) \
103 V(_Float32x4, withW, Float32x4WithW, 219466242) \
104 V(_Float32x4, _toUint32x4, Float32x4ToUint32x4, 1044409108) \
105
97 106
98 // Class that recognizes the name and owner of a function and returns the 107 // Class that recognizes the name and owner of a function and returns the
99 // corresponding enum. See RECOGNIZED_LIST above for list of recognizable 108 // corresponding enum. See RECOGNIZED_LIST above for list of recognizable
100 // functions. 109 // functions.
101 class MethodRecognizer : public AllStatic { 110 class MethodRecognizer : public AllStatic {
102 public: 111 public:
103 enum Kind { 112 enum Kind {
104 kUnknown, 113 kUnknown,
105 #define DEFINE_ENUM_LIST(class_name, function_name, enum_name, fp) k##enum_name, 114 #define DEFINE_ENUM_LIST(class_name, function_name, enum_name, fp) k##enum_name,
106 RECOGNIZED_LIST(DEFINE_ENUM_LIST) 115 RECOGNIZED_LIST(DEFINE_ENUM_LIST)
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 M(IfThenElse) \ 573 M(IfThenElse) \
565 M(BinaryFloat32x4Op) \ 574 M(BinaryFloat32x4Op) \
566 M(Float32x4Shuffle) \ 575 M(Float32x4Shuffle) \
567 M(Float32x4Constructor) \ 576 M(Float32x4Constructor) \
568 M(Float32x4Zero) \ 577 M(Float32x4Zero) \
569 M(Float32x4Splat) \ 578 M(Float32x4Splat) \
570 M(Float32x4Comparison) \ 579 M(Float32x4Comparison) \
571 M(Float32x4MinMax) \ 580 M(Float32x4MinMax) \
572 M(Float32x4Scale) \ 581 M(Float32x4Scale) \
573 M(Float32x4Sqrt) \ 582 M(Float32x4Sqrt) \
583 M(Float32x4ZeroArg) \
584 M(Float32x4Clamp) \
585 M(Float32x4With) \
586 M(Float32x4ToUint32x4) \
574 587
575 588
576 #define FORWARD_DECLARATION(type) class type##Instr; 589 #define FORWARD_DECLARATION(type) class type##Instr;
577 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) 590 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION)
578 #undef FORWARD_DECLARATION 591 #undef FORWARD_DECLARATION
579 592
580 593
581 // Functions required in all concrete instruction classes. 594 // Functions required in all concrete instruction classes.
582 #define DECLARE_INSTRUCTION(type) \ 595 #define DECLARE_INSTRUCTION(type) \
583 virtual Tag tag() const { return k##type; } \ 596 virtual Tag tag() const { return k##type; } \
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 friend class BinaryDoubleOpInstr; 841 friend class BinaryDoubleOpInstr;
829 friend class BinaryFloat32x4OpInstr; 842 friend class BinaryFloat32x4OpInstr;
830 friend class Float32x4ZeroInstr; 843 friend class Float32x4ZeroInstr;
831 friend class Float32x4SplatInstr; 844 friend class Float32x4SplatInstr;
832 friend class Float32x4ShuffleInstr; 845 friend class Float32x4ShuffleInstr;
833 friend class Float32x4ConstructorInstr; 846 friend class Float32x4ConstructorInstr;
834 friend class Float32x4ComparisonInstr; 847 friend class Float32x4ComparisonInstr;
835 friend class Float32x4MinMaxInstr; 848 friend class Float32x4MinMaxInstr;
836 friend class Float32x4ScaleInstr; 849 friend class Float32x4ScaleInstr;
837 friend class Float32x4SqrtInstr; 850 friend class Float32x4SqrtInstr;
851 friend class Float32x4ZeroArgInstr;
852 friend class Float32x4ClampInstr;
853 friend class Float32x4WithInstr;
854 friend class Float32x4ToUint32x4Instr;
838 friend class BinaryMintOpInstr; 855 friend class BinaryMintOpInstr;
839 friend class BinarySmiOpInstr; 856 friend class BinarySmiOpInstr;
840 friend class UnarySmiOpInstr; 857 friend class UnarySmiOpInstr;
841 friend class ShiftMintOpInstr; 858 friend class ShiftMintOpInstr;
842 friend class UnaryMintOpInstr; 859 friend class UnaryMintOpInstr;
843 friend class MathSqrtInstr; 860 friend class MathSqrtInstr;
844 friend class CheckClassInstr; 861 friend class CheckClassInstr;
845 friend class GuardFieldInstr; 862 friend class GuardFieldInstr;
846 friend class CheckSmiInstr; 863 friend class CheckSmiInstr;
847 friend class CheckArrayBoundInstr; 864 friend class CheckArrayBoundInstr;
(...skipping 3833 matching lines...) Expand 10 before | Expand all | Expand 10 after
4681 return op_kind() == other->AsFloat32x4Sqrt()->op_kind(); 4698 return op_kind() == other->AsFloat32x4Sqrt()->op_kind();
4682 } 4699 }
4683 4700
4684 private: 4701 private:
4685 const MethodRecognizer::Kind op_kind_; 4702 const MethodRecognizer::Kind op_kind_;
4686 4703
4687 DISALLOW_COPY_AND_ASSIGN(Float32x4SqrtInstr); 4704 DISALLOW_COPY_AND_ASSIGN(Float32x4SqrtInstr);
4688 }; 4705 };
4689 4706
4690 4707
4708 class Float32x4ZeroArgInstr : public TemplateDefinition<1> {
4709 public:
4710 Float32x4ZeroArgInstr(MethodRecognizer::Kind op_kind, Value* left,
4711 InstanceCallInstr* instance_call) : op_kind_(op_kind) {
4712 SetInputAt(0, left);
4713 deopt_id_ = instance_call->deopt_id();
4714 }
4715
4716 Value* left() const { return inputs_[0]; }
4717
4718 MethodRecognizer::Kind op_kind() const { return op_kind_; }
4719
4720 virtual void PrintOperandsTo(BufferFormatter* f) const;
4721
4722 virtual bool CanDeoptimize() const { return false; }
4723
4724 virtual Representation representation() const {
4725 return kUnboxedFloat32x4;
4726 }
4727
4728 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4729 ASSERT(idx == 0);
4730 return kUnboxedFloat32x4;
4731 }
4732
4733 virtual intptr_t DeoptimizationTarget() const {
4734 // Direct access since this instruction cannot deoptimize, and the deopt-id
4735 // was inherited from another instruction that could deoptimize.
4736 return deopt_id_;
4737 }
4738
4739 DECLARE_INSTRUCTION(Float32x4ZeroArg)
4740 virtual CompileType ComputeType() const;
4741
4742 virtual bool AllowsCSE() const { return true; }
4743 virtual EffectSet Effects() const { return EffectSet::None(); }
4744 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4745 virtual bool AttributesEqual(Instruction* other) const {
4746 return op_kind() == other->AsFloat32x4ZeroArg()->op_kind();
4747 }
4748
4749 private:
4750 const MethodRecognizer::Kind op_kind_;
4751
4752 DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroArgInstr);
4753 };
4754
4755
4756 class Float32x4ClampInstr : public TemplateDefinition<3> {
4757 public:
4758 Float32x4ClampInstr(Value* left, Value* lower, Value* upper,
4759 InstanceCallInstr* instance_call) {
4760 SetInputAt(0, left);
4761 SetInputAt(1, lower);
4762 SetInputAt(2, upper);
4763 deopt_id_ = instance_call->deopt_id();
4764 }
4765
4766 Value* left() const { return inputs_[0]; }
4767 Value* lower() const { return inputs_[1]; }
4768 Value* upper() const { return inputs_[2]; }
4769
4770 virtual void PrintOperandsTo(BufferFormatter* f) const;
4771
4772 virtual bool CanDeoptimize() const { return false; }
4773
4774 virtual Representation representation() const {
4775 return kUnboxedFloat32x4;
4776 }
4777
4778 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4779 ASSERT((idx == 0) || (idx == 1) || (idx == 2));
4780 return kUnboxedFloat32x4;
4781 }
4782
4783 virtual intptr_t DeoptimizationTarget() const {
4784 // Direct access since this instruction cannot deoptimize, and the deopt-id
4785 // was inherited from another instruction that could deoptimize.
4786 return deopt_id_;
4787 }
4788
4789 DECLARE_INSTRUCTION(Float32x4Clamp)
4790 virtual CompileType ComputeType() const;
4791
4792 virtual bool AllowsCSE() const { return true; }
4793 virtual EffectSet Effects() const { return EffectSet::None(); }
4794 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4795 virtual bool AttributesEqual(Instruction* other) const { return true; }
4796
4797 private:
4798 DISALLOW_COPY_AND_ASSIGN(Float32x4ClampInstr);
4799 };
4800
4801
4802 class Float32x4WithInstr : public TemplateDefinition<2> {
4803 public:
4804 Float32x4WithInstr(MethodRecognizer::Kind op_kind, Value* left,
4805 Value* replacement, InstanceCallInstr* instance_call)
4806 : op_kind_(op_kind) {
4807 SetInputAt(0, replacement);
4808 SetInputAt(1, left);
4809 deopt_id_ = instance_call->deopt_id();
4810 }
4811
4812 Value* left() const { return inputs_[1]; }
4813 Value* replacement() const { return inputs_[0]; }
4814
4815 MethodRecognizer::Kind op_kind() const { return op_kind_; }
4816
4817 virtual void PrintOperandsTo(BufferFormatter* f) const;
4818
4819 virtual bool CanDeoptimize() const { return false; }
4820
4821 virtual Representation representation() const {
4822 return kUnboxedFloat32x4;
4823 }
4824
4825 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4826 ASSERT((idx == 0) || (idx == 1));
4827 if (idx == 0) {
4828 return kUnboxedDouble;
4829 }
4830 return kUnboxedFloat32x4;
4831 }
4832
4833 virtual intptr_t DeoptimizationTarget() const {
4834 // Direct access since this instruction cannot deoptimize, and the deopt-id
4835 // was inherited from another instruction that could deoptimize.
4836 return deopt_id_;
4837 }
4838
4839 DECLARE_INSTRUCTION(Float32x4With)
4840 virtual CompileType ComputeType() const;
4841
4842 virtual bool AllowsCSE() const { return true; }
4843 virtual EffectSet Effects() const { return EffectSet::None(); }
4844 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4845 virtual bool AttributesEqual(Instruction* other) const {
4846 return op_kind() == other->AsFloat32x4With()->op_kind();
4847 }
4848
4849 private:
4850 const MethodRecognizer::Kind op_kind_;
4851
4852 DISALLOW_COPY_AND_ASSIGN(Float32x4WithInstr);
4853 };
4854
4855
4856 class Float32x4ToUint32x4Instr : public TemplateDefinition<1> {
4857 public:
4858 Float32x4ToUint32x4Instr(Value* left, InstanceCallInstr* instance_call) {
4859 SetInputAt(0, left);
4860 deopt_id_ = instance_call->deopt_id();
4861 }
4862
4863 Value* left() const { return inputs_[0]; }
4864
4865 virtual void PrintOperandsTo(BufferFormatter* f) const;
4866
4867 virtual bool CanDeoptimize() const { return false; }
4868
4869 virtual Representation representation() const {
4870 return kUnboxedUint32x4;
4871 }
4872
4873 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4874 ASSERT(idx == 0);
4875 return kUnboxedFloat32x4;
4876 }
4877
4878 virtual intptr_t DeoptimizationTarget() const {
4879 // Direct access since this instruction cannot deoptimize, and the deopt-id
4880 // was inherited from another instruction that could deoptimize.
4881 return deopt_id_;
4882 }
4883
4884 DECLARE_INSTRUCTION(Float32x4ToUint32x4)
4885 virtual CompileType ComputeType() const;
4886
4887 virtual bool AllowsCSE() const { return true; }
4888 virtual EffectSet Effects() const { return EffectSet::None(); }
4889 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4890 virtual bool AttributesEqual(Instruction* other) const { return true; }
4891
4892 private:
4893 DISALLOW_COPY_AND_ASSIGN(Float32x4ToUint32x4Instr);
4894 };
4895
4896
4691 class BinaryMintOpInstr : public TemplateDefinition<2> { 4897 class BinaryMintOpInstr : public TemplateDefinition<2> {
4692 public: 4898 public:
4693 BinaryMintOpInstr(Token::Kind op_kind, 4899 BinaryMintOpInstr(Token::Kind op_kind,
4694 Value* left, 4900 Value* left,
4695 Value* right, 4901 Value* right,
4696 InstanceCallInstr* instance_call) 4902 InstanceCallInstr* instance_call)
4697 : op_kind_(op_kind), 4903 : op_kind_(op_kind),
4698 instance_call_(instance_call) { 4904 instance_call_(instance_call) {
4699 SetInputAt(0, left); 4905 SetInputAt(0, left);
4700 SetInputAt(1, right); 4906 SetInputAt(1, right);
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
5498 ForwardInstructionIterator* current_iterator_; 5704 ForwardInstructionIterator* current_iterator_;
5499 5705
5500 private: 5706 private:
5501 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 5707 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
5502 }; 5708 };
5503 5709
5504 5710
5505 } // namespace dart 5711 } // namespace dart
5506 5712
5507 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 5713 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698