View source code
Display the source code in dmd/backend/cgcod.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.cgcod

Compiler implementation of the D programming language.

Coverage

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

Functions

NameDescription
alignsection(base, alignment, bias) Align sections on the stack. base negative offset of section from frame pointer alignment alignment to use bias difference between where frame pointer points and the STACKALIGNed part of the stack
alignsection(base, alignment, bias) Align sections on the stack. base negative offset of section from frame pointer alignment alignment to use bias difference between where frame pointer points and the STACKALIGNed part of the stack
allocreg(cdb, pretregs, preg, tym) Allocate some registers.
allocreg(cdb, pretregs, preg, tym) Allocate some registers.
andregcon(pregconsave) For elems in regcon that don't match regconsave, clear the corresponding bit in regcon.cse.mval. Do same for regcon.immed.
andregcon(pregconsave) For elems in regcon that don't match regconsave, clear the corresponding bit in regcon.cse.mval. Do same for regcon.immed.
autosort_cmp(ps1, ps2) Predicate for sorting auto symbols for qsort().
autosort_cmp(ps1, ps2) Predicate for sorting auto symbols for qsort().
cgcod_eh() Add in exception handling code.
cgcod_eh() Add in exception handling code.
codgen(sfunc) Generate code for a function. Note at the end of this routine mfuncreg will contain the mask of registers not affected by the function. Some minor optimization possibilities are here.
codgen(sfunc) Generate code for a function. Note at the end of this routine mfuncreg will contain the mask of registers not affected by the function. Some minor optimization possibilities are here.
cse_flush(cdb, do87) Flush all CSE's out of registers and into memory.
cse_flush(cdb, do87) Flush all CSE's out of registers and into memory.
cssave(e, regm, opsflag) Common subexpressions exist in registers. Note this in regcon.cse.mval.
cssave(e, regm, opsflag) Common subexpressions exist in registers. Note this in regcon.cse.mval.
docommas(cdb, pe) Scan down comma-expressions.
docommas(cdb, pe) Scan down comma-expressions.
evalinregister(e) Determine if a computation should be done into a register.
evalinregister(e) Determine if a computation should be done into a register.
findreg(regm) Given a register mask, find and return the number of the first register that fits.
findreg(regm) Given a register mask, find and return the number of the first register that fits.
freenode(e) Free element (but not it's leaves! (assume they are already freed)) Don't decrement Ecount! This is so we can detect if the common subexp has already been evaluated. If common subexpression is not required anymore, eliminate references to it.
freenode(e) Free element (but not it's leaves! (assume they are already freed)) Don't decrement Ecount! This is so we can detect if the common subexp has already been evaluated. If common subexpression is not required anymore, eliminate references to it.
getregs(cdb, r) We are going to use the registers in mask r. Generate any code necessary to save any regs.
getregs(cdb, r) We are going to use the registers in mask r. Generate any code necessary to save any regs.
getregs_imm(cdb, r) Getregs without marking immediate register values as gone.
getregs_imm(cdb, r) Getregs without marking immediate register values as gone.
getregsNoSave(r) We are going to use the registers in mask r. Same as getregs(), but assert if code is needed to be generated.
getregsNoSave(r) We are going to use the registers in mask r. Same as getregs(), but assert if code is needed to be generated.
getscratch() Return mask of scratch registers.
getscratch() Return mask of scratch registers.
isregvar(e, pregm, preg) Determine if elem e is a register variable. If so: *pregm = mask of registers that make up the variable *preg = the least significant register returns true Else returns false
isregvar(e, pregm, preg) Determine if elem e is a register variable. If so: *pregm = mask of registers that make up the variable *preg = the least significant register returns true Else returns false
lpadregs() Determine registers that should be destroyed upon arrival to code entry point for exception handling.
lpadregs() Determine registers that should be destroyed upon arrival to code entry point for exception handling.
numbitsset(regm) Count the number of bits set in a register mask.
numbitsset(regm) Count the number of bits set in a register mask.
prolog(cdb) Generate code for a function start.
prolog(cdb) Generate code for a function start.
regm_str(rm) Turn register mask into a string suitable for printing.
regm_str(rm) Turn register mask into a string suitable for printing.
scodelem(cdb, e, pretregs, keepmsk, constflag) Same as codelem(), but do not destroy the registers in keepmsk. Use scratch registers as much as possible, then use stack.
scodelem(cdb, e, pretregs, keepmsk, constflag) Same as codelem(), but do not destroy the registers in keepmsk. Use scratch registers as much as possible, then use stack.
stackoffsets(flags) Compute offsets for remaining tmp, automatic and register variables that did not make it into registers.
stackoffsets(flags) Compute offsets for remaining tmp, automatic and register variables that did not make it into registers.
useregs(regm) Mark registers as used.
useregs(regm) Mark registers as used.

Manifest constants

NameTypeDescription
CSEload Table of common subexpressions stored on the stack. csextab[] array of info on saved CSEs CSEpe pointer to saved elem CSEregm mask of register that was saved (so for multi- register variables we know which part we have)
CSEload Table of common subexpressions stored on the stack. csextab[] array of info on saved CSEs CSEpe pointer to saved elem CSEregm mask of register that was saved (so for multi- register variables we know which part we have)

Global variables

NameTypeDescription
msavereg uint Register masks.
msavereg uint Register masks.
stackpush uint # of bytes that SP is beyond BP.
stackpush uint # of bytes that SP is beyond BP.

Authors

Walter Bright

License

Boost License 1.0