node/lib/metasm/metasm/cpu/ia32/compile_c.rb
# 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)
holds compiler state information for a function
registers are saved as register number
TODO cache eflags . or just z . (may be defered to asm_optimize)
holds compiler state information for a function registers are saved as register number TODO cache eflags . or just z . ( may be defered to asm_optimize )
def c_return(expr)
		return if not expr
		@state.cache.delete_if { |r, v| r.kind_of? Reg and r.val == 0 and expr != v }
		r = c_cexpr_inner(expr)
		r = make_volatile(r, expr.type)
		unuse r
		case r
		when Composite
			if r.low.val == 2
				instr 'xchg', r.low, r.high
				instr 'mov', Reg.new(0, 32), r.low if r.high.val != 0
			else
				instr 'mov', Reg.new(2, 32), r.high if r.high.val != 2
				instr 'mov', Reg.new(0, 32), r.low if r.low.val != 0
			end
		when Reg
			instr 'mov', Reg.new(0, r.sz), r if r.val != 0
		when FpReg
			instr 'fld', FpReg.new(r.val) if r.val and r.val != 0
		end
	end
def c_return ( expr ) return if not expr @state . cache . delete_if { | r , v | r . kind_of? Reg and r . val == 0 and expr != v } r = c_cexpr_inner ( expr ) r = make_volatile ( r , expr . type ) unuse r case r when Composite if r . low . val == 2 instr 'xchg' , r . low , r . high instr 'mov' , Reg . new ( 0 , 32 ) , r . low if r . high . val != 0 else instr 'mov' , Reg . new ( 2 , 32 ) , r . high if r . high . val != 2 instr 'mov' , Reg . new ( 0 , 32 ) , r . low if r . low . val != 0 end when Reg instr 'mov' , Reg . new ( 0 , r . sz ) , r if r . val != 0 when FpReg instr 'fld' , FpReg . new ( r . val ) if r . val and r . val != 0 end end
holds compiler state information for a function
registers are saved as register number (see Ia32::Reg)
TODO cache eflags ?
holds compiler state information for a function registers are saved as register number ( see Ia32 :: Reg ) TODO cache eflags ?
expr