- REGSAVE_restore
void REGSAVE_restore(REGSAVE regsave, CodeBuilder cdb, reg_t reg, uint idx)
Restore reg from regsave area.
Complement REGSAVE_save().
- REGSAVE_save
void REGSAVE_save(REGSAVE regsave, CodeBuilder cdb, reg_t reg, uint idx)
Generate code to save reg in regsave stack area.
- 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.
- WRcodlst
void WRcodlst(code* c)
Debug code to dump code structure.
- allocretregs
regm_t allocretregs(tym_t ty, type* t, tym_t tyf, reg_t* reg1, reg_t* reg2)
Allocate registers for function return values.
- assignaddr
void assignaddr(block* bl)
Take symbol info in union ev and replace it with a real address
in Vpointer.
- assignaddrc
void assignaddrc(code* c)
Undocumented in source. Be warned that the author may not have intended to support it.
- branch
int branch(block* bl, int 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.
Input:
flag !=0 means don't have correct Boffsets yet
- calcblksize
uint calcblksize(code* c)
- calccodsize
uint calccodsize(code* 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.
Note: This routine must be fast. Profiling shows it is significant.
- cdframeptr
void cdframeptr(CodeBuilder cdb, elem* e, regm_t* pretregs)
- cdgot
void cdgot(CodeBuilder cdb, elem* e, regm_t* pretregs)
Gen code for load of _GLOBAL_OFFSET_TABLE_.
This value gets cached in the local variable 'localgot'.
- cgreg_dst_regs
void cgreg_dst_regs(reg_t* dst_integer_reg, reg_t* dst_float_reg)
setup register allocator parameters with platform specific data
- cgreg_set_priorities
void cgreg_set_priorities(tym_t ty, const(reg_t)** pseq, const(reg_t)** pseqmsw)
Undocumented in source. Be warned that the author may not have intended to support it.
- cod3_EA
int cod3_EA(code* c)
Determine if there is a modregrm byte for code.
- cod3_adjSymOffsets
void cod3_adjSymOffsets()
Adjust all Soffset's of stack variables so they
are all relative to the frame pointer.
- cod3_align
void cod3_align(int seg)
- cod3_align_bytes
void cod3_align_bytes(int seg, size_t nbytes)
Word or dword align start of function.
- cod3_bpoffset
targ_size_t cod3_bpoffset(Symbol* s)
Return offset from BP of symbol s.
- cod3_buildmodulector
void cod3_buildmodulector(Outbuffer* buf, int codeOffset, int refOffset)
Undocumented in source. Be warned that the author may not have intended to support it.
- cod3_initregs
void cod3_initregs()
setup ALLREGS and BYTEREGS
called by: codgen
- cod3_ptrchk
void cod3_ptrchk(CodeBuilder cdb, code* pcs, regm_t keepmsk)
Append code to cdb which validates pointer described by
addressing mode in *pcs. Modify addressing mode in *pcs.
- cod3_set32
void cod3_set32()
Fix global variables for 386.
- cod3_set64
void cod3_set64()
Fix global variables for I64.
- cod3_setdefault
void cod3_setdefault()
set initial global variable values
- cod3_spoff
targ_size_t cod3_spoff()
Return offset of SP from BP.
- cod3_stackadj
void cod3_stackadj(CodeBuilder cdb, int nbytes)
Generate code to adjust the stack pointer by nbytes
- cod3_stackalign
void cod3_stackalign(CodeBuilder cdb, int nbytes)
Generate code to align the stack pointer at nbytes
- cod3_thunk
void cod3_thunk(Symbol* sthunk, Symbol* sfunc, uint p, tym_t thisty, uint d, int i, uint d2)
Generate code for, and output a thunk.
- cod3_useBP
regm_t cod3_useBP()
Determine if BP can be used as a general purpose register.
Note parallels between this routine and prolog().
- code_dehydrate
void code_dehydrate(code** pc)
- code_hydrate
void code_hydrate(code** pc)
Undocumented in source. Be warned that the author may not have intended to support it.
- code_match
int code_match(code* c1, code* c2)
Return !=0 if codes match.
- code_print
void code_print(code* c)
Undocumented in source. Be warned that the author may not have intended to support it.
- codout
uint codout(int seg, code* c)
Undocumented in source. Be warned that the author may not have intended to support it.
- cse_simple
bool cse_simple(code* c, elem* e)
Generate code segment to be used later to restore a cse
- doswitch
void doswitch(CodeBuilder cdb, block* 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
void epilog(block* b)
Generate and return function epilog.
Output:
retsize Size of function epilog
- gen_loadcse
void gen_loadcse(CodeBuilder cdb, tym_t tym, reg_t reg, size_t slot)
Undocumented in source. Be warned that the author may not have intended to support it.
- gen_spill_reg
void gen_spill_reg(CodeBuilder cdb, Symbol* s, bool toreg)
Undocumented in source. Be warned that the author may not have intended to support it.
- gen_storecse
void gen_storecse(CodeBuilder cdb, tym_t tym, reg_t reg, size_t slot)
Store reg to the common subexpression save area in index slot.
- gen_testcse
void gen_testcse(CodeBuilder cdb, tym_t tym, uint sz, size_t slot)
Undocumented in source. Be warned that the author may not have intended to support it.
- genjmp
void genjmp(CodeBuilder cdb, opcode_t op, uint fltarg, block* targ)
Generate a jump instruction.
- genmovreg
code* genmovreg(uint to, uint from)
Generate a MOV to,from register instruction.
Smart enough to dump redundant register moves, and segment
register moves.
- genmovreg
void genmovreg(CodeBuilder cdb, uint to, uint from)
Undocumented in source. Be warned that the author may not have intended to support it.
- genmovreg
void genmovreg(CodeBuilder cdb, uint to, uint from, tym_t tym)
Undocumented in source. Be warned that the author may not have intended to support it.
- genmulimm
void genmulimm(CodeBuilder cdb, uint r1, uint r2, targ_int imm)
Generate immediate multiply instruction for r1=r2*imm.
Optimize it into LEA's if we can.
- genpop
void genpop(CodeBuilder cdb, reg_t reg)
Undocumented in source. Be warned that the author may not have intended to support it.
- genpush
void genpush(CodeBuilder cdb, reg_t reg)
Undocumented in source. Be warned that the author may not have intended to support it.
- genregs
void genregs(CodeBuilder cdb, opcode_t op, uint dstreg, uint srcreg)
Undocumented in source. Be warned that the author may not have intended to support it.
- genshift
void genshift(CodeBuilder cdb)
Load CX with the value of _AHSHIFT.
- gentstreg
void gentstreg(CodeBuilder cdb, uint t)
Undocumented in source. Be warned that the author may not have intended to support it.
- jmpaddr
void jmpaddr(code* c)
Compute jump addresses for FLcode.
Note: only works for forward referenced code.
only direct jumps and branches are detected.
LOOP instructions only work for backward refs.
- jmpopcode
int jmpopcode(elem* e)
Return a jump opcode relevant to the elem for a JMP true.
- load_localgot
void load_localgot(CodeBuilder cdb)
Load contents of localgot into EBX.
- makeitextern
void makeitextern(Symbol* s)
Assume symbol s is extern.
- movregconst
void movregconst(CodeBuilder cdb, reg_t reg, targ_size_t value, regm_t 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
void outblkexitcode(CodeBuilder cdb, block* bl, int anyspill, const(char)* sflsave, Symbol** retsym, regm_t mfuncregsave)
- outjmptab
void outjmptab(block* b)
Output data block for a jump table (BCjmptab).
The 'holes' in the table get filled with the
default label.
- outswitab
void outswitab(block* 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
void pinholeopt(code* c, block* 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_16bit_windows_farfunc
void prolog_16bit_windows_farfunc(CodeBuilder cdb, tym_t* tyf, bool* pushds)
Undocumented in source. Be warned that the author may not have intended to support it.
- prolog_frame
void prolog_frame(CodeBuilder cdb, bool farfunc, uint xlocalsize, bool enter, int cfa_offset)
- prolog_frameadj
void prolog_frameadj(CodeBuilder cdb, tym_t tyf, uint xlocalsize, bool enter, bool* pushalloc)
Undocumented in source. Be warned that the author may not have intended to support it.
- prolog_frameadj2
void prolog_frameadj2(CodeBuilder cdb, tym_t tyf, uint xlocalsize, bool* pushalloc)
Undocumented in source. Be warned that the author may not have intended to support it.
- prolog_gen_win64_varargs
void prolog_gen_win64_varargs(CodeBuilder cdb)
Undocumented in source. Be warned that the author may not have intended to support it.
- prolog_genvarargs
void prolog_genvarargs(CodeBuilder cdb, Symbol* sv, regm_t namedargs)
Generate special varargs prolog for Posix 64 bit systems.
- prolog_ifunc
void prolog_ifunc(CodeBuilder cdb, tym_t* tyf)
Generate first part of prolog for interrupt function.
- prolog_ifunc2
void prolog_ifunc2(CodeBuilder cdb, tym_t tyf, tym_t tym, bool pushds)
Undocumented in source. Be warned that the author may not have intended to support it.
- prolog_loadparams
void prolog_loadparams(CodeBuilder cdb, tym_t tyf, bool pushalloc, regm_t namedargs)
- prolog_saveregs
void prolog_saveregs(CodeBuilder cdb, regm_t topush, int cfa_offset)
Save registers that the function destroys,
but that the ABI says should be preserved across
function calls.
- prolog_setupalloca
void prolog_setupalloca(CodeBuilder cdb)
Undocumented in source. Be warned that the author may not have intended to support it.
- prolog_stackalign
void prolog_stackalign(CodeBuilder cdb)
Enforce stack alignment.
Input:
cdb code builder.
- prolog_trace
void prolog_trace(CodeBuilder cdb, bool farfunc, uint* regsaved)
Undocumented in source. Be warned that the author may not have intended to support it.
- 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.
- regmask
regm_t regmask(tym_t tym, tym_t tyf)
Given a type, return a mask of
registers to hold that type.
Input:
tyf function type
- simplify_code
void simplify_code(code* c)
Undocumented in source. Be warned that the author may not have intended to support it.
- vex_inssize
ubyte vex_inssize(code* c)
Size for vex encoded instruction.
Compiler implementation of the D programming language.