Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - Community Discord
  - 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.e2ir

Converts expressions to Intermediate Representation (IR) for the backend.
Authors:
Walter Bright
License:
Boost License 1.0

Source e2ir.d

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

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

elem* `addressElem`(elem* `e`, Type `t`, bool `alwaysCopy` = false);
  Take address of an elem.
bool `elemIsLvalue`(elem* `e`);
  Return true if elem is a an lvalue. Lvalue elems are OPvar and OPind.
elem* `array_toPtr`(Type `t`, elem* `e`);
  Convert array to a pointer to the data.
  Parameters:

  Type `t` | array type
  elem* `e` | array to convert, it is "consumed" by the function

  Returns:
  e rebuilt into a pointer to the data
elem* `array_toDarray`(Type `t`, elem* `e`);
  Convert array to a dynamic array.
elem* `sarray_toDarray`(ref const Loc `loc`, Type `tfrom`, Type `tto`, elem* `e`);
elem* `getTypeInfo`(Loc `loc`, Type `t`, IRState* `irs`);
StructDeclaration `needsPostblit`(Type `t`);
  Determine if t is a struct that has postblit.
StructDeclaration `needsDtor`(Type `t`);
  Determine if t is a struct that has destructor.
void `clearStringTab`();
  Reset stringTab[] between object files being emitted, because the symbols are local.
elem* `toElemDtor`(Expression `e`, IRState* `irs`);
  Convert Expression to elem, then append destructors for any temporaries created in elem.
  Parameters:

  Expression `e` | Expression to convert
  IRState* `irs` | context

  Returns:
  generated elem tree
Symbol* `toStringSymbol`(const(char)* `str`, size_t `len`, size_t `sz`);
  Write read-only string to object file, create a local symbol for it. Makes a copy of str's contents, does not keep a reference to it.
  Parameters:

  const(char)* `str` | string
  size_t `len` | number of code units in string
  size_t `sz` | number of bytes per code unit

  Returns:
  Symbol
Symbol* `toStringSymbol`(StringExp `se`);
  Turn StringExp into Symbol.
elem* `buildArrayBoundsError`(IRState* `irs`, ref const Loc `loc`, elem* `lwr`, elem* `upr`, elem* `elength`);
  Construct elem to run when an array bounds check fails.
  Parameters:

  IRState* `irs` | to get function from
  Loc `loc` | to get file/line from
  elem* `lwr` | lower bound passed, if slice (array[lwr .. upr]). null otherwise.
  elem* `upr` | upper bound passed if slice (array[lwr .. upr]), index if not a slice (array[upr])
  elem* `elength` | length of array

  Returns:
  elem generated
void `toTraceGC`(IRState* `irs`, elem* `e`, ref const Loc `loc`);
  Replace call to GC allocator with call to tracing GC allocator.
  Parameters:

  IRState* `irs` | to get function from
  elem* `e` | elem to modify in place
  Loc `loc` | to get file/line from

elem* `callCAssert`(IRState* `irs`, ref const Loc `loc`, Expression `exp`, Expression `emsg`, const(char)* `str`);
  Generate call to C's assert failure function. One of exp, emsg, or str must not be null.
  Parameters:

  IRState* `irs` | context
  Loc `loc` | location to use for assert message
  Expression `exp` | if not null expression to test (not evaluated, but converted to a string)
  Expression `emsg` | if not null then informative message to be computed at run time
  const(char)* `str` | if not null then informative message string

  Returns:
  generated call
elem* `genHalt`(ref const Loc `loc`);
  Generate HALT instruction.
  Parameters:

  Loc `loc` | location to use for debug info

  Returns:
  generated instruction
bool `type_zeroCopy`(type* `t`);
  Determine if zero bits need to be copied for this backend type
  Parameters:

  type* `t` | backend type

  Returns:
  true if 0 bits
elem* `elAssign`(elem* `e1`, elem* `e2`, Type `t`, type* `tx`);
  Generate a copy from e2 to e1.
  Parameters:

  elem* `e1` | lvalue
  elem* `e2` | rvalue
  Type `t` | value type
  type* `tx` | if !null, then t converted to C type

  Returns:
  generated elem
elem* `setEthis2`(ref const Loc `loc`, IRState* `irs`, FuncDeclaration `fd`, elem* `ethis2`, elem** `ethis`, elem** `eside`);
  Initialize the dual-context array with the context pointers.
  Parameters:

  Loc `loc` | line and file of what line to show usage for
  IRState* `irs` | current context to get the second context from
  FuncDeclaration `fd` | the target function
  elem* `ethis2` | dual-context array
  elem** `ethis` | the first context
  elem** `eside` | where to store the assignment expressions

  Returns:
  `ethis2` if successful, null otherwise

Copyright © 1999-2020 by the D Language Foundation | Page generated by Ddoc on Thu Jun 11 11:23:13 2020