source: src/SymTab/ManglerCommon.cc @ 221c542e

Last change on this file since 221c542e was b0845f9, checked in by Andrew Beach <ajbeach@…>, 12 months ago

Reformating and clean-up in SymTab? directory.

  • Property mode set to 100644
File size: 3.9 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 Mangle {
22
23namespace Encoding {
24
25const std::string manglePrefix = "_X";
26
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
43const 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
82static_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);
86
87const 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};
93
94const std::string void_t = "v";
95const std::string zero = "Z";
96const std::string one = "O";
97
98const std::string function = "F";
99const std::string tuple = "T";
100const std::string pointer = "P";
101const std::string array = "A";
102const std::string qualifiedTypeStart = "N";
103const std::string qualifiedTypeEnd = "E";
104
105const std::string forall = "Q";
106const 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};
114static_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
119const std::string struct_t = "S";
120const std::string union_t = "U";
121const std::string enum_t = "M";
122const std::string type = "Y";
123
124const std::string autogen = "autogen__";
125const std::string intrinsic = "intrinsic__";
126
127} // namespace Encoding
128
129} // namespace Mangle
Note: See TracBrowser for help on using the repository browser.