Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Forums
  - IRC
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Donate
- Resources
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - 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.toir

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

Source: toir.d

Documentation:

https: //dlang.org/phobos/dmd_toir.html

Coverage:

https: //codecov.io/gh/dlang/dmd/src/master/src/dmd/`toir`.d

elem* `incUsageElem`(IRState* `irs`, ref const Loc `loc`);
  Produce elem which increments the usage count for a particular line. Sets corresponding bit in bitmap m.covb[linnum]. Used to implement -cov switch (coverage analysis).
  Parameters:

  IRState* `irs` | context
  Loc `loc` | line and file of what line to show usage for

  Returns:
  elem that increments the line count

  References:

  https: //dlang.org/dmd-windows.html#switch-cov

elem* `getEthis`(Loc `loc`, IRState* `irs`, Dsymbol `fd`);
  Return elem that evaluates to the static frame pointer for function `fd`. If `fd` is a member function, the returned expression will compute the value of `fd`'s 'this' variable. This routine is critical for implementing nested functions.
elem* `setEthis`(Loc `loc`, IRState* `irs`, elem* `ey`, AggregateDeclaration `ad`);
  Initialize the hidden aggregate member, vthis, with the context pointer.
  Returns:
  *(`ey` + `ad`.vthis.offset) = this;
int `intrinsic_op`(FuncDeclaration `fd`);
  Convert intrinsic function to operator. Returns that operator, -1 if not an intrinsic function.
elem* `resolveLengthVar`(VarDeclaration `lengthVar`, elem** `pe`, Type `t1`);
  Given an expression e that is an array, determine and set the 'length' variable.

  Input: `lengthVar` Symbol of 'length' variable &e expression that is the array `t1` Type of the array

  Output: e is rewritten to avoid side effects

  Returns:
  expression that initializes 'length'
void `setClosureVarOffset`(FuncDeclaration `fd`);
  Go through the variables in function `fd` that are to be allocated in a closure, and set the .offset fields for those variables to their positions relative to the start of the closure instance. Also turns off nrvo for closure variables.
  Parameters:

  FuncDeclaration `fd` | function

void `buildClosure`(FuncDeclaration `fd`, IRState* `irs`);
  Closures are implemented by taking the local variables that need to survive the scope of the function, and copying them into a gc allocated chuck of memory. That chunk, called the closure here, is inserted into the linked list of stack frames instead of the usual stack frame.
  `buildClosure`() inserts code just after the function prolog is complete. It allocates memory for the closure, allocates a local variable (sclosure) to point to it, inserts into it the link to the enclosing frame, and copies into it the parameters that are referred to in nested functions. In VarExp::toElem and SymOffExp::toElem, when referring to a variable that is in a closure, takes the offset from sclosure rather than from the frame pointer.
  getEthis() and NewExp::toElem need to use sclosure, if set, rather than the current frame pointer.
RET `retStyle`(TypeFunction `tf`);
  Determine return style of function - whether in registers or through a hidden pointer to the caller's stack.

Copyright © 1999-2018 by the D Language Foundation | Page generated by Ddoc on Tue Jan 2 20:54:59 2018