dmd.backend.cgcod

Top level code for the code generator.

Members

Aliases

_compare_fp_t
alias _compare_fp_t = int function(const void*, const void*)
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.

Functions

REGSIZE
int REGSIZE()
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
alignsection
targ_size_t alignsection(targ_size_t base, uint alignment, int 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

allocScratchReg
reg_t allocScratchReg(CodeBuilder cdb, regm_t regm)

Allocate a scratch register.

allocreg
void allocreg(CodeBuilder cdb, regm_t* pretregs, reg_t* preg, tym_t tym)

Allocate some registers. Input: pretregs Pointer to mask of registers to make selection from. tym Mask of type we will store in registers. Output: *pretregs Mask of allocated registers. *preg Register number of first allocated register. msavereg,mfuncreg retregs bits are cleared. regcon.cse.mval,regcon.cse.mops updated

allocreg
void allocreg(CodeBuilder cdb, regm_t* pretregs, reg_t* preg, tym_t tym, int line, const(char)* file)
Undocumented in source. Be warned that the author may not have intended to support it.
andregcon
void andregcon(con_t* 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
int autosort_cmp(void* ps1, void* ps2)

Predicate for sorting auto symbols for qsort().

callcdxxx
void callcdxxx(CodeBuilder cdb, elem* e, regm_t* pretregs, OPER op)

Generate code sequence for an elem. Input: pretregs = mask of possible registers to return result in Note: longs are in AX,BX or CX,DX or SI,DI doubles are AX,BX,CX,DX only constflag = 1 for user of result will not modify the registers returned in *pretregs. 2 for freenode() not called. Output: *pretregs mask of registers result is returned in

codelem
void codelem(CodeBuilder cdb, elem* e, regm_t* pretregs, uint constflag)
Undocumented in source. Be warned that the author may not have intended to support it.
codgen
void codgen(Symbol* 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
void cse_flush(CodeBuilder cdb, int do87)

Flush all CSE's out of registers and into memory. Input: do87 !=0 means save 87 registers too

cssave
bool cssave(elem* e, regm_t regm, uint opsflag)

Common subexpressions exist in registers. Note this in regcon.cse.mval. Input: e the subexpression regm mask of registers holding it opsflag if != 0 then regcon.cse.mops gets set too

docommas
void docommas(CodeBuilder cdb, elem** pe)

Scan down comma-expressions. Output: *pe = first elem down right side that is not an OPcomma

dwarf_except_gentables
void dwarf_except_gentables(Funcsym* sfunc, uint startoffset, uint retoffset)
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
evalinregister
bool evalinregister(elem* e)

Determine if a computation should be done into a register.

findreg
reg_t findreg(regm_t regm)

Given a register mask, find and return the number of the first register that fits.

findreg
reg_t findreg(regm_t regm, int line, const(char)* file)
Undocumented in source. Be warned that the author may not have intended to support it.
freenode
void freenode(elem* 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
void getregs(CodeBuilder cdb, regm_t r)

We are going to use the registers in mask r. Generate any code necessary to save any regs.

getregsNoSave
void getregsNoSave(regm_t r)

We are going to use the registers in mask r. Same as getregs(), but assert if code is needed to be generated.

getregs_imm
void getregs_imm(CodeBuilder cdb, regm_t r)

Getregs without marking immediate register values as gone.

getscratch
regm_t getscratch()

Return mask of scratch registers.

isregvar
int isregvar(elem* e, regm_t* pregm, reg_t* 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
regm_t lpadregs()

Determine registers that should be destroyed upon arrival to code entry point for exception handling.

numbitsset
int numbitsset(regm_t regm)

Count the number of bits set in a register mask.

prolog
void prolog(CodeBuilder cdb)

Generate code for a function start. Input: Offset(cseg) address of start of code Auto.alignment Output: Offset(cseg) adjusted for size of code generated EBPtoESP hasframe BPoff

qsort
void qsort(void* base, size_t nmemb, size_t size, _compare_fp_t compar)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
regm_str
const(char)* regm_str(regm_t rm)

Turn register mask into a string suitable for printing.

scodelem
void scodelem(CodeBuilder cdb, elem* e, regm_t* pretregs, regm_t keepmsk, bool constflag)

Same as codelem(), but do not destroy the registers in keepmsk. Use scratch registers as much as possible, then use stack. Input: constflag true if user of result will not modify the registers returned in *pretregs.

stackoffsets
void stackoffsets(int flags)

Compute offsets for remaining tmp, automatic and register variables that did not make it into registers. Input: flags 0: do estimate only 1: final

useregs
void useregs(regm_t regm)

Mark registers as used.

Manifest constants

MARS
enum MARS;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
MARS
enum MARS;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.

Static variables

ALLREGS
regm_t ALLREGS;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
Alloca
LocalSection Alloca;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
Auto
LocalSection Auto;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
BPoff
int BPoff;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
BYTEREGS
regm_t BYTEREGS;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
CSoff
targ_size_t CSoff;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
EBPtoESP
int EBPtoESP;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
EEStack
LocalSection EEStack;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
Fast
LocalSection Fast;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
Foff
targ_size_t Foff;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
NDPoff
targ_size_t NDPoff;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
Para
LocalSection Para;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
allregs
regm_t allregs;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
anyiasm
bool anyiasm;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
calledFinally
bool calledFinally;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
calledafunc
char calledafunc;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
cgstate
CGstate cgstate;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
dfoidx
int dfoidx;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
enforcealign
bool enforcealign;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
floatreg
bool floatreg;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
funcoffset
targ_size_t funcoffset;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
gotref
char gotref;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
hasframe
int hasframe;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
mfuncreg
regm_t mfuncreg;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
msavereg
regm_t msavereg;

Register masks.

needframe
char needframe;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
pass
int pass;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
prolog_allocoffset
targ_size_t prolog_allocoffset;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
pushoff
targ_size_t pushoff;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
pushoffuse
bool pushoffuse;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
reflocal
int reflocal;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
refparam
int refparam;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
regcon
con_t regcon;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
regsave
REGSAVE regsave;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
retoffset
targ_size_t retoffset;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
retsize
targ_size_t retsize;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
spoff
targ_size_t spoff;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
stackchanged
int stackchanged;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
stackpush
uint stackpush;
of bytes that SP is beyond BP.
startoffset
targ_size_t startoffset;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
usednteh
uint usednteh;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.

Meta