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