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

Side by Side Diff: src/IceTargetLoweringX8664Traits.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/IceTargetLoweringX8664Traits.h - x86-64 traits -*- C++ -*-=// 1 //===- subzero/src/IceTargetLoweringX8664Traits.h - x86-64 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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 /// Value is in bytes. Return Value adjusted to the next highest multiple of 777 /// Value is in bytes. Return Value adjusted to the next highest multiple of
778 /// the stack alignment. 778 /// the stack alignment.
779 static uint32_t applyStackAlignment(uint32_t Value) { 779 static uint32_t applyStackAlignment(uint32_t Value) {
780 return Utils::applyAlignment(Value, X86_STACK_ALIGNMENT_BYTES); 780 return Utils::applyAlignment(Value, X86_STACK_ALIGNMENT_BYTES);
781 } 781 }
782 782
783 /// Return the type which the elements of the vector have in the X86 783 /// Return the type which the elements of the vector have in the X86
784 /// representation of the vector. 784 /// representation of the vector.
785 static Type getInVectorElementType(Type Ty) { 785 static Type getInVectorElementType(Type Ty) {
786 assert(isVectorType(Ty)); 786 assert(isVectorType(Ty));
787 size_t Index = static_cast<size_t>(Ty); 787 assert(Ty < TableTypeX8664AttributesSize);
788 (void)Index;
789 assert(Index < TableTypeX8664AttributesSize);
790 return TableTypeX8664Attributes[Ty].InVectorElementType; 788 return TableTypeX8664Attributes[Ty].InVectorElementType;
791 } 789 }
792 790
793 // Note: The following data structures are defined in 791 // Note: The following data structures are defined in
794 // IceTargetLoweringX8664.cpp. 792 // IceTargetLoweringX8664.cpp.
795 793
796 /// The following table summarizes the logic for lowering the fcmp 794 /// The following table summarizes the logic for lowering the fcmp
797 /// instruction. There is one table entry for each of the 16 conditions. 795 /// instruction. There is one table entry for each of the 16 conditions.
798 /// 796 ///
799 /// The first four columns describe the case when the operands are floating 797 /// The first four columns describe the case when the operands are floating
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 /// conditional branches are needed. For the other conditions, three separate 832 /// conditional branches are needed. For the other conditions, three separate
835 /// conditional branches are needed. 833 /// conditional branches are needed.
836 /// {@ 834 /// {@
837 static const struct TableIcmp64Type { 835 static const struct TableIcmp64Type {
838 Cond::BrCond C1, C2, C3; 836 Cond::BrCond C1, C2, C3;
839 } TableIcmp64[]; 837 } TableIcmp64[];
840 static const size_t TableIcmp64Size; 838 static const size_t TableIcmp64Size;
841 /// @} 839 /// @}
842 840
843 static Cond::BrCond getIcmp32Mapping(InstIcmp::ICond Cond) { 841 static Cond::BrCond getIcmp32Mapping(InstIcmp::ICond Cond) {
844 size_t Index = static_cast<size_t>(Cond); 842 assert(Cond < TableIcmp32Size);
845 assert(Index < TableIcmp32Size); 843 return TableIcmp32[Cond].Mapping;
846 return TableIcmp32[Index].Mapping;
847 } 844 }
848 845
849 static const struct TableTypeX8664AttributesType { 846 static const struct TableTypeX8664AttributesType {
850 Type InVectorElementType; 847 Type InVectorElementType;
851 } TableTypeX8664Attributes[]; 848 } TableTypeX8664Attributes[];
852 static const size_t TableTypeX8664AttributesSize; 849 static const size_t TableTypeX8664AttributesSize;
853 850
854 //---------------------------------------------------------------------------- 851 //----------------------------------------------------------------------------
855 // __ __ __ ______ ______ 852 // __ __ __ ______ ______
856 // /\ \/\ "-.\ \/\ ___\/\__ _\ 853 // /\ \/\ "-.\ \/\ ___\/\__ _\
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 /// slot. 994 /// slot.
998 class SpillVariable : public Variable { 995 class SpillVariable : public Variable {
999 SpillVariable() = delete; 996 SpillVariable() = delete;
1000 SpillVariable(const SpillVariable &) = delete; 997 SpillVariable(const SpillVariable &) = delete;
1001 SpillVariable &operator=(const SpillVariable &) = delete; 998 SpillVariable &operator=(const SpillVariable &) = delete;
1002 999
1003 public: 1000 public:
1004 static SpillVariable *create(Cfg *Func, Type Ty, SizeT Index) { 1001 static SpillVariable *create(Cfg *Func, Type Ty, SizeT Index) {
1005 return new (Func->allocate<SpillVariable>()) SpillVariable(Ty, Index); 1002 return new (Func->allocate<SpillVariable>()) SpillVariable(Ty, Index);
1006 } 1003 }
1007 const static OperandKind SpillVariableKind = 1004 const static auto SpillVariableKind =
John 2016/02/07 16:18:33 While at this, constexpr?
Jim Stichnoth 2016/02/07 16:42:42 Done.
1008 static_cast<OperandKind>(kVariable_Target); 1005 static_cast<OperandKind>(kVariable_Target);
1009 static bool classof(const Operand *Operand) { 1006 static bool classof(const Operand *Operand) {
1010 return Operand->getKind() == SpillVariableKind; 1007 return Operand->getKind() == SpillVariableKind;
1011 } 1008 }
1012 void setLinkedTo(Variable *Var) { LinkedTo = Var; } 1009 void setLinkedTo(Variable *Var) { LinkedTo = Var; }
1013 Variable *getLinkedTo() const { return LinkedTo; } 1010 Variable *getLinkedTo() const { return LinkedTo; }
1014 // Inherit dump() and emit() from Variable. 1011 // Inherit dump() and emit() from Variable.
1015 1012
1016 private: 1013 private:
1017 SpillVariable(Type Ty, SizeT Index) 1014 SpillVariable(Type Ty, SizeT Index)
(...skipping 23 matching lines...) Expand all
1041 const char *FldString; // s, l, or <blank> 1038 const char *FldString; // s, l, or <blank>
1042 } TypeAttributes[]; 1039 } TypeAttributes[];
1043 }; 1040 };
1044 1041
1045 using Traits = ::Ice::X8664::TargetX8664Traits; 1042 using Traits = ::Ice::X8664::TargetX8664Traits;
1046 } // end of namespace X8664 1043 } // end of namespace X8664
1047 1044
1048 } // end of namespace Ice 1045 } // end of namespace Ice
1049 1046
1050 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8664TRAITS_H 1047 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8664TRAITS_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698