From 775aa43f777582f366ebfd11500167f5e44b04f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartolom=C3=A9=20S=C3=A1nchez=20Salado?= Date: Wed, 16 Oct 2024 21:25:15 +0200 Subject: [PATCH] ref: move param16 function into a class (Bits16) --- src/arch/z80/backend/_16bit.py | 12 ++++++------ src/arch/z80/backend/main.py | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/arch/z80/backend/_16bit.py b/src/arch/z80/backend/_16bit.py index 30d9fa704..fddfc5f21 100644 --- a/src/arch/z80/backend/_16bit.py +++ b/src/arch/z80/backend/_16bit.py @@ -1125,12 +1125,12 @@ def ret16(cls, ins: Quad) -> list[str]: output.append("jp %s" % str(ins[2])) return output - -def _param16(ins: Quad) -> list[str]: - """Pushes 16bit param into the stack""" - output = Bits16.get_oper(ins[1]) - output.append("push hl") - return output + @classmethod + def param16(cls, ins: Quad) -> list[str]: + """Pushes 16bit param into the stack""" + output = Bits16.get_oper(ins[1]) + output.append("push hl") + return output def _fparam16(ins: Quad) -> list[str]: diff --git a/src/arch/z80/backend/main.py b/src/arch/z80/backend/main.py index be3ae8b0a..0b394cc13 100644 --- a/src/arch/z80/backend/main.py +++ b/src/arch/z80/backend/main.py @@ -30,7 +30,6 @@ Bits16, _fparam16, _jnzero16, - _param16, ) # 32 bit bitwise operations @@ -335,8 +334,8 @@ def _set_quad_table(self): ICInstruction.JGEZEROF: ICInfo(2, Float.jgezerof), # if X >= 0 jmp LABEL (float) ICInstruction.PARAMU8: ICInfo(1, Bits8.param8), # Push 8 bit param onto the stack ICInstruction.PARAMI8: ICInfo(1, Bits8.param8), # Push 8 bit param onto the stack - ICInstruction.PARAMU16: ICInfo(1, _param16), # Push 16 bit param onto the stack - ICInstruction.PARAMI16: ICInfo(1, _param16), # Push 16 bit param onto the stack + ICInstruction.PARAMU16: ICInfo(1, Bits16.param16), # Push 16 bit param onto the stack + ICInstruction.PARAMI16: ICInfo(1, Bits16.param16), # Push 16 bit param onto the stack ICInstruction.PARAMU32: ICInfo(1, Bits32.param32), # Push 32 bit param onto the stack ICInstruction.PARAMI32: ICInfo(1, Bits32.param32), # Push 32 bit param onto the stack ICInstruction.PARAMF16: ICInfo(1, Fixed16.paramf16), # Push 32 bit param onto the stack