From d3b3486986868f3282aca3a157b4ef785749aac8 Mon Sep 17 00:00:00 2001 From: ergo720 <45463469+ergo720@users.noreply.github.com> Date: Thu, 8 Aug 2024 20:24:43 +0200 Subject: [PATCH] Removed load/store_reg functions --- lib86cpu/core/emitter/x64/jit.cpp | 48 ++----------------------------- lib86cpu/core/emitter/x64/jit.h | 3 -- 2 files changed, 2 insertions(+), 49 deletions(-) diff --git a/lib86cpu/core/emitter/x64/jit.cpp b/lib86cpu/core/emitter/x64/jit.cpp index 8c3846a..1ab0f59 100644 --- a/lib86cpu/core/emitter/x64/jit.cpp +++ b/lib86cpu/core/emitter/x64/jit.cpp @@ -437,7 +437,7 @@ static_assert((LOCAL_VARS_off(0) & 15) == 0); // must be 16 byte aligned so that #define LD_R8H(dst, reg_offset) MOV(dst, MEMD8(RCX, reg_offset + 1)) #define LD_R16(dst, reg_offset) MOV(dst, MEMD16(RCX, reg_offset)) #define LD_R32(dst, reg_offset) MOV(dst, MEMD32(RCX, reg_offset)) -#define LD_REG_val(dst, reg_offset, size) load_reg(dst, reg_offset, size) +#define LD_REG_val(dst, reg_offset, size) MOV(dst, MEMD(RCX, reg_offset, size)) #define LD_SEG(dst, seg_offset) MOV(dst, MEMD16(RCX, seg_offset)) #define LD_SEG_BASE(dst, seg_offset) MOV(dst, MEMD32(RCX, seg_offset + seg_base_offset)) #define LD_SEG_LIMIT(dst, seg_offset) MOV(dst, MEMD32(RCX, seg_offset + seg_limit_offset)) @@ -445,7 +445,7 @@ static_assert((LOCAL_VARS_off(0) & 15) == 0); // must be 16 byte aligned so that #define ST_R8H(reg_offset, src) MOV(MEMD8(RCX, reg_offset + 1), src) #define ST_R16(reg_offset, src) MOV(MEMD16(RCX, reg_offset), src) #define ST_R32(reg_offset, src) MOV(MEMD32(RCX, reg_offset), src) -#define ST_REG_val(val, reg_offset, size) store_reg(val, reg_offset, size) +#define ST_REG_val(val, reg_offset, size) MOV(MEMD(RCX, reg_offset, size), val) #define ST_SEG(seg_offset, val) MOV(MEMD16(RCX, seg_offset), val) #define ST_SEG_BASE(seg_offset, val) MOV(MEMD32(RCX, seg_offset + seg_base_offset), val) #define ST_SEG_LIMIT(seg_offset, val) MOV(MEMD32(RCX, seg_offset + seg_limit_offset), val) @@ -1833,50 +1833,6 @@ lc86_jit::ld_pf(x86::Gp dst, x86::Gp res, x86::Gp aux) MOVZX(dst, MEMS8(dst.r64(), res.r64(), 0)); } -void -lc86_jit::load_reg(x86::Gp dst, size_t reg_offset, size_t size) -{ - switch (size) - { - case SIZE8: - MOV(dst, MEMD8(RCX, reg_offset)); - break; - - case SIZE16: - MOV(dst, MEMD16(RCX, reg_offset)); - break; - - case SIZE32: - MOV(dst, MEMD32(RCX, reg_offset)); - break; - - default: - LIB86CPU_ABORT(); - } -} - -template -void lc86_jit::store_reg(T val, size_t reg_offset, size_t size) -{ - switch (size) - { - case SIZE8: - MOV(MEMD8(RCX, reg_offset), val); - break; - - case SIZE16: - MOV(MEMD16(RCX, reg_offset), val); - break; - - case SIZE32: - MOV(MEMD32(RCX, reg_offset), val); - break; - - default: - LIB86CPU_ABORT(); - } -} - void lc86_jit::load_mem(uint8_t size, uint8_t is_priv) { diff --git a/lib86cpu/core/emitter/x64/jit.h b/lib86cpu/core/emitter/x64/jit.h index dcf40be..2843d28 100644 --- a/lib86cpu/core/emitter/x64/jit.h +++ b/lib86cpu/core/emitter/x64/jit.h @@ -241,9 +241,6 @@ class lc86_jit : public Target { void ld_of(x86::Gp dst, x86::Gp aux); void ld_sf(x86::Gp res_dst, x86::Gp aux); void ld_pf(x86::Gp dst, x86::Gp res, x86::Gp aux); - void load_reg(x86::Gp dst, size_t reg_offset, size_t size); - template - void store_reg(T val, size_t reg_offset, size_t size); void load_mem(uint8_t size, uint8_t is_priv); template void store_mem(T val, uint8_t size, uint8_t is_priv);