Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# dmd.target

Compiler implementation of the D programming language.
Authors:
Walter Bright
License:
Boost License 1.0

Source target.d

Documentation https://dlang.org/phobos/dmd_target.html

Coverage https://codecov.io/gh/dlang/dmd/src/master/src/dmd/target.d

struct `Target`;
  Describes a back-end target. At present it is incomplete, but in the future it should grow to contain most or all target machine and target O/S specific information.
  In many cases, calls to sizeof() can't be used directly for getting data type sizes since cross compiling is supported and would end up using the host sizes rather than the target sizes.
  uint `ptrsize`;
    size of a pointer in bytes
  uint `realsize`;
    size a real consumes in memory
  uint `realpad`;
    padding added to the CPU real size to bring it up to realsize
  uint `realalignsize`;
    alignment for reals
  uint `classinfosize`;
    size of ClassInfo
  ulong `maxStaticDataSize`;
    maximum size of static data
  uint `c_longsize`;
    size of a C long or unsigned long type
  uint `c_long_doublesize`;
    size of a C long double
  bool `reverseCppOverloads`;
    set if overloaded functions are grouped and in reverse order (such as in dmc and cl)
  bool `cppExceptions`;
    set if catching C++ exceptions is supported
  bool `twoDtorInVtable`;
    target C++ ABI puts deleting and non-deleting destructor into vtable
  struct `FPTypeProperties`(T);
    Values representing all properties for floating point types
    real_t `max`;
      largest representable value that's not infinity
    real_t `min_normal`;
      smallest representable normalized value that's not 0
    real_t `nan`;
      NaN value
    real_t `snan`;
      signalling NaN value
    real_t `infinity`;
      infinity value
    real_t `epsilon`;
      smallest increment to the value 1
    d_int64 `dig`;
      number of decimal digits of precision
    d_int64 `mant_dig`;
      number of bits in mantissa
    d_int64 `max_exp`;
      maximum int value such that 2 `max_exp`-1 is representable
    d_int64 `min_exp`;
      minimum int value such that 2 `min_exp`-1 is representable as a normalized value
    d_int64 `max_10_exp`;
      maximum int value such that 10 `max_10_exp` is representable
    d_int64 `min_10_exp`;
      minimum int value such that 10 `min_10_exp` is representable as a normalized value
  alias `FloatProperties` = .Target.FPTypeProperties!float.FPTypeProperties;
  alias `DoubleProperties` = .Target.FPTypeProperties!double.FPTypeProperties;
  alias `RealProperties` = .Target.FPTypeProperties!real.FPTypeProperties;
  static void `_init`();
    Initialize the Target
  static uint `alignsize`(Type `type`);
    Requested target memory alignment size of the given type.
    Parameters:

    Type `type` | type to inspect

    Returns:
    alignment in bytes
  static uint `fieldalign`(Type `type`);
    Requested target field alignment size of the given type.
    Parameters:

    Type `type` | type to inspect

    Returns:
    alignment in bytes
  static uint `critsecsize`();
    Size of the target OS critical section.
    Returns:
    size in bytes
  static Type `va_listType`();
    Type for the va_list type for the target.

    NOTE For Posix/x86_64 this returns the type which will really be used for passing an argument of type va_list.

    Returns:
    Type that represents va_list.
  static int `isVectorTypeSupported`(int `sz`, Type `type`);
    Checks whether the target supports a vector type.
    Parameters:

    int `sz` | vector type size in bytes
    Type `type` | vector element type

    Returns:
    0 vector type is supported, 1 vector type is not supported on the target at all 2 vector element type is not supported 3 vector size is not supported
  static bool `isVectorOpSupported`(Type `type`, TOK `op`, Type `t2` = null);
    Checks whether the target supports the given operation for vectors.
    Parameters:

    Type `type` | target type of operation
    TOK `op` | the unary or binary op being done on the `type`
    Type `t2` | type of second operand if `op` is a binary operation

    Returns:
    true if the operation is supported or type is not a vector
  static Expression `paintAsType`(Expression `e`, Type `type`);
    Encode the given expression, which is assumed to be an rvalue literal as another type for use in CTFE. This corresponds roughly to the idiom *cast(T*)&`e`.
    Parameters:

    Expression `e` | literal constant expression
    Type `type` | target type of the result

    Returns:
    resulting Expression re-evaluated as `type`
  static void `loadModule`(Module `m`);
    Perform any post parsing analysis on the given module. Certain compiler backends (ie: GDC) have special placeholder modules whose source are empty, but code gets injected immediately after loading.
    Parameters:

    Module `m` | module to inspect

  static const(char)* `toCppMangle`(Dsymbol `s`);
    Mangle the given symbol for C++ ABI.
    Parameters:

    Dsymbol `s` | declaration with C++ linkage

    Returns:
    string mangling of symbol
  static const(char)* `cppTypeInfoMangle`(ClassDeclaration `cd`);
    Get RTTI mangling of the given class declaration for C++ ABI.
    Parameters:

    ClassDeclaration `cd` | class with C++ linkage

    Returns:
    string mangling of C++ typeinfo
  static const(char)* `cppTypeMangle`(Type `t`);
    Gets vendor-specific type mangling for C++ ABI.
    Parameters:

    Type `t` | type to inspect

    Returns:
    string if type is mangled specially on target null if unhandled
  static Type `cppParameterType`(Parameter `p`);
    Get the type that will really be used for passing the given argument to an extern(C++) function.
    Parameters:

    Parameter `p` | parameter to be passed.

    Returns:
    Type to use for parameter `p`.
  static LINK `systemLinkage`();
    Default system linkage for the target.
    Returns:
    LINK to use for extern(System)
  static TypeTuple `toArgTypes`(Type `t`);
    Describes how an argument type is passed to a function on target.
    Parameters:

    Type `t` | type to break down

    Returns:
    tuple of types if type is passed in one or more registers empty tuple if type is always passed on the stack
  static bool `isReturnOnStack`(TypeFunction `tf`, bool `needsThis`);
    Determine return style of function - whether in registers or through a hidden pointer to the caller's stack.
    Parameters:

    TypeFunction `tf` | function type to check
    bool `needsThis` | true if the function type is for a non-static member function

    Returns:
    true if return value from function is on the stack
  static ulong `parameterSize`(ref const Loc `loc`, Type `t`);
    Determine the size a value of type `t` will be when it is passed on the function parameter stack.
    Parameters:

    Loc `loc` | location to use for error messages
    Type `t` | type of parameter

    Returns:
    size used on parameter stack

Copyright © 1999-2018 by the D Language Foundation | Page generated by Ddoc on Sat Sep 1 19:49:32 2018