- cdabs
void cdabs(CodeBuilder cdb, elem* e, regm_t* pretregs)
- cdbswap
void cdbswap(CodeBuilder cdb, elem* e, regm_t* pretregs)
- cdcom
void cdcom(CodeBuilder cdb, elem* e, regm_t* pretregs)
- cdcomma
void cdcomma(CodeBuilder cdb, elem* e, regm_t* pretregs)
- cdcond
void cdcond(CodeBuilder cdb, elem* e, regm_t* pretregs)
- cdctor
void cdctor(CodeBuilder cdb, elem* e, regm_t* pretregs)
- cddctor
void cddctor(CodeBuilder cdb, elem* e, regm_t* pretregs)
- cdddtor
void cdddtor(CodeBuilder cdb, elem* e, regm_t* pretregs)
- cddiv
void cddiv(CodeBuilder cdb, elem* e, regm_t* pretregs)
Handle divide, modulo and remquo.
Note that modulo isn't defined for doubles.
- cddtor
void cddtor(CodeBuilder cdb, elem* e, regm_t* pretregs)
- cdhalt
void cdhalt(CodeBuilder cdb, elem* e, regm_t* pretregs)
- cdind
void cdind(CodeBuilder cdb, elem* e, regm_t* pretregs)
Perform a 'star' reference (indirection).
- cdloglog
void cdloglog(CodeBuilder cdb, elem* e, regm_t* pretregs)
Do && and || operators.
Generate:
(evaluate e1 and e2, if true goto cnop1)
cnop3: NOP
cg: [save reg code] ;if we must preserve reg
CLR reg ;false result (set Z also)
JMP cnop2
- cdmemcmp
void cdmemcmp(CodeBuilder cdb, elem* e, regm_t* pretregs)
Generate code for memcmp(s1,s2,n) intrinsic.
- cdmemcpy
void cdmemcpy(CodeBuilder cdb, elem* e, regm_t* pretregs)
Generate code for memcpy(s1,s2,n) intrinsic.
OPmemcpy
/ \
s1 OPparam
/ \
s2 n
- cdmemset
void cdmemset(CodeBuilder cdb, elem* e, regm_t* pretregs)
Generate code for memset(s,value,numbytes) intrinsic.
(s OPmemset (numbytes OPparam value))
- cdmul
void cdmul(CodeBuilder cdb, elem* e, regm_t* pretregs)
- cdneg
void cdneg(CodeBuilder cdb, elem* e, regm_t* pretregs)
OPneg, OPsqrt, OPsin, OPcos, OPrint
- cdnot
void cdnot(CodeBuilder cdb, elem* e, regm_t* pretregs)
Handle OPnot and OPbool.
Generate:
c: [evaluate e1]
cfalse: [save reg code]
clr reg
jmp cnop
ctrue: [save reg code]
clr reg
inc reg
cnop: nop
- cdorth
void cdorth(CodeBuilder cdb, elem* e, regm_t* pretregs)
Handle operators which are more or less orthogonal
( + - & | ^ )
- cdpost
void cdpost(CodeBuilder cdb, elem* e, regm_t* pretregs)
Post increment and post decrement.
- cdrelconst
void cdrelconst(CodeBuilder cdb, elem* e, regm_t* pretregs)
Get the address of.
Is also called by cdstreq() to set up pointer to a structure.
- cdshift
void cdshift(CodeBuilder cdb, elem* e, regm_t* pretregs)
Generate code for shift left or shift right (OPshl,OPshr,OPashr,OProl,OPror).
- cdstrcmp
void cdstrcmp(CodeBuilder cdb, elem* e, regm_t* pretregs)
Generate code for strcmp(s1,s2) intrinsic.
- cdstrcpy
void cdstrcpy(CodeBuilder cdb, elem* e, regm_t* pretregs)
Generate code for strcpy(s1,s2) intrinsic.
- cdstreq
void cdstreq(CodeBuilder cdb, elem* e, regm_t* pretregs)
Do structure assignments.
This should be fixed so that (s1 = s2) is rewritten to (&s1 = &s2).
Mebbe call cdstreq() for double assignments???
- cdstrlen
void cdstrlen(CodeBuilder cdb, elem* e, regm_t* pretregs)
Generate code for intrinsic strlen().
- cdvoid
void cdvoid(CodeBuilder cdb, elem* e, regm_t* pretregs)
- getoffset
void getoffset(CodeBuilder cdb, elem* e, reg_t reg)
Load the offset portion of the address represented by e into
reg.
- idxregm
regm_t idxregm(code* c)
Determine index registers used by addressing mode.
Index is rm of modregrm field.
- movOnly
bool movOnly(elem* e)
- opdouble
void opdouble(CodeBuilder cdb, elem* e, regm_t* pretregs, uint clib)
Gen code for call to floating point routine.
Code generation 2
Includes: - math operators (+ - * / %) and functions (abs, cos, sqrt) - 'string' functions (strlen, memcpy, memset) - pointers (address of / dereference) - struct assign, constructor, destructor
Compiler implementation of the D programming language.