source: src/SymTab/ManglerCommon.cc@ 50202fa

ADT arm-eh ast-experimental enum forall-pointer-decay jacob/cs343-translation new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since 50202fa was b66d14a, checked in by Peter A. Buhr <pabuhr@…>, 5 years ago

add new type kinds DStype and ALtype

  • Property mode set to 100644
File size: 4.2 KB
RevLine 
[d1e0979]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
[b66d14a]12// Last Modified On : Mon Jan 11 21:23:10 2021
13// Update Count : 29
[d1e0979]14//
15
16#include "Mangler.h"
17#include "SynTree/Type.h"
[0e73845]18#include "SynTree/Declaration.h"
[d1e0979]19
20namespace SymTab {
21 namespace Mangler {
[642bc83]22 namespace Encoding {
23 const std::string manglePrefix = "_X";
[ada4575]24
[e15853c]25 // GENERATED START, DO NOT EDIT
[6fd1955]26 // GENERATED BY BasicTypes-gen.cc
[cdcddfe1]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
[e15853c]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
[cdcddfe1]56 "DF16_", // _Float16
[e15853c]57 "CDF16_", // _Float16 _Complex
[cdcddfe1]58 "DF32_", // _Float32
[e15853c]59 "CDF32_", // _Float32 _Complex
60 "f", // float
61 "Cf", // float _Complex
[cdcddfe1]62 "DF32x_", // _Float32x
[e15853c]63 "CDF32x_", // _Float32x _Complex
[cdcddfe1]64 "DF64_", // _Float64
[e15853c]65 "CDF64_", // _Float64 _Complex
66 "d", // double
67 "Cd", // double _Complex
[cdcddfe1]68 "DF64x_", // _Float64x
[e15853c]69 "CDF64x_", // _Float64x _Complex
[cdcddfe1]70 "Dq", // __float80
71 "DF128_", // _Float128
[e15853c]72 "CDF128_", // _Float128 _Complex
[cdcddfe1]73 "g", // __float128
[e15853c]74 "e", // long double
75 "Ce", // long double _Complex
[cdcddfe1]76 "DF128x_", // _Float128x
[e15853c]77 "CDF128x_", // _Float128x _Complex
78 }; // basicTypes
79 // GENERATED END
[ada4575]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 );
[d1e0979]84
[642bc83]85 const std::map<int, std::string> qualifiers = {
[7804e2a]86 { Type::Const, "K" },
[642bc83]87 { Type::Volatile, "V" },
[90ed538]88 { Type::Atomic, "DA" }, // A is array, so need something unique for atmoic. For now, go with multiletter DA
[7804e2a]89 { Type::Mutex, "X" },
[642bc83]90 };
91
[7804e2a]92 const std::string void_t = "v";
[642bc83]93 const std::string zero = "Z";
94 const std::string one = "O";
95
96 const std::string function = "F";
97 const std::string tuple = "T";
98 const std::string pointer = "P";
99 const std::string array = "A";
100 const std::string qualifiedTypeStart = "N";
101 const std::string qualifiedTypeEnd = "E";
102
[0e73845]103 const std::string forall = "Q";
104 const std::string typeVariables[] = {
105 "BD", // dtype
[b66d14a]106 "BDS", // dtype + sized
[07de76b]107 "BO", // otype
[0e73845]108 "BF", // ftype
109 "BT", // ttype
[b66d14a]110 "BAL", // array length type
[0e73845]111 };
112 static_assert(
[b66d14a]113 sizeof(typeVariables) / sizeof(typeVariables[0]) == TypeDecl::NUMBER_OF_KINDS,
[0e73845]114 "Each type variable kind should have a corresponding mangler prefix"
115 );
116
[7804e2a]117 const std::string struct_t = "S";
118 const std::string union_t = "U";
119 const std::string enum_t = "M";
[d8cb7df]120 const std::string type = "Y";
[7804e2a]121
[642bc83]122 const std::string autogen = "autogen__";
123 const std::string intrinsic = "intrinsic__";
124 } // namespace Encoding
[d1e0979]125 } // namespace Mangler
126} // namespace SymTab
Note: See TracBrowser for help on using the repository browser.