source: src/SymTab/ManglerCommon.cc @ 4285544e

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprno_listpersistent-indexerpthread-emulationqualifiedEnum
Last change on this file since 4285544e was 642bc83, checked in by Rob Schluntz <rschlunt@…>, 6 years ago

Modify name mangling scheme to more closely resembly itanium C++ name mangling

  • Property mode set to 100644
File size: 2.7 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 : Sat Jul 22 09:45:30 2017
13// Update Count     : 15
14//
15
16#include "Mangler.h"
17#include "SynTree/Type.h"
18
19namespace SymTab {
20        namespace Mangler {
21                namespace Encoding {
22                        const std::string manglePrefix = "_X";
23
24                        const std::string basicTypes[] = {
25                                "b",  // Bool
26                                "c",  // Char
27                                "a",  // SignedChar
28                                "h",  // UnsignedChar
29                                "s",  // ShortSignedInt
30                                "t",  // ShortUnsignedInt
31                                "i",  // SignedInt
32                                "j",  // UnsignedInt
33                                "l",  // LongSignedInt
34                                "m",  // LongUnsignedInt
35                                "x",  // LongLongSignedInt
36                                "y",  // LongLongUnsignedInt
37                                "f",  // Float
38                                "d",  // Double
39                                "e",  // LongDouble
40                                "Cf", // FloatComplex
41                                "Cd", // DoubleComplex
42                                "Ce", // LongDoubleComplex
43                                // Note: imaginary is not an overloadable type in C++
44                                "If", // FloatImaginary
45                                "Id", // DoubleImaginary
46                                "Ie", // LongDoubleImaginary
47                                "n",  // SignedInt128
48                                "o",  // UnsignedInt128
49                                "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
50                                "g",  // Float128
51                                // "z", // ellipsis
52                                // "Dd" // # IEEE 754r decimal floating point (64 bits)
53                                // "De" // # IEEE 754r decimal floating point (128 bits)
54                                // "Df" // # IEEE 754r decimal floating point (32 bits)
55                                // "Dh" // # IEEE 754r half-precision floating point (16 bits)
56                                // "DF"N_ // # ISO/IEC TS 18661 binary floating point type _FloatN (N bits)
57                                // "Di" // char32_t
58                                // "Ds" // char16_t
59                        };
60                        static_assert(
61                                sizeof(basicTypes)/sizeof(basicTypes[0]) == BasicType::NUMBER_OF_BASIC_TYPES,
62                                "Each basic type kind should have a corresponding mangler letter"
63                        );
64
65                        const std::map<int, std::string> qualifiers = {
66                                { Type::Const, "C" },
67                                { Type::Volatile, "V" },
68                                { Type::Atomic, "A" }, // A = Atomic, A0 = Array and forall parameter...
69                                { Type::Mutex, "M" },
70                                { Type::Lvalue, "L" },
71                        };
72
73                        const std::string voidType = "v";
74                        const std::string zero = "Z";
75                        const std::string one = "O";
76
77                        const std::string function = "F";
78                        const std::string tuple = "T";
79                        const std::string pointer = "P";
80                        const std::string array = "A";
81                        const std::string qualifiedTypeStart = "N";
82                        const std::string qualifiedTypeEnd = "E";
83
84                        const std::string autogen = "autogen__";
85                        const std::string intrinsic = "intrinsic__";
86                } // namespace Encoding
87        } // namespace Mangler
88} // namespace SymTab
Note: See TracBrowser for help on using the repository browser.