class Metasm::Ia32::CCompiler::State

holds compiler state information for a function registers are saved as register number (see Ia32::Reg) TODO cache eflags ? or just z ? (may be defered to asm_optimize)

Attributes

abi_flushregs_call[RW]

list of reg values that are not kept across function call

abi_trashregs[RW]

list of regs we can trash without restoring them

bound[RW]

variable => register for current scope (variable never on the stack) bound registers are also in used

cache[RW]

register => CExpression

dirty[RW]

array of register values used in the function (to save/restore at prolog/epilog)

func[RW]

the current function

inuse[RW]

the array of args in use (reg/modrm/composite) the reg dependencies are in used

offset[RW]

variable => offset from ebp (::Integer or CExpression)

saved_ebp[RW]

used includes ebp if true nil if ebp is not reserved for stack variable addressing Reg if used

used[RW]

the array of register values currently not available

Public Class Methods

new(func) click to toggle source
# File metasm/cpu/ia32/compile_c.rb, line 42
def initialize(func)
        @func = func
        @offset = {}
        @cache = {}
        @dirty = []
        @used = [4]  # esp is always in use
        @inuse = []
        @bound = {}
        @abi_flushregs_call = [0, 1, 2]              # eax, ecx, edx (r8 etc ?)
        @abi_trashregs = [0, 1, 2]
end