mirror of
https://github.com/samsonjs/compiler.git
synced 2026-03-25 08:45:52 +00:00
[NEW] x86_inc instruction with some binary encoding.
This commit is contained in:
parent
9607df73d2
commit
83accb5bba
1 changed files with 15 additions and 0 deletions
15
compiler.rb
15
compiler.rb
|
|
@ -671,6 +671,21 @@ class Compiler
|
|||
emit("idiv #{op}")
|
||||
end
|
||||
|
||||
def x86_inc(op)
|
||||
emit("inc #{op}")
|
||||
|
||||
asm do
|
||||
if register?(op)
|
||||
emit_byte(0x40 + regnum(op))
|
||||
elsif rm32?(op)
|
||||
emit_byte(0xff)
|
||||
emit_modrm(
|
||||
else
|
||||
raise "unsupported op #{op}, wanted r32 or r/m32"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def x86_push(reg)
|
||||
emit("push #{reg}")
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue