Skip to content

Commit 0bfaad3

Browse files
authored
Merge pull request #834 from bartsanchez/bart/move-fparam16-to-a-class
ref: move fparam16 function into a class (Bits16)
2 parents 6d91e6d + 2bfc159 commit 0bfaad3

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/arch/z80/backend/_16bit.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,14 +1132,14 @@ def param16(cls, ins: Quad) -> list[str]:
11321132
output.append("push hl")
11331133
return output
11341134

1135-
1136-
def _fparam16(ins: Quad) -> list[str]:
1137-
"""Passes a word as a __FASTCALL__ parameter.
1138-
This is done by popping out of the stack for a
1139-
value, or by loading it from memory (indirect)
1140-
or directly (immediate)
1141-
"""
1142-
return Bits16.get_oper(ins[1])
1135+
@classmethod
1136+
def fparam16(cls, ins: Quad) -> list[str]:
1137+
"""Passes a word as a __FASTCALL__ parameter.
1138+
This is done by popping out of the stack for a
1139+
value, or by loading it from memory (indirect)
1140+
or directly (immediate)
1141+
"""
1142+
return Bits16.get_oper(ins[1])
11431143

11441144

11451145
def _jnzero16(ins: Quad) -> list[str]:

src/arch/z80/backend/main.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
# 16 bit arithmetic functions
2929
from ._16bit import (
3030
Bits16,
31-
_fparam16,
3231
_jnzero16,
3332
)
3433

@@ -345,8 +344,8 @@ def _set_quad_table(self):
345344
), # Push float param - 6 BYTES (always even) onto the stack
346345
ICInstruction.FPARAMU8: ICInfo(1, Bits8.fparam8), # __FASTCALL__ parameter
347346
ICInstruction.FPARAMI8: ICInfo(1, Bits8.fparam8), # __FASTCALL__ parameter
348-
ICInstruction.FPARAMU16: ICInfo(1, _fparam16), # __FASTCALL__ parameter
349-
ICInstruction.FPARAMI16: ICInfo(1, _fparam16), # __FASTCALL__ parameter
347+
ICInstruction.FPARAMU16: ICInfo(1, Bits16.fparam16), # __FASTCALL__ parameter
348+
ICInstruction.FPARAMI16: ICInfo(1, Bits16.fparam16), # __FASTCALL__ parameter
350349
ICInstruction.FPARAMU32: ICInfo(1, Bits32.fparam32), # __FASTCALL__ parameter
351350
ICInstruction.FPARAMI32: ICInfo(1, Bits32.fparam32), # __FASTCALL__ parameter
352351
ICInstruction.FPARAMF16: ICInfo(1, Fixed16.fparamf16), # __FASTCALL__ parameter

0 commit comments

Comments
 (0)