Size in bytes of each instruction. 0 means illegal instruction. bit M: if there is a modregrm field (EV1 is reserved for modregrm) bit T: if there is a second operand (EV2) bit E: if second operand is only 8 bits bit A: a short version exists for the AX reg bit R: a short version exists for regs bits 2..0: size of instruction (excluding optional bytes)
Pretty-print a CF mask.
Restore reg from regsave area. Complement REGSAVE_save().
Generate code to save reg in regsave stack area.
Debug code to dump code structure.
Allocate registers for function return values.
Take symbol info in union ev and replace it with a real address in Vpointer.
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
Calculate bl.Bsize.
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.
Gen code for OPframeptr
Gen code for load of _GLOBAL_OFFSET_TABLE_. This value gets cached in the local variable 'localgot'.
setup register allocator parameters with platform specific data
Adjust all Soffset's of stack variables so they are all relative to the frame pointer.
Align start of function.
Word or dword align start of function.
Return offset from BP of symbol s.
setup ALLREGS and BYTEREGS called by: codgen
Append code to cdb which validates pointer described by addressing mode in *pcs. Modify addressing mode in *pcs.
Fix global variables for 386.
Fix global variables for I64.
set initial global variable values
Return offset of SP from BP.
Generate code to adjust the stack pointer by nbytes
Generate code to align the stack pointer at nbytes
Generate code for, and output a thunk.
Determine if BP can be used as a general purpose register. Note parallels between this routine and prolog().
Return !=0 if codes match.
Convert instructions to object code and write them to objmod.
Generate code segment to be used later to restore a cse
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
Generate and return function epilog. Output: retsize Size of function epilog
Store reg to the common subexpression save area in index slot.
Generate a jump instruction.
Generate a MOV to,from register instruction. Smart enough to dump redundant register moves, and segment register moves.
Generate immediate multiply instruction for r1=r2*imm. Optimize it into LEA's if we can.
Load CX with the value of _AHSHIFT.
Determine if there is a modregrm byte for instruction.
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.
Return a jump opcode relevant to the elem for a JMP true.
Load contents of localgot into EBX.
Assume symbol s is extern.
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)
Generate block exit code
Output data block for a jump table (BCjmptab). The 'holes' in the table get filled with the default label.
Output data block for a switch table. Two consecutive tables, the first is the case value table, the second is the address table.
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.
Set up frame register.
Generate elems for va_start()
Generate special varargs prolog for Posix 64 bit systems.
Generate first part of prolog for interrupt function.
Get mask of registers that named parameters (not ... variadic arguments) were passed in.
Save registers that the function destroys, but that the ABI says should be preserved across function calls.
Enforce stack alignment. Input: cdb code builder.
Given a type, return a mask of registers to hold that type. Input: tyf function type
Size for vex encoded instruction.
Code generation 3
Includes: - generating a function prolog (pushing return address, loading paramters) - generating a function epilog (restoring registers, returning) - generation / peephole optimizations of jump / branch instructions
Compiler implementation of the D programming language.