source: src/SymTab/ManglerCommon.cc @ c6b4432

Last change on this file since c6b4432 was 4ac402d, checked in by Andrew Beach <ajbeach@…>, 7 months ago

Added a missing include (not sure how that slipped through) and did some other replacements so the new ast is the source of constants.

  • Property mode set to 100644
File size: 4.2 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 : Mon Jan 11 21:23:10 2021
13// Update Count     : 29
14//
15
16#include "Mangler.h"
17
18#include "AST/Decl.hpp"
19#include "AST/Type.hpp"
20
21namespace SymTab {
22        namespace Mangler {
23                namespace Encoding {
24                        const std::string manglePrefix = "_X";
25
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                        );
85
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                        };
92
93                        const std::string void_t = "v";
94                        const std::string zero = "Z";
95                        const std::string one = "O";
96
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";
103
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                        );
117
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";
122
123                        const std::string autogen = "autogen__";
124                        const std::string intrinsic = "intrinsic__";
125                } // namespace Encoding
126        } // namespace Mangler
127} // namespace SymTab
Note: See TracBrowser for help on using the repository browser.