Skip to content

Commit 680f447

Browse files
authored
Merge pull request #832 from bartsanchez/bart/move-ret16-to-a-class
ref: move ret16 function into a class (Bits16)
2 parents 2dbee30 + 85c8268 commit 680f447

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/arch/z80/backend/_16bit.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,13 +1117,13 @@ def jgezeroi16(cls, ins: Quad) -> list[str]:
11171117
output.append("jp nc, %s" % str(ins[2]))
11181118
return output
11191119

1120-
1121-
def _ret16(ins: Quad) -> list[str]:
1122-
"""Returns from a procedure / function a 16bits value"""
1123-
output = Bits16.get_oper(ins[1])
1124-
output.append("#pragma opt require hl")
1125-
output.append("jp %s" % str(ins[2]))
1126-
return output
1120+
@classmethod
1121+
def ret16(cls, ins: Quad) -> list[str]:
1122+
"""Returns from a procedure / function a 16bits value"""
1123+
output = Bits16.get_oper(ins[1])
1124+
output.append("#pragma opt require hl")
1125+
output.append("jp %s" % str(ins[2]))
1126+
return output
11271127

11281128

11291129
def _param16(ins: Quad) -> list[str]:

src/arch/z80/backend/main.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
_fparam16,
3232
_jnzero16,
3333
_param16,
34-
_ret16,
3534
)
3635

3736
# 32 bit bitwise operations
@@ -367,10 +366,10 @@ def _set_quad_table(self):
367366
2, Bits8.ret8
368367
), # Returns from a function call (enters the 'leave' sequence'), returning 8 bit value
369368
ICInstruction.RETI16: ICInfo(
370-
2, _ret16
369+
2, Bits16.ret16
371370
), # Returns from a func call (enters the 'leave' sequence'), returning 16 bit value
372371
ICInstruction.RETU16: ICInfo(
373-
2, _ret16
372+
2, Bits16.ret16
374373
), # Returns from a func call (enters the 'leave' sequence'), returning 16 bit value
375374
ICInstruction.RETI32: ICInfo(
376375
2, Bits32.ret32

0 commit comments

Comments
 (0)