dmd.backend.goh

Global optimizer declarations

Compiler implementation of the D programming language.

Members

Aliases

mftype
alias mftype = uint

Bit masks for various optimizations.

Functions

blockinit (from dmd.backend.gloop)
bool blockinit() via public import dmd.backend.gloop : blockinit, compdom, loopopt, updaterd;

Initialize block information.

boolopt (from dmd.backend.gdag)
void boolopt() via public import dmd.backend.gdag : builddags, boolopt;

Do optimizations based on if we know an expression is 0 or !=0, even though we don't know anything else.

builddags (from dmd.backend.gdag)
void builddags() via public import dmd.backend.gdag : builddags, boolopt;

Build DAGs (basically find all the common subexpressions). Must be done after all other optimizations, because most of them depend on the trees being trees, not DAGs. The general strategy is: Compute available expressions (AEs) For each block stick together nodes that match, keeping AEs up to date For each block unstick unprofitable common subexpressions (this is generally target-dependent)

compdom (from dmd.backend.gloop)
void compdom(block*[] dfo) via public import dmd.backend.gloop : blockinit, compdom, loopopt, updaterd;
Undocumented in source.
constprop (from dmd.backend.gother)
void constprop() via public import dmd.backend.gother : constprop, copyprop, rmdeadass, elimass, deadvar, verybusyexp, listrds;

Constant propagation. Also detects use of variable before any possible def.

copyprop (from dmd.backend.gother)
void copyprop() via public import dmd.backend.gother : constprop, copyprop, rmdeadass, elimass, deadvar, verybusyexp, listrds;

Do copy propagation. Copy propagation elems are of the form OPvar=OPvar, and they are in go.expnod[].

deadvar (from dmd.backend.gother)
void deadvar() via public import dmd.backend.gother : constprop, copyprop, rmdeadass, elimass, deadvar, verybusyexp, listrds;

Mark all dead variables. Only worry about register candidates. Compute live ranges for register candidates. Be careful not to compute live ranges for members of structures (CLMOS).

elimass (from dmd.backend.gother)
void elimass(elem* n) via public import dmd.backend.gother : constprop, copyprop, rmdeadass, elimass, deadvar, verybusyexp, listrds;

Remove side effect of assignment elem.

flowae (from dmd.backend.gflow)
void flowae() via public import dmd.backend.gflow : flowrd, flowlv, flowvbe, flowcp, flowae, genkillae;

Compute available expressions (AEs). That is, expressions whose result is still current. Bin = the set of AEs reaching the beginning of B. Bout = the set of AEs reaching the end of B.

flowcp (from dmd.backend.gflow)
void flowcp() via public import dmd.backend.gflow : flowrd, flowlv, flowvbe, flowcp, flowae, genkillae;

Compute copy propagation info (CPs). Very similar to AEs (the same code is used). Using RDs for copy propagation is WRONG! That is, set of copy statements still valid. Bin = the set of CPs reaching the beginning of B. Bout = the set of CPs reaching the end of B.

flowlv (from dmd.backend.gflow)
void flowlv() via public import dmd.backend.gflow : flowrd, flowlv, flowvbe, flowcp, flowae, genkillae;

Do live variable analysis (LVs). A variable is 'live' at some point if there is a subsequent use of it before a redefinition. Binlv = the set of variables live at the beginning of B. Boutlv = the set of variables live at the end of B. Bgen = set of variables used before any definition in B. Bkill = set of variables unambiguously defined before any use in B. Note that Bgen & Bkill = 0.

flowrd (from dmd.backend.gflow)
void flowrd() via public import dmd.backend.gflow : flowrd, flowlv, flowvbe, flowcp, flowae, genkillae;

Compute reaching definitions (RDs). That is, for each block B and each program variable X find all elems that could be the last elem that defines X along some path to B. Binrd = the set of defs reaching the beginning of B. Boutrd = the set of defs reaching the end of B. Bkillrd = set of defs that are killed by some def in B. Bgenrd = set of defs in B that reach the end of B.

flowvbe (from dmd.backend.gflow)
void flowvbe() via public import dmd.backend.gflow : flowrd, flowlv, flowvbe, flowcp, flowae, genkillae;

Compute very busy expressions(VBEs). That is,expressions that are evaluated along separate paths. Bin = the set of VBEs at the beginning of B. Bout = the set of VBEs at the end of B. Bgen = set of expressions X+Y such that X+Y is evaluated before any def of X or Y. Bkill = set of expressions X+Y such that X or Y could be defined before X+Y is computed. Note that gen and kill are mutually exclusive.

genkillae (from dmd.backend.gflow)
void genkillae() via public import dmd.backend.gflow : flowrd, flowlv, flowvbe, flowcp, flowae, genkillae;

Compute GEN and KILL vectors only for AEs. defkill and starkill are assumed to be already set up correctly. go.expnod[] is assumed to be set up correctly.

listrds (from dmd.backend.gother)
void listrds(vec_t IN, elem* e, vec_t f, Barray!(elem*)* rdlist) via public import dmd.backend.gother : constprop, copyprop, rmdeadass, elimass, deadvar, verybusyexp, listrds;

Find all the reaching defs of OPvar e.

localize (from dmd.backend.glocal)
void localize() via public import dmd.backend.glocal : localize;

////////////////////////////

loopopt (from dmd.backend.gloop)
void loopopt() via public import dmd.backend.gloop : blockinit, compdom, loopopt, updaterd;

Loop invariant and induction variable elimination. Input: iter which optimization iteration we are on

rmdeadass (from dmd.backend.gother)
void rmdeadass() via public import dmd.backend.gother : constprop, copyprop, rmdeadass, elimass, deadvar, verybusyexp, listrds;
Undocumented in source.
sliceStructs (from dmd.backend.gsroa)
void sliceStructs(symtab_t symtab, block* startblock) via public import dmd.backend.gsroa : sliceStructs;
Undocumented in source.
updaterd (from dmd.backend.gloop)
void updaterd(elem* n, vec_t GEN, vec_t KILL) via public import dmd.backend.gloop : blockinit, compdom, loopopt, updaterd;

Update rd vector. Input: n assignment elem or function call elem or OPasm elem rd reaching def vector to update (clear bits for defs we kill, set bit for n (which is the def we are genning)) vecdim go.defnod.length

verybusyexp (from dmd.backend.gother)
void verybusyexp() via public import dmd.backend.gother : constprop, copyprop, rmdeadass, elimass, deadvar, verybusyexp, listrds;
Undocumented in source.

Static variables

go (from dmd.backend.var)
GlobalOptimizer go; via public import dmd.backend.var : go;
Undocumented in source.

Structs

DefNode
struct DefNode

Definition elem vector, used for reaching definitions.

Meta

License

Distributed under the Boost Software License, Version 1.0. https://www.boost.org/LICENSE_1_0.txt