class Metasm::X86_64::CCompiler::State

holds compiler state information for a function registers are saved as register number (see Reg)

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

args_space[RW]

stack space reserved for subfunction in ABI

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) the reg dependencies are in used

offset[RW]

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

regargs[RW]

list of reg values that are used as func args in current ABI

saved_rbp[RW]

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

stack_align16[RW]

ensure stack is 16byte aligned before calls

used[RW]

the array of register values currently not available

Public Class Methods

new(func) click to toggle source
# File metasm/cpu/x86_64/compile_c.rb, line 47
def initialize(func)
        @func = func
        @offset = {}
        @cache = {}
        @dirty = []
        @used = [4]  # rsp is always in use
        @inuse = []
        @bound = {}
        @regargs = []
        @args_space = 0
        @stack_align16 = true
        @abi_flushregs_call = [0, 1, 2, 6, 7, 8, 9, 10, 11]
        @abi_trashregs = @abi_flushregs_call.dup
end