source: src/SymTab/ManglerCommon.cc @ e15853c

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpersistent-indexerpthread-emulationqualifiedEnum
Last change on this file since e15853c was e15853c, checked in by Peter A. Buhr <pabuhr@…>, 5 years ago

remove leading underscores in enums for _FloatNN and _Bool

  • Property mode set to 100644
File size: 5.4 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// Mangler.h --
8//
9// Author           : Richard C. Bilson
10// Created On       : Sun May 17 21:44:03 2015
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Thu Feb 14 08:12:17 2019
13// Update Count     : 25
14//
15
16#include "Mangler.h"
17#include "SynTree/Type.h"
18#include "SynTree/Declaration.h"
19
20namespace SymTab {
21        namespace Mangler {
22                namespace Encoding {
23                        const std::string manglePrefix = "_X";
24#if 0
25                        const std::string basicTypes[] = {
26                                "b",  // Bool
27                                "c",  // Char
28                                "a",  // SignedChar
29                                "h",  // UnsignedChar
30                                "s",  // ShortSignedInt
31                                "t",  // ShortUnsignedInt
32                                "i",  // SignedInt
33                                "j",  // UnsignedInt
34                                "l",  // LongSignedInt
35                                "m",  // LongUnsignedInt
36                                "x",  // LongLongSignedInt
37                                "y",  // LongLongUnsignedInt
38                                "f",  // Float
39                                "d",  // Double
40                                "e",  // LongDouble
41                                "Cf", // FloatComplex
42                                "Cd", // DoubleComplex
43                                "Ce", // LongDoubleComplex
44                                // Note: imaginary is not an overloadable type in C++
45                                // "If", // FloatImaginary
46                                // "Id", // DoubleImaginary
47                                // "Ie", // LongDoubleImaginary
48                                "n",  // SignedInt128
49                                "o",  // UnsignedInt128
50                                "Dq",  // Float80 -- TODO: itanium says Float80 and LongDouble both encode to "e", but doing this causes problems with constructing long double, because the cost tables are incorrect
51                                "g",  // Float128
52                                // "z", // ellipsis
53                                // "Dd" // # IEEE 754r decimal floating point (64 bits)
54                                // "De" // # IEEE 754r decimal floating point (128 bits)
55                                // "Df" // # IEEE 754r decimal floating point (32 bits)
56                                // "Dh" // # IEEE 754r half-precision floating point (16 bits)
57                                // "DF"N_ // # ISO/IEC TS 18661 binary floating point type _FloatN (N bits)
58                                // "Di" // char32_t
59                                // "Ds" // char16_t
60                        };
61                        static_assert(
62                                sizeof(basicTypes)/sizeof(basicTypes[0]) == BasicType::NUMBER_OF_BASIC_TYPES,
63                                "Each basic type kind should have a corresponding mangler letter"
64                        );
65#endif
66                        // GENERATED START, DO NOT EDIT
67                        // NOTES ON MANGLING:
68                        // * Itanium spec says that Float80 encodes to "e" (like LongDouble), but the distinct lengths cause resolution problems.
69                        // * Float128 is supposed to encode to "g", but I wanted it to mangle equal to LongDouble.
70                        // * Mangling for non-standard complex types is by best guess
71                        // * _FloatN is supposed to encode as "DF"N"_"; modified for same reason as above.
72                        // * unused mangling identifiers:
73                        //   - "z" ellipsis
74                        //   - "Dd" IEEE 754r 64-bit decimal floating point (borrowed for _Float32x)
75                        //   - "De" IEEE 754r 128-bit decimal floating point
76                        //   - "Df" IEEE 754r 32-bit decimal floating point
77                        //   - "Dh" IEEE 754r 16-bit decimal floating point (borrowed for _Float16)
78                        //   - "DF"N"_" ISO/IEC TS 18661 N-bit binary floating point (_FloatN)
79                        //   - "Di" char32_t
80                        //   - "Ds" char16_t
81                        const std::string basicTypes[BasicType::NUMBER_OF_BASIC_TYPES] = {
82                                "b",        // _Bool
83                                "c",        // char
84                                "a",        // signed char
85                                "h",        // unsigned char
86                                "s",        // signed short int
87                                "t",        // unsigned short int
88                                "i",        // signed int
89                                "j",        // unsigned int
90                                "l",        // signed long int
91                                "m",        // unsigned long int
92                                "x",        // signed long long int
93                                "y",        // unsigned long long int
94                                "n",        // __int128
95                                "o",        // unsigned __int128
96                                "DF16_",    // _Float16
97                                "CDF16_",   // _Float16 _Complex
98                                "DF32_",    // _Float32
99                                "CDF32_",   // _Float32 _Complex
100                                "f",        // float
101                                "Cf",       // float _Complex
102                                "DF32x_",   // _Float32x
103                                "CDF32x_",  // _Float32x _Complex
104                                "DF64_",    // _Float64
105                                "CDF64_",   // _Float64 _Complex
106                                "d",        // double
107                                "Cd",       // double _Complex
108                                "DF64x_",   // _Float64x
109                                "CDF64x_",  // _Float64x _Complex
110                                "Dq",       // __float80
111                                "DF128_",   // _Float128
112                                "CDF128_",  // _Float128 _Complex
113                                "g",        // __float128
114                                "e",        // long double
115                                "Ce",       // long double _Complex
116                                "DF128x_",  // _Float128x
117                                "CDF128x_", // _Float128x _Complex
118                        }; // basicTypes
119                        // GENERATED END
120
121                        const std::map<int, std::string> qualifiers = {
122                                { Type::Const, "K" },
123                                { Type::Volatile, "V" },
124                                { Type::Atomic, "DA" }, // A is array, so need something unique for atmoic. For now, go with multiletter DA
125                                { Type::Mutex, "X" },
126                                { Type::Lvalue, "L" },
127                        };
128
129                        const std::string void_t = "v";
130                        const std::string zero = "Z";
131                        const std::string one = "O";
132
133                        const std::string function = "F";
134                        const std::string tuple = "T";
135                        const std::string pointer = "P";
136                        const std::string array = "A";
137                        const std::string qualifiedTypeStart = "N";
138                        const std::string qualifiedTypeEnd = "E";
139
140                        const std::string forall = "Q";
141                        const std::string typeVariables[] = {
142                                "BD", // dtype
143                                "BF", // ftype
144                                "BT", // ttype
145                        };
146                        static_assert(
147                                sizeof(typeVariables)/sizeof(typeVariables[0]) == TypeDecl::NUMBER_OF_KINDS,
148                                "Each type variable kind should have a corresponding mangler prefix"
149                        );
150
151                        const std::string struct_t = "S";
152                        const std::string union_t = "U";
153                        const std::string enum_t = "M";
154                        const std::string type = "Y";
155
156                        const std::string autogen = "autogen__";
157                        const std::string intrinsic = "intrinsic__";
158                } // namespace Encoding
159        } // namespace Mangler
160} // namespace SymTab
Note: See TracBrowser for help on using the repository browser.