Changeset b0845f9 for src/SymTab/ManglerCommon.cc
- Timestamp:
- Nov 17, 2023, 10:40:21 AM (11 months ago)
- Branches:
- master
- Children:
- 0f6d2884
- Parents:
- e580aa5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/ManglerCommon.cc
re580aa5 rb0845f9 19 19 #include "AST/Type.hpp" 20 20 21 namespace SymTab { 22 namespace Mangler { 23 namespace Encoding { 24 const std::string manglePrefix = "_X"; 21 namespace Mangle { 25 22 26 // GENERATED START, DO NOT EDIT 27 // GENERATED BY BasicTypes-gen.cc 28 // NOTES ON MANGLING: 29 // * Itanium spec says that Float80 encodes to "e" (like LongDouble), but the distinct lengths cause resolution problems. 30 // * Float128 is supposed to encode to "g", but I wanted it to mangle equal to LongDouble. 31 // * Mangling for non-standard complex types is by best guess 32 // * _FloatN is supposed to encode as "DF"N"_"; modified for same reason as above. 33 // * unused mangling identifiers: 34 // - "z" ellipsis 35 // - "Dd" IEEE 754r 64-bit decimal floating point (borrowed for _Float32x) 36 // - "De" IEEE 754r 128-bit decimal floating point 37 // - "Df" IEEE 754r 32-bit decimal floating point 38 // - "Dh" IEEE 754r 16-bit decimal floating point (borrowed for _Float16) 39 // - "DF"N"_" ISO/IEC TS 18661 N-bit binary floating point (_FloatN) 40 // - "Di" char32_t 41 // - "Ds" char16_t 42 const std::string basicTypes[ast::BasicType::NUMBER_OF_BASIC_TYPES] = { 43 "b", // _Bool 44 "c", // char 45 "a", // signed char 46 "h", // unsigned char 47 "s", // signed short int 48 "t", // unsigned short int 49 "i", // signed int 50 "j", // unsigned int 51 "l", // signed long int 52 "m", // unsigned long int 53 "x", // signed long long int 54 "y", // unsigned long long int 55 "n", // __int128 56 "o", // unsigned __int128 57 "DF16_", // _Float16 58 "CDF16_", // _Float16 _Complex 59 "DF32_", // _Float32 60 "CDF32_", // _Float32 _Complex 61 "f", // float 62 "Cf", // float _Complex 63 "DF32x_", // _Float32x 64 "CDF32x_", // _Float32x _Complex 65 "DF64_", // _Float64 66 "CDF64_", // _Float64 _Complex 67 "d", // double 68 "Cd", // double _Complex 69 "DF64x_", // _Float64x 70 "CDF64x_", // _Float64x _Complex 71 "Dq", // __float80 72 "DF128_", // _Float128 73 "CDF128_", // _Float128 _Complex 74 "g", // __float128 75 "e", // long double 76 "Ce", // long double _Complex 77 "DF128x_", // _Float128x 78 "CDF128x_", // _Float128x _Complex 79 }; // basicTypes 80 // GENERATED END 81 static_assert( 82 sizeof(basicTypes)/sizeof(basicTypes[0]) == ast::BasicType::NUMBER_OF_BASIC_TYPES, 83 "Each basic type kind should have a corresponding mangler letter" 84 ); 23 namespace Encoding { 85 24 86 const std::map<int, std::string> qualifiers = { 87 { ast::CV::Const, "K" }, 88 { ast::CV::Volatile, "V" }, 89 { ast::CV::Atomic, "DA" }, // A is array, so need something unique for atmoic. For now, go with multiletter DA 90 { ast::CV::Mutex, "X" }, 91 }; 25 const std::string manglePrefix = "_X"; 92 26 93 const std::string void_t = "v"; 94 const std::string zero = "Z"; 95 const std::string one = "O"; 27 // GENERATED START, DO NOT EDIT 28 // GENERATED BY BasicTypes-gen.cc 29 // NOTES ON MANGLING: 30 // * Itanium spec says that Float80 encodes to "e" (like LongDouble), but the distinct lengths cause resolution problems. 31 // * Float128 is supposed to encode to "g", but I wanted it to mangle equal to LongDouble. 32 // * Mangling for non-standard complex types is by best guess 33 // * _FloatN is supposed to encode as "DF"N"_"; modified for same reason as above. 34 // * unused mangling identifiers: 35 // - "z" ellipsis 36 // - "Dd" IEEE 754r 64-bit decimal floating point (borrowed for _Float32x) 37 // - "De" IEEE 754r 128-bit decimal floating point 38 // - "Df" IEEE 754r 32-bit decimal floating point 39 // - "Dh" IEEE 754r 16-bit decimal floating point (borrowed for _Float16) 40 // - "DF"N"_" ISO/IEC TS 18661 N-bit binary floating point (_FloatN) 41 // - "Di" char32_t 42 // - "Ds" char16_t 43 const std::string basicTypes[ast::BasicType::NUMBER_OF_BASIC_TYPES] = { 44 "b", // _Bool 45 "c", // char 46 "a", // signed char 47 "h", // unsigned char 48 "s", // signed short int 49 "t", // unsigned short int 50 "i", // signed int 51 "j", // unsigned int 52 "l", // signed long int 53 "m", // unsigned long int 54 "x", // signed long long int 55 "y", // unsigned long long int 56 "n", // __int128 57 "o", // unsigned __int128 58 "DF16_", // _Float16 59 "CDF16_", // _Float16 _Complex 60 "DF32_", // _Float32 61 "CDF32_", // _Float32 _Complex 62 "f", // float 63 "Cf", // float _Complex 64 "DF32x_", // _Float32x 65 "CDF32x_", // _Float32x _Complex 66 "DF64_", // _Float64 67 "CDF64_", // _Float64 _Complex 68 "d", // double 69 "Cd", // double _Complex 70 "DF64x_", // _Float64x 71 "CDF64x_", // _Float64x _Complex 72 "Dq", // __float80 73 "DF128_", // _Float128 74 "CDF128_", // _Float128 _Complex 75 "g", // __float128 76 "e", // long double 77 "Ce", // long double _Complex 78 "DF128x_", // _Float128x 79 "CDF128x_", // _Float128x _Complex 80 }; // basicTypes 81 // GENERATED END 82 static_assert( 83 sizeof(basicTypes) / sizeof(basicTypes[0]) == ast::BasicType::NUMBER_OF_BASIC_TYPES, 84 "Each basic type kind should have a corresponding mangler letter" 85 ); 96 86 97 const std::string function = "F"; 98 const std::string tuple = "T";99 const std::string pointer = "P";100 const std::string array = "A";101 const std::string qualifiedTypeStart = "N";102 const std::string qualifiedTypeEnd = "E";87 const std::map<int, std::string> qualifiers = { 88 { ast::CV::Const, "K" }, 89 { ast::CV::Volatile, "V" }, 90 { ast::CV::Atomic, "DA" }, // A is array, so need something unique for atmoic. For now, go with multiletter DA 91 { ast::CV::Mutex, "X" }, 92 }; 103 93 104 const std::string forall = "Q"; 105 const std::string typeVariables[] = { 106 "BD", // dtype 107 "BDS", // dtype + sized 108 "BO", // otype 109 "BF", // ftype 110 "BT", // ttype 111 "BAL", // array length type 112 }; 113 static_assert( 114 sizeof(typeVariables) / sizeof(typeVariables[0]) == ast::TypeDecl::NUMBER_OF_KINDS, 115 "Each type variable kind should have a corresponding mangler prefix" 116 ); 94 const std::string void_t = "v"; 95 const std::string zero = "Z"; 96 const std::string one = "O"; 117 97 118 const std::string struct_t = "S"; 119 const std::string union_t = "U"; 120 const std::string enum_t = "M"; 121 const std::string type = "Y"; 98 const std::string function = "F"; 99 const std::string tuple = "T"; 100 const std::string pointer = "P"; 101 const std::string array = "A"; 102 const std::string qualifiedTypeStart = "N"; 103 const std::string qualifiedTypeEnd = "E"; 122 104 123 const std::string autogen = "autogen__"; 124 const std::string intrinsic = "intrinsic__"; 125 } // namespace Encoding 126 } // namespace Mangler 127 } // namespace SymTab 105 const std::string forall = "Q"; 106 const std::string typeVariables[] = { 107 "BD", // dtype 108 "BDS", // dtype + sized 109 "BO", // otype 110 "BF", // ftype 111 "BT", // ttype 112 "BAL", // array length type 113 }; 114 static_assert( 115 sizeof(typeVariables) / sizeof(typeVariables[0]) == ast::TypeDecl::NUMBER_OF_KINDS, 116 "Each type variable kind should have a corresponding mangler prefix" 117 ); 118 119 const std::string struct_t = "S"; 120 const std::string union_t = "U"; 121 const std::string enum_t = "M"; 122 const std::string type = "Y"; 123 124 const std::string autogen = "autogen__"; 125 const std::string intrinsic = "intrinsic__"; 126 127 } // namespace Encoding 128 129 } // namespace Mangle
Note: See TracChangeset
for help on using the changeset viewer.