View source code
Display the source code in dmd/backend/cgelem.d from which this page was generated on github.
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 local clone.

Module dmd.backend.cgelem

Local optimizations of elem trees

Compiler implementation of the D programming language.

Does strength reduction optimizations on the elem trees, i.e. rewriting trees to less expensive trees.


Coverage Add coverage tests to


doptelem(e, goal) Optimize and canonicalize an expression tree. Fiddle with double operators so that the rvalue is a pointer (this is needed by the 8086 code generator).
elddtor(e, goal) Handle OPddtor
elmsw(e, goal) Handle OPmsw.
elpair(e, goal) Handle OPpair, OPrpair.
elstruct(e, goal) See if we can replace struct operations with simpler ones. For OPstreq and OPstrpar.
postoptelem(e) Do optimizations after bltailrecursion() and before common subexpressions.
swaprel(op) Swap relational operators (like if we swapped the leaves).


Walter Bright


Boost License 1.0