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

Side by Side Diff: src/IceTargetLoweringX8632Traits.h

Issue 1674033002: Subzero: Clean up some uses of *_cast<>. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Cleanup of llvm::cast<> style operations Created 4 years, 10 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
OLDNEW
1 //===- subzero/src/IceTargetLoweringX8632Traits.h - x86-32 traits -*- C++ -*-=// 1 //===- subzero/src/IceTargetLoweringX8632Traits.h - x86-32 traits -*- C++ -*-=//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 /// Value is in bytes. Return Value adjusted to the next highest multiple of 726 /// Value is in bytes. Return Value adjusted to the next highest multiple of
727 /// the stack alignment. 727 /// the stack alignment.
728 static uint32_t applyStackAlignment(uint32_t Value) { 728 static uint32_t applyStackAlignment(uint32_t Value) {
729 return Utils::applyAlignment(Value, X86_STACK_ALIGNMENT_BYTES); 729 return Utils::applyAlignment(Value, X86_STACK_ALIGNMENT_BYTES);
730 } 730 }
731 731
732 /// Return the type which the elements of the vector have in the X86 732 /// Return the type which the elements of the vector have in the X86
733 /// representation of the vector. 733 /// representation of the vector.
734 static Type getInVectorElementType(Type Ty) { 734 static Type getInVectorElementType(Type Ty) {
735 assert(isVectorType(Ty)); 735 assert(isVectorType(Ty));
736 size_t Index = static_cast<size_t>(Ty); 736 assert(Ty < TableTypeX8632AttributesSize);
737 (void)Index;
738 assert(Index < TableTypeX8632AttributesSize);
739 return TableTypeX8632Attributes[Ty].InVectorElementType; 737 return TableTypeX8632Attributes[Ty].InVectorElementType;
740 } 738 }
741 739
742 // Note: The following data structures are defined in 740 // Note: The following data structures are defined in
743 // IceTargetLoweringX8632.cpp. 741 // IceTargetLoweringX8632.cpp.
744 742
745 /// The following table summarizes the logic for lowering the fcmp 743 /// The following table summarizes the logic for lowering the fcmp
746 /// instruction. There is one table entry for each of the 16 conditions. 744 /// instruction. There is one table entry for each of the 16 conditions.
747 /// 745 ///
748 /// The first four columns describe the case when the operands are floating 746 /// The first four columns describe the case when the operands are floating
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 /// conditional branches are needed. For the other conditions, three separate 781 /// conditional branches are needed. For the other conditions, three separate
784 /// conditional branches are needed. 782 /// conditional branches are needed.
785 /// {@ 783 /// {@
786 static const struct TableIcmp64Type { 784 static const struct TableIcmp64Type {
787 Cond::BrCond C1, C2, C3; 785 Cond::BrCond C1, C2, C3;
788 } TableIcmp64[]; 786 } TableIcmp64[];
789 static const size_t TableIcmp64Size; 787 static const size_t TableIcmp64Size;
790 /// @} 788 /// @}
791 789
792 static Cond::BrCond getIcmp32Mapping(InstIcmp::ICond Cond) { 790 static Cond::BrCond getIcmp32Mapping(InstIcmp::ICond Cond) {
793 size_t Index = static_cast<size_t>(Cond); 791 assert(Cond < TableIcmp32Size);
794 assert(Index < TableIcmp32Size); 792 return TableIcmp32[Cond].Mapping;
795 return TableIcmp32[Index].Mapping;
796 } 793 }
797 794
798 static const struct TableTypeX8632AttributesType { 795 static const struct TableTypeX8632AttributesType {
799 Type InVectorElementType; 796 Type InVectorElementType;
800 } TableTypeX8632Attributes[]; 797 } TableTypeX8632Attributes[];
801 static const size_t TableTypeX8632AttributesSize; 798 static const size_t TableTypeX8632AttributesSize;
802 799
803 //---------------------------------------------------------------------------- 800 //----------------------------------------------------------------------------
804 // __ __ __ ______ ______ 801 // __ __ __ ______ ______
805 // /\ \/\ "-.\ \/\ ___\/\__ _\ 802 // /\ \/\ "-.\ \/\ ___\/\__ _\
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 /// slot. 949 /// slot.
953 class SpillVariable : public Variable { 950 class SpillVariable : public Variable {
954 SpillVariable() = delete; 951 SpillVariable() = delete;
955 SpillVariable(const SpillVariable &) = delete; 952 SpillVariable(const SpillVariable &) = delete;
956 SpillVariable &operator=(const SpillVariable &) = delete; 953 SpillVariable &operator=(const SpillVariable &) = delete;
957 954
958 public: 955 public:
959 static SpillVariable *create(Cfg *Func, Type Ty, SizeT Index) { 956 static SpillVariable *create(Cfg *Func, Type Ty, SizeT Index) {
960 return new (Func->allocate<SpillVariable>()) SpillVariable(Ty, Index); 957 return new (Func->allocate<SpillVariable>()) SpillVariable(Ty, Index);
961 } 958 }
962 const static OperandKind SpillVariableKind = 959 const static auto SpillVariableKind =
John 2016/02/07 16:18:33 While at this, constexpr?
Jim Stichnoth 2016/02/07 16:42:42 Done.
963 static_cast<OperandKind>(kVariable_Target); 960 static_cast<OperandKind>(kVariable_Target);
964 static bool classof(const Operand *Operand) { 961 static bool classof(const Operand *Operand) {
965 return Operand->getKind() == SpillVariableKind; 962 return Operand->getKind() == SpillVariableKind;
966 } 963 }
967 void setLinkedTo(Variable *Var) { LinkedTo = Var; } 964 void setLinkedTo(Variable *Var) { LinkedTo = Var; }
968 Variable *getLinkedTo() const { return LinkedTo; } 965 Variable *getLinkedTo() const { return LinkedTo; }
969 // Inherit dump() and emit() from Variable. 966 // Inherit dump() and emit() from Variable.
970 967
971 private: 968 private:
972 SpillVariable(Type Ty, SizeT Index) 969 SpillVariable(Type Ty, SizeT Index)
(...skipping 27 matching lines...) Expand all
1000 997
1001 static uint8_t InstSegmentPrefixes[]; 998 static uint8_t InstSegmentPrefixes[];
1002 }; 999 };
1003 1000
1004 using Traits = ::Ice::X8632::TargetX8632Traits; 1001 using Traits = ::Ice::X8632::TargetX8632Traits;
1005 } // end of namespace X8632 1002 } // end of namespace X8632
1006 1003
1007 } // end of namespace Ice 1004 } // end of namespace Ice
1008 1005
1009 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632TRAITS_H 1006 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632TRAITS_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698