]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/d/dmd/target.h
d: Merge upstream dmd 47ed0330f
[thirdparty/gcc.git] / gcc / d / dmd / target.h
CommitLineData
b4c522fa
IB
1
2/* Compiler implementation of the D programming language
8e788ac6 3 * Copyright (C) 2013-2020 by The D Language Foundation, All Rights Reserved
b4c522fa
IB
4 * written by Iain Buclaw
5 * http://www.digitalmars.com
6 * Distributed under the Boost Software License, Version 1.0.
7 * http://www.boost.org/LICENSE_1_0.txt
8 * https://github.com/dlang/dmd/blob/master/src/dmd/target.h
9 */
10
11#pragma once
12
13// This file contains a data structure that describes a back-end target.
14// At present it is incomplete, but in future it should grow to contain
15// most or all target machine and target O/S specific information.
16#include "globals.h"
17#include "tokens.h"
18
19class ClassDeclaration;
20class Dsymbol;
21class Expression;
f9ab59ff 22class Parameter;
b4c522fa 23class Type;
a1ccbae6 24class TypeTuple;
b4c522fa
IB
25struct OutBuffer;
26
27struct Target
28{
29 static int ptrsize;
30 static int realsize; // size a real consumes in memory
31 static int realpad; // 'padding' added to the CPU real size to bring it up to realsize
32 static int realalignsize; // alignment for reals
33 static bool reverseCppOverloads; // with dmc and cl, overloaded functions are grouped and in reverse order
34 static bool cppExceptions; // set if catching C++ exceptions is supported
35 static int c_longsize; // size of a C 'long' or 'unsigned long' type
36 static int c_long_doublesize; // size of a C 'long double'
37 static int classinfosize; // size of 'ClassInfo'
38 static unsigned long long maxStaticDataSize; // maximum size of static data
39
40 template <typename T>
41 struct FPTypeProperties
42 {
43 static real_t max;
44 static real_t min_normal;
45 static real_t nan;
46 static real_t snan;
47 static real_t infinity;
48 static real_t epsilon;
49
50 static d_int64 dig;
51 static d_int64 mant_dig;
52 static d_int64 max_exp;
53 static d_int64 min_exp;
54 static d_int64 max_10_exp;
55 static d_int64 min_10_exp;
56 };
57
58 typedef FPTypeProperties<float> FloatProperties;
59 typedef FPTypeProperties<double> DoubleProperties;
60 typedef FPTypeProperties<real_t> RealProperties;
61
62 static void _init();
63 // Type sizes and support.
64 static unsigned alignsize(Type* type);
65 static unsigned fieldalign(Type* type);
66 static unsigned critsecsize();
67 static Type *va_listType(); // get type of va_list
68 static int isVectorTypeSupported(int sz, Type *type);
69 static bool isVectorOpSupported(Type *type, TOK op, Type *t2 = NULL);
70 // ABI and backend.
71 static const char *toCppMangle(Dsymbol *s);
72 static const char *cppTypeInfoMangle(ClassDeclaration *cd);
73 static const char *cppTypeMangle(Type *t);
74 static Type *cppParameterType(Parameter *p);
c9634470 75 static bool cppFundamentalType(const Type *t, bool& isFundamental);
b4c522fa 76 static LINK systemLinkage();
a1ccbae6 77 static TypeTuple *toArgTypes(Type *t);
b4c522fa 78};