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

Side by Side Diff: src/IceTypes.cpp

Issue 1614273002: Subzero: Make -reg-use and -reg-exclude specific to register class. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add error log Created 4 years, 11 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
« no previous file with comments | « src/IceTypes.h ('k') | src/IceTypes.def » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceTypes.cpp - Primitive type properties ---------------===// 1 //===- subzero/src/IceTypes.cpp - Primitive type properties ---------------===//
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 12 matching lines...) Expand all
23 const char *TargetArchName[] = { 23 const char *TargetArchName[] = {
24 #define X(tag, str, is_elf64, e_machine, e_flags) str, 24 #define X(tag, str, is_elf64, e_machine, e_flags) str,
25 TARGETARCH_TABLE 25 TARGETARCH_TABLE
26 #undef X 26 #undef X
27 }; 27 };
28 28
29 // Show tags match between ICETYPE_TABLE and ICETYPE_PROPS_TABLE. 29 // Show tags match between ICETYPE_TABLE and ICETYPE_PROPS_TABLE.
30 30
31 // Define a temporary set of enum values based on ICETYPE_TABLE 31 // Define a temporary set of enum values based on ICETYPE_TABLE
32 enum { 32 enum {
33 #define X(tag, sizeLog2, align, elts, elty, str) _table_tag_##tag, 33 #define X(tag, sizeLog2, align, elts, elty, str, rcstr) _table_tag_##tag,
34 ICETYPE_TABLE 34 ICETYPE_TABLE
35 #undef X 35 #undef X
36 _enum_table_tag_Names 36 _enum_table_tag_Names
37 }; 37 };
38 // Define a temporary set of enum values based on ICETYPE_PROPS_TABLE 38 // Define a temporary set of enum values based on ICETYPE_PROPS_TABLE
39 enum { 39 enum {
40 #define X(tag, IsVec, IsInt, IsFloat, IsIntArith, IsLoadStore, IsParam, \ 40 #define X(tag, IsVec, IsInt, IsFloat, IsIntArith, IsLoadStore, IsParam, \
41 CompareResult) \ 41 CompareResult) \
42 _props_table_tag_##tag, 42 _props_table_tag_##tag,
43 ICETYPE_PROPS_TABLE 43 ICETYPE_PROPS_TABLE
44 #undef X 44 #undef X
45 _enum_props_table_tag_Names 45 _enum_props_table_tag_Names
46 }; 46 };
47 // Assert that tags in ICETYPE_TABLE are also in ICETYPE_PROPS_TABLE. 47 // Assert that tags in ICETYPE_TABLE are also in ICETYPE_PROPS_TABLE.
48 #define X(tag, sizeLog2, align, elts, elty, str) \ 48 #define X(tag, sizeLog2, align, elts, elty, str, rcstr) \
49 static_assert( \ 49 static_assert( \
50 (unsigned)_table_tag_##tag == (unsigned)_props_table_tag_##tag, \ 50 (unsigned)_table_tag_##tag == (unsigned)_props_table_tag_##tag, \
51 "Inconsistency between ICETYPE_PROPS_TABLE and ICETYPE_TABLE"); 51 "Inconsistency between ICETYPE_PROPS_TABLE and ICETYPE_TABLE");
52 ICETYPE_TABLE 52 ICETYPE_TABLE
53 #undef X 53 #undef X
54 // Assert that tags in ICETYPE_PROPS_TABLE is in ICETYPE_TABLE. 54 // Assert that tags in ICETYPE_PROPS_TABLE is in ICETYPE_TABLE.
55 #define X(tag, IsVec, IsInt, IsFloat, IsIntArith, IsLoadStore, IsParam, \ 55 #define X(tag, IsVec, IsInt, IsFloat, IsIntArith, IsLoadStore, IsParam, \
56 CompareResult) \ 56 CompareResult) \
57 static_assert( \ 57 static_assert( \
58 (unsigned)_table_tag_##tag == (unsigned)_props_table_tag_##tag, \ 58 (unsigned)_table_tag_##tag == (unsigned)_props_table_tag_##tag, \
59 "Inconsistency between ICETYPE_PROPS_TABLE and ICETYPE_TABLE"); 59 "Inconsistency between ICETYPE_PROPS_TABLE and ICETYPE_TABLE");
60 ICETYPE_PROPS_TABLE 60 ICETYPE_PROPS_TABLE
61 #undef X 61 #undef X
62 62
63 // Show vector definitions match in ICETYPE_TABLE and ICETYPE_PROPS_TABLE. 63 // Show vector definitions match in ICETYPE_TABLE and ICETYPE_PROPS_TABLE.
64 64
65 // Define constants for each element size in ICETYPE_TABLE. 65 // Define constants for each element size in ICETYPE_TABLE.
66 enum { 66 enum {
67 #define X(tag, sizeLog2, align, elts, elty, str) _table_elts_##tag = elts, 67 #define X(tag, sizeLog2, align, elts, elty, str, rcstr) \
68 _table_elts_##tag = elts,
68 ICETYPE_TABLE 69 ICETYPE_TABLE
69 #undef X 70 #undef X
70 _enum_table_elts_Elements = 0 71 _enum_table_elts_Elements = 0
71 }; 72 };
72 // Define constants for boolean flag if vector in ICETYPE_PROPS_TABLE. 73 // Define constants for boolean flag if vector in ICETYPE_PROPS_TABLE.
73 enum { 74 enum {
74 #define X(tag, IsVec, IsInt, IsFloat, IsIntArith, IsLoadStore, IsParam, \ 75 #define X(tag, IsVec, IsInt, IsFloat, IsIntArith, IsLoadStore, IsParam, \
75 CompareResult) \ 76 CompareResult) \
76 _props_table_IsVec_##tag = IsVec, 77 _props_table_IsVec_##tag = IsVec,
77 ICETYPE_PROPS_TABLE 78 ICETYPE_PROPS_TABLE
78 #undef X 79 #undef X
79 }; 80 };
80 // Verify that the number of vector elements is consistent with IsVec. 81 // Verify that the number of vector elements is consistent with IsVec.
81 #define X(tag, IsVec, IsInt, IsFloat, IsIntArith, IsLoadStore, IsParam, \ 82 #define X(tag, IsVec, IsInt, IsFloat, IsIntArith, IsLoadStore, IsParam, \
82 CompareResult) \ 83 CompareResult) \
83 static_assert((_table_elts_##tag > 1) == _props_table_IsVec_##tag, \ 84 static_assert((_table_elts_##tag > 1) == _props_table_IsVec_##tag, \
84 "Inconsistent vector specification in ICETYPE_PROPS_TABLE"); 85 "Inconsistent vector specification in ICETYPE_PROPS_TABLE");
85 ICETYPE_PROPS_TABLE 86 ICETYPE_PROPS_TABLE
86 #undef X 87 #undef X
87 88
88 struct TypeAttributeFields { 89 struct TypeAttributeFields {
89 int8_t TypeWidthInBytesLog2; 90 int8_t TypeWidthInBytesLog2;
90 size_t TypeAlignInBytes; 91 size_t TypeAlignInBytes;
91 size_t TypeNumElements; 92 size_t TypeNumElements;
92 Type TypeElementType; 93 Type TypeElementType;
93 const char *DisplayString; 94 const char *DisplayString;
95 const char *RegClassString;
94 }; 96 };
95 97
96 const struct TypeAttributeFields TypeAttributes[] = { 98 const struct TypeAttributeFields TypeAttributes[] = {
97 #define X(tag, sizeLog2, align, elts, elty, str) \ 99 #define X(tag, sizeLog2, align, elts, elty, str, rcstr) \
98 { sizeLog2, align, elts, IceType_##elty, str } \ 100 { sizeLog2, align, elts, IceType_##elty, str, rcstr } \
99 , 101 ,
100 ICETYPE_TABLE 102 ICETYPE_TABLE
101 #undef X 103 #undef X
102 }; 104 };
103 105
104 struct TypePropertyFields { 106 struct TypePropertyFields {
105 bool TypeIsVectorType; 107 bool TypeIsVectorType;
106 bool TypeIsIntegerType; 108 bool TypeIsIntegerType;
107 bool TypeIsScalarIntegerType; 109 bool TypeIsScalarIntegerType;
108 bool TypeIsVectorIntegerType; 110 bool TypeIsVectorIntegerType;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 // ======================== Dump routines ======================== // 275 // ======================== Dump routines ======================== //
274 276
275 const char *typeString(Type Ty) { 277 const char *typeString(Type Ty) {
276 size_t Index = static_cast<size_t>(Ty); 278 size_t Index = static_cast<size_t>(Ty);
277 if (Index < IceType_NUM) 279 if (Index < IceType_NUM)
278 return TypeAttributes[Index].DisplayString; 280 return TypeAttributes[Index].DisplayString;
279 llvm_unreachable("Invalid type for typeString"); 281 llvm_unreachable("Invalid type for typeString");
280 return "???"; 282 return "???";
281 } 283 }
282 284
285 const char *regClassString(RegClass C) {
286 if (static_cast<size_t>(C) < IceType_NUM)
287 return TypeAttributes[C].RegClassString;
288 llvm_unreachable("Invalid type for regClassString");
289 return "???";
290 }
291
283 void FuncSigType::dump(Ostream &Stream) const { 292 void FuncSigType::dump(Ostream &Stream) const {
284 if (!BuildDefs::dump()) 293 if (!BuildDefs::dump())
285 return; 294 return;
286 Stream << ReturnType << " ("; 295 Stream << ReturnType << " (";
287 bool IsFirst = true; 296 bool IsFirst = true;
288 for (const Type ArgTy : ArgList) { 297 for (const Type ArgTy : ArgList) {
289 if (IsFirst) { 298 if (IsFirst) {
290 IsFirst = false; 299 IsFirst = false;
291 } else { 300 } else {
292 Stream << ", "; 301 Stream << ", ";
293 } 302 }
294 Stream << ArgTy; 303 Stream << ArgTy;
295 } 304 }
296 Stream << ")"; 305 Stream << ")";
297 } 306 }
298 307
299 } // end of namespace Ice 308 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTypes.h ('k') | src/IceTypes.def » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698