Home | History | Annotate | Line # | Download | only in dmd
target.h revision 1.1.1.2
      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.1.2  mrg class TypeTuple;
     25      1.1  mrg struct OutBuffer;
     26      1.1  mrg 
     27      1.1  mrg struct Target
     28      1.1  mrg {
     29      1.1  mrg     static int ptrsize;
     30      1.1  mrg     static int realsize;             // size a real consumes in memory
     31      1.1  mrg     static int realpad;              // 'padding' added to the CPU real size to bring it up to realsize
     32      1.1  mrg     static int realalignsize;        // alignment for reals
     33      1.1  mrg     static bool reverseCppOverloads; // with dmc and cl, overloaded functions are grouped and in reverse order
     34      1.1  mrg     static bool cppExceptions;       // set if catching C++ exceptions is supported
     35      1.1  mrg     static int c_longsize;           // size of a C 'long' or 'unsigned long' type
     36      1.1  mrg     static int c_long_doublesize;    // size of a C 'long double'
     37      1.1  mrg     static int classinfosize;        // size of 'ClassInfo'
     38      1.1  mrg     static unsigned long long maxStaticDataSize;  // maximum size of static data
     39      1.1  mrg 
     40      1.1  mrg     template <typename T>
     41      1.1  mrg     struct FPTypeProperties
     42      1.1  mrg     {
     43      1.1  mrg         static real_t max;
     44      1.1  mrg         static real_t min_normal;
     45      1.1  mrg         static real_t nan;
     46      1.1  mrg         static real_t snan;
     47      1.1  mrg         static real_t infinity;
     48      1.1  mrg         static real_t epsilon;
     49      1.1  mrg 
     50      1.1  mrg         static d_int64 dig;
     51      1.1  mrg         static d_int64 mant_dig;
     52      1.1  mrg         static d_int64 max_exp;
     53      1.1  mrg         static d_int64 min_exp;
     54      1.1  mrg         static d_int64 max_10_exp;
     55      1.1  mrg         static d_int64 min_10_exp;
     56      1.1  mrg     };
     57      1.1  mrg 
     58      1.1  mrg     typedef FPTypeProperties<float> FloatProperties;
     59      1.1  mrg     typedef FPTypeProperties<double> DoubleProperties;
     60      1.1  mrg     typedef FPTypeProperties<real_t> RealProperties;
     61      1.1  mrg 
     62      1.1  mrg     static void _init();
     63      1.1  mrg     // Type sizes and support.
     64      1.1  mrg     static unsigned alignsize(Type* type);
     65      1.1  mrg     static unsigned fieldalign(Type* type);
     66      1.1  mrg     static unsigned critsecsize();
     67      1.1  mrg     static Type *va_listType();  // get type of va_list
     68      1.1  mrg     static int isVectorTypeSupported(int sz, Type *type);
     69      1.1  mrg     static bool isVectorOpSupported(Type *type, TOK op, Type *t2 = NULL);
     70      1.1  mrg     // ABI and backend.
     71      1.1  mrg     static const char *toCppMangle(Dsymbol *s);
     72      1.1  mrg     static const char *cppTypeInfoMangle(ClassDeclaration *cd);
     73      1.1  mrg     static const char *cppTypeMangle(Type *t);
     74      1.1  mrg     static Type *cppParameterType(Parameter *p);
     75      1.1  mrg     static bool cppFundamentalType(const Type *t, bool& isFundamental);
     76      1.1  mrg     static LINK systemLinkage();
     77  1.1.1.2  mrg     static TypeTuple *toArgTypes(Type *t);
     78      1.1  mrg };
     79