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

Compiler implementation of the D programming language.

Coverage

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

Functions

NameDescription
assignaddr(bl) Take symbol info in union ev and replace it with a real address in Vpointer.
assignaddr(bl) Take symbol info in union ev and replace it with a real address in Vpointer.
branch(bl, flag) Replace JMPs in Bgotocode with JMP SHORTs whereever possible. This routine depends on FLcode jumps to only be forward referenced. BFLjmpoptdone is set to true if nothing more can be done with this block.
branch(bl, flag) Replace JMPs in Bgotocode with JMP SHORTs whereever possible. This routine depends on FLcode jumps to only be forward referenced. BFLjmpoptdone is set to true if nothing more can be done with this block.
calcblksize(c) Calculate bl.Bsize.
calcblksize(c) Calculate bl.Bsize.
calccodsize(c) Calculate and return code size of a code. Note that NOPs are sometimes used as markers, but are never output. LINNUMs are never output.
calccodsize(c) Calculate and return code size of a code. Note that NOPs are sometimes used as markers, but are never output. LINNUMs are never output.
cdframeptr(cdb, e, pretregs) Gen code for OPframeptr
cdframeptr(cdb, e, pretregs) Gen code for OPframeptr
cdgot(cdb, e, pretregs) Gen code for load of GLOBAL_OFFSET_TABLE_. This value gets cached in the local variable 'localgot'.
cdgot(cdb, e, pretregs) Gen code for load of GLOBAL_OFFSET_TABLE_. This value gets cached in the local variable 'localgot'.
cgreg_dst_regs(dst_integer_reg, dst_float_reg) setup register allocator parameters with platform specific data
cgreg_dst_regs(dst_integer_reg, dst_float_reg) setup register allocator parameters with platform specific data
cod3_adjSymOffsets() Adjust all Soffset's of stack variables so they are all relative to the frame pointer.
cod3_adjSymOffsets() Adjust all Soffset's of stack variables so they are all relative to the frame pointer.
cod3_align(seg) Align start of function.
cod3_align(seg) Align start of function.
cod3_align_bytes(seg, nbytes) Word or dword align start of function.
cod3_align_bytes(seg, nbytes) Word or dword align start of function.
cod3_bpoffset(s) Return offset from BP of symbol s.
cod3_bpoffset(s) Return offset from BP of symbol s.
cod3_EA(c) Determine if there is a modregrm byte for code.
cod3_EA(c) Determine if there is a modregrm byte for code.
cod3_initregs() setup ALLREGS and BYTEREGS called by: codgen
cod3_initregs() setup ALLREGS and BYTEREGS called by: codgen
cod3_ptrchk(cdb, pcs, keepmsk) Append code to cdb which validates pointer described by addressing mode in *pcs. Modify addressing mode in *pcs.
cod3_ptrchk(cdb, pcs, keepmsk) Append code to cdb which validates pointer described by addressing mode in *pcs. Modify addressing mode in *pcs.
cod3_set32() Fix global variables for 386.
cod3_set32() Fix global variables for 386.
cod3_set64() Fix global variables for I64.
cod3_set64() Fix global variables for I64.
cod3_setdefault() set initial global variable values
cod3_setdefault() set initial global variable values
cod3_spoff() Return offset of SP from BP.
cod3_spoff() Return offset of SP from BP.
cod3_stackadj(cdb, nbytes) Generate code to adjust the stack pointer by nbytes
cod3_stackadj(cdb, nbytes) Generate code to adjust the stack pointer by nbytes
cod3_stackalign(cdb, nbytes) Generate code to align the stack pointer at nbytes
cod3_stackalign(cdb, nbytes) Generate code to align the stack pointer at nbytes
cod3_thunk(sthunk, sfunc, p, thisty, d, i, d2) Generate code for, and output a thunk.
cod3_thunk(sthunk, sfunc, p, thisty, d, i, d2) Generate code for, and output a thunk.
cod3_useBP() Determine if BP can be used as a general purpose register. Note parallels between this routine and prolog().
cod3_useBP() Determine if BP can be used as a general purpose register. Note parallels between this routine and prolog().
code_dehydrate(pc)
code_dehydrate(pc)
code_hydrate(pc)
code_hydrate(pc)
code_match(c1, c2) Return !=0 if codes match.
code_match(c1, c2) Return !=0 if codes match.
cse_simple(c, e) Generate code segment to be used later to restore a cse
cse_simple(c, e) Generate code segment to be used later to restore a cse
doswitch(cdb, b) Generate code for blocks ending in a switch statement. Take BCswitch and decide on BCifthen use if - then code BCjmptab index into jump table BCswitch search table for match
doswitch(cdb, b) Generate code for blocks ending in a switch statement. Take BCswitch and decide on BCifthen use if - then code BCjmptab index into jump table BCswitch search table for match
epilog(b) Generate and return function epilog.
epilog(b) Generate and return function epilog.
gen_storecse(cdb, tym, reg, slot) Store reg to the common subexpression save area in index slot.
gen_storecse(cdb, tym, reg, slot) Store reg to the common subexpression save area in index slot.
genjmp(cdb, op, fltarg, targ) Generate a jump instruction.
genjmp(cdb, op, fltarg, targ) Generate a jump instruction.
genmovreg(to, from) Generate a MOV to,from register instruction. Smart enough to dump redundant register moves, and segment register moves.
genmovreg(to, from) Generate a MOV to,from register instruction. Smart enough to dump redundant register moves, and segment register moves.
genmulimm(cdb, r1, r2, imm) Generate immediate multiply instruction for r1=r2*imm. Optimize it into LEA's if we can.
genmulimm(cdb, r1, r2, imm) Generate immediate multiply instruction for r1=r2*imm. Optimize it into LEA's if we can.
genshift(cdb) Load CX with the value of AHSHIFT.
genshift(cdb) Load CX with the value of AHSHIFT.
jmpaddr(c) Compute jump addresses for FLcode.
jmpaddr(c) Compute jump addresses for FLcode.
jmpopcode(e) Return a jump opcode relevant to the elem for a JMP true.
jmpopcode(e) Return a jump opcode relevant to the elem for a JMP true.
load_localgot(cdb) Load contents of localgot into EBX.
load_localgot(cdb) Load contents of localgot into EBX.
makeitextern(s) Assume symbol s is extern.
makeitextern(s) Assume symbol s is extern.
movregconst(cdb, reg, value, flags) Move constant value into reg. Take advantage of existing values in registers. If flags & mPSW set flags based on result Else if flags & 8 do not disturb flags Else don't care about flags If flags & 1 then byte move If flags & 2 then short move (for I32 and I64) If flags & 4 then don't disturb unused portion of register If flags & 16 then reg is a byte register AL..BH If flags & 64 (0x40) then 64 bit move (I64 only)
movregconst(cdb, reg, value, flags) Move constant value into reg. Take advantage of existing values in registers. If flags & mPSW set flags based on result Else if flags & 8 do not disturb flags Else don't care about flags If flags & 1 then byte move If flags & 2 then short move (for I32 and I64) If flags & 4 then don't disturb unused portion of register If flags & 16 then reg is a byte register AL..BH If flags & 64 (0x40) then 64 bit move (I64 only)
outblkexitcode(cdb, bl, anyspill, sflsave, retsym, mfuncregsave) Generate block exit code
outblkexitcode(cdb, bl, anyspill, sflsave, retsym, mfuncregsave) Generate block exit code
outjmptab(b) Output data block for a jump table (BCjmptab). The 'holes' in the table get filled with the default label.
outjmptab(b) Output data block for a jump table (BCjmptab). The 'holes' in the table get filled with the default label.
outswitab(b) Output data block for a switch table. Two consecutive tables, the first is the case value table, the second is the address table.
outswitab(b) Output data block for a switch table. Two consecutive tables, the first is the case value table, the second is the address table.
pinholeopt(c, b) Find shorter versions of the same instructions. Does these optimizations: replaces jmps to the next instruction with NOPs sign extension of modregrm displacement sign extension of immediate data (can't do it for OR, AND, XOR as the opcodes are not defined) short versions for AX EA short versions for reg EA Code is neither removed nor added.
pinholeopt(c, b) Find shorter versions of the same instructions. Does these optimizations: replaces jmps to the next instruction with NOPs sign extension of modregrm displacement sign extension of immediate data (can't do it for OR, AND, XOR as the opcodes are not defined) short versions for AX EA short versions for reg EA Code is neither removed nor added.
prolog_frame(cdb, farfunc, xlocalsize, enter, cfa_offset) Set up frame register.
prolog_frame(cdb, farfunc, xlocalsize, enter, cfa_offset) Set up frame register.
prolog_genvarargs(cdb, sv, namedargs) Generate special varargs prolog for Posix 64 bit systems.
prolog_genvarargs(cdb, sv, namedargs) Generate special varargs prolog for Posix 64 bit systems.
prolog_ifunc(cdb, tyf) Generate first part of prolog for interrupt function.
prolog_ifunc(cdb, tyf) Generate first part of prolog for interrupt function.
prolog_loadparams(cdb, tyf, pushalloc, namedargs)
prolog_loadparams(cdb, tyf, pushalloc, namedargs)
prolog_saveregs(cdb, topush, cfa_offset) Save registers that the function destroys, but that the ABI says should be preserved across function calls.
prolog_saveregs(cdb, topush, cfa_offset) Save registers that the function destroys, but that the ABI says should be preserved across function calls.
prolog_stackalign(cdb) Enforce stack alignment.
prolog_stackalign(cdb) Enforce stack alignment.
regmask(tym, tyf) Given a type, return a mask of registers to hold that type.
regmask(tym, tyf) Given a type, return a mask of registers to hold that type.
REGSAVE_restore(regsave, cdb, reg, idx) Restore reg from regsave area. Complement REGSAVE_save().
REGSAVE_restore(regsave, cdb, reg, idx) Restore reg from regsave area. Complement REGSAVE_save().
REGSAVE_save(regsave, cdb, reg, idx) Generate code to save reg in regsave stack area.
REGSAVE_save(regsave, cdb, reg, idx) Generate code to save reg in regsave stack area.
vex_inssize(c) Size for vex encoded instruction.
vex_inssize(c) Size for vex encoded instruction.
WRcodlst(c) Debug code to dump code structure.
WRcodlst(c) Debug code to dump code structure.

Structs

NameDescription
MiniCodeBuf Write code to intermediate file. Code starts at offset.
MiniCodeBuf Write code to intermediate file. Code starts at offset.

Aliases

NameTypeDescription
_compare_fp_t nothrow extern(C) int function(const(void*), const(void*)) Struct necessary for sorting switch cases.
_compare_fp_t nothrow extern(C) int function(const(void*), const(void*)) Struct necessary for sorting switch cases.

Authors

Walter Bright

License

Boost License 1.0