source: src/SymTab/ManglerCommon.cc@ 1b54b54

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr persistent-indexer pthread-emulation qualifiedEnum
Last change on this file since 1b54b54 was ada4575, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago

programmatically creation basic-type declarations

  • Property mode set to 100644
File size: 4.1 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 17:06:37 2019
13// Update Count : 26
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
25 // GENERATED START, DO NOT EDIT
26 // GENERATED BY BasicTypes-gen.cc
27 // NOTES ON MANGLING:
28 // * Itanium spec says that Float80 encodes to "e" (like LongDouble), but the distinct lengths cause resolution problems.
29 // * Float128 is supposed to encode to "g", but I wanted it to mangle equal to LongDouble.
30 // * Mangling for non-standard complex types is by best guess
31 // * _FloatN is supposed to encode as "DF"N"_"; modified for same reason as above.
32 // * unused mangling identifiers:
33 // - "z" ellipsis
34 // - "Dd" IEEE 754r 64-bit decimal floating point (borrowed for _Float32x)
35 // - "De" IEEE 754r 128-bit decimal floating point
36 // - "Df" IEEE 754r 32-bit decimal floating point
37 // - "Dh" IEEE 754r 16-bit decimal floating point (borrowed for _Float16)
38 // - "DF"N"_" ISO/IEC TS 18661 N-bit binary floating point (_FloatN)
39 // - "Di" char32_t
40 // - "Ds" char16_t
41 const std::string basicTypes[BasicType::NUMBER_OF_BASIC_TYPES] = {
42 "b", // _Bool
43 "c", // char
44 "a", // signed char
45 "h", // unsigned char
46 "s", // signed short int
47 "t", // unsigned short int
48 "i", // signed int
49 "j", // unsigned int
50 "l", // signed long int
51 "m", // unsigned long int
52 "x", // signed long long int
53 "y", // unsigned long long int
54 "n", // __int128
55 "o", // unsigned __int128
56 "DF16_", // _Float16
57 "CDF16_", // _Float16 _Complex
58 "DF32_", // _Float32
59 "CDF32_", // _Float32 _Complex
60 "f", // float
61 "Cf", // float _Complex
62 "DF32x_", // _Float32x
63 "CDF32x_", // _Float32x _Complex
64 "DF64_", // _Float64
65 "CDF64_", // _Float64 _Complex
66 "d", // double
67 "Cd", // double _Complex
68 "DF64x_", // _Float64x
69 "CDF64x_", // _Float64x _Complex
70 "Dq", // __float80
71 "DF128_", // _Float128
72 "CDF128_", // _Float128 _Complex
73 "g", // __float128
74 "e", // long double
75 "Ce", // long double _Complex
76 "DF128x_", // _Float128x
77 "CDF128x_", // _Float128x _Complex
78 }; // basicTypes
79 // GENERATED END
80 static_assert(
81 sizeof(basicTypes)/sizeof(basicTypes[0]) == BasicType::NUMBER_OF_BASIC_TYPES,
82 "Each basic type kind should have a corresponding mangler letter"
83 );
84
85 const std::map<int, std::string> qualifiers = {
86 { Type::Const, "K" },
87 { Type::Volatile, "V" },
88 { Type::Atomic, "DA" }, // A is array, so need something unique for atmoic. For now, go with multiletter DA
89 { Type::Mutex, "X" },
90 { Type::Lvalue, "L" },
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 "BF", // ftype
108 "BT", // ttype
109 };
110 static_assert(
111 sizeof(typeVariables)/sizeof(typeVariables[0]) == TypeDecl::NUMBER_OF_KINDS,
112 "Each type variable kind should have a corresponding mangler prefix"
113 );
114
115 const std::string struct_t = "S";
116 const std::string union_t = "U";
117 const std::string enum_t = "M";
118 const std::string type = "Y";
119
120 const std::string autogen = "autogen__";
121 const std::string intrinsic = "intrinsic__";
122 } // namespace Encoding
123 } // namespace Mangler
124} // namespace SymTab
Note: See TracBrowser for help on using the repository browser.