# dmd.backend.dt

Compiler implementation of the D programming language.

#### Authors

Walter Bright

#### License

Boost License 1.0

Source: https://github.com/dlang/dmd/blob/master/src/dmd/backend/dt.d

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

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

- `dt_free`

  #### Declaration

  `nothrow @nogc @trusted void `dt_free`(dt_t* `dt`);`

  Free a data definition struct.

- `dt_term`

  #### Declaration

  `nothrow @nogc @safe void `dt_term`();`

  Free free list.

- `dtpatchoffset`

  #### Declaration

  `nothrow @nogc @safe void `dtpatchoffset`(dt_t* `dt`, uint `offset`);`

- `init_common`

  #### Declaration

  `nothrow @nogc @trusted void `init_common`(Symbol* `s`);`

  Make a common block for `s`.

- `dt_size`

  #### Declaration

  `nothrow @nogc @trusted uint `dt_size`(const(dt_t)* `dtstart`);`

  Compute size of a dt

- `dtallzeros`

  #### Declaration

  `nothrow @nogc @safe bool `dtallzeros`(const(dt_t)* `dt`);`

  Return `true` if `dt` is all zeros.

- `dtpointers`

  #### Declaration

  `nothrow @nogc @safe bool `dtpointers`(const(dt_t)* `dtstart`);`

  Return `true` if dt contains pointers (requires relocations).

- `dt2common`

  #### Declaration

  `nothrow @nogc @safe void `dt2common`(dt_t** `pdt`);`

  Turn DT_azeros into DTcommon

- `DtBuilder`

  #### Declaration

  `struct `DtBuilder`;`

  - `checkInitialized`

    #### Declaration

    `nothrow @nogc @safe void `checkInitialized`();`

    Useful for checking if DtBuilder got initialized.

  - `print`

    #### Declaration

    `nothrow @nogc @safe void `print`();`

    Print state of DtBuilder for debugging.

  - `finish`

    #### Declaration

    `nothrow @nogc @safe dt_t* `finish`();`

    Finish and return completed data structure.

  - `nbytes`

    #### Declaration

    `nothrow @nogc @trusted void `nbytes`(uint `size`, const(char)* `ptr`);`

    Append data represented by `ptr`[0..`size`]

  - `abytes`

    #### Declaration

    `nothrow @nogc @trusted void `abytes`(tym_t `ty`, uint `offset`, uint `size`, const(char)* `ptr`, uint `nzeros`, ubyte `_align`);`

    Write a reference to the data `ptr`[0..`size`+`nzeros`]

    #### Parameters

    `tym_t `ty`` | pointer type
    `uint `offset`` | to be added to `offset` of data generated
    `uint `size`` | number of bytes pointed to by `ptr`
    `const(char)* `ptr`` | points to data bytes
    `uint `nzeros`` | number of zero bytes to add to the end
    `ubyte `_align`` | alignment of pointed-to data

  - `dword`

    #### Declaration

    `nothrow @nogc @trusted void `dword`(int `value`);`

    Write 4 bytes of `value`.

  - `size`

    #### Declaration

    `nothrow @nogc @trusted void `size`(ulong `value`);`

    Write a size_t `value`.

  - `nzeros`

    #### Declaration

    `nothrow @nogc @safe void `nzeros`(uint `size`);`

    Write a bunch of zeros

  - `xoff`

    #### Declaration

    `nothrow @nogc @trusted void `xoff`(Symbol* `s`, uint `offset`, tym_t `ty`);`

    Write a reference to `s`+`offset`

  - `xoff`

    #### Declaration

    `nothrow @nogc @safe void `xoff`(Symbol* `s`, uint `offset`);`

    Create reference to `s`+`offset`

  - `xoffpatch`

    #### Declaration

    `nothrow @nogc @trusted dt_t* `xoffpatch`(Symbol* `s`, uint `offset`, tym_t `ty`);`

    Like xoff(), but returns handle with which to patch '`offset`' value.

  - `dtoff`

    #### Declaration

    `nothrow @nogc @trusted Symbol* `dtoff`(dt_t* `dt`, uint `offset`);`

    Create a reference to another `dt`.

    #### Return Value

    the internal symbol used for the other `dt`

  - `coff`

    #### Declaration

    `nothrow @nogc @trusted void `coff`(uint `offset`);`

    Write reference to `offset` in code segment.

  - `cat`

    #### Declaration

    `nothrow @nogc @safe void `cat`(dt_t* `dt`);`

    Append `dt` to data.

  - `cat`

    #### Declaration

    `nothrow @nogc @safe void `cat`(ref DtBuilder `dtb`);`

    Append `dtb` to data.

  - `repeat`

    #### Declaration

    `nothrow @nogc @trusted void `repeat`(dt_t* `dt`, size_t `count`);`

    Repeat a list of dt_t's `count` times.

  - `length`

    #### Declaration

    `nothrow @nogc @safe uint `length`();`

    Return size of data.

  - `isZeroLength`

    #### Declaration

    `nothrow @nogc @safe bool `isZeroLength`();`

    Return `true` if size of data is 0.

- `dt_get_nzeros`

  #### Declaration

  `nothrow @nogc @safe dt_t* `dt_get_nzeros`(uint `n`);`

  Temporary hack to initialize a dt_t* for C.