Skip to content

Commit 36eb8b2

Browse files
authored
Merge pull request #830 from bartsanchez/bart/move-jgezerou16-to-a-class
ref: move jgezerou16 function into a class (Bits16)
2 parents f096e7b + e7b9c69 commit 36eb8b2

2 files changed

Lines changed: 12 additions & 13 deletions

File tree

src/arch/z80/backend/_16bit.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,18 +1089,18 @@ def jzero16(cls, ins: Quad) -> list[str]:
10891089
output.append("jp z, %s" % str(ins[2]))
10901090
return output
10911091

1092+
@classmethod
1093+
def jgezerou16(cls, ins: Quad) -> list[str]:
1094+
"""Jumps if top of the stack (16bit) is >= 0 to arg(1)
1095+
Always TRUE for unsigned
1096+
"""
1097+
output = []
1098+
value = ins[1]
1099+
if not is_int(value):
1100+
output = Bits16.get_oper(value)
10921101

1093-
def _jgezerou16(ins: Quad) -> list[str]:
1094-
"""Jumps if top of the stack (16bit) is >= 0 to arg(1)
1095-
Always TRUE for unsigned
1096-
"""
1097-
output = []
1098-
value = ins[1]
1099-
if not is_int(value):
1100-
output = Bits16.get_oper(value)
1101-
1102-
output.append("jp %s" % str(ins[2]))
1103-
return output
1102+
output.append("jp %s" % str(ins[2]))
1103+
return output
11041104

11051105

11061106
def _jgezeroi16(ins: Quad) -> list[str]:

src/arch/z80/backend/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
Bits16,
3131
_fparam16,
3232
_jgezeroi16,
33-
_jgezerou16,
3433
_jnzero16,
3534
_param16,
3635
_ret16,
@@ -331,7 +330,7 @@ def _set_quad_table(self):
331330
ICInstruction.JGEZEROI8: ICInfo(2, Bits8.jgezeroi8), # if X >= 0 jmp LABEL
332331
ICInstruction.JGEZEROU8: ICInfo(2, Bits8.jgezerou8), # if X >= 0 jmp LABEL (ALWAYS TRUE)
333332
ICInstruction.JGEZEROI16: ICInfo(2, _jgezeroi16), # if X >= 0 jmp LABEL
334-
ICInstruction.JGEZEROU16: ICInfo(2, _jgezerou16), # if X >= 0 jmp LABEL (ALWAYS TRUE)
333+
ICInstruction.JGEZEROU16: ICInfo(2, Bits16.jgezerou16), # if X >= 0 jmp LABEL (ALWAYS TRUE)
335334
ICInstruction.JGEZEROI32: ICInfo(2, Bits32.jgezeroi32), # if X >= 0 jmp LABEL (32bit, fixed)
336335
ICInstruction.JGEZEROU32: ICInfo(2, Bits32.jgezerou32), # if X >= 0 jmp LABEL (32bit, fixed) (always true)
337336
ICInstruction.JGEZEROF16: ICInfo(2, Fixed16.jgezerof16), # if X >= 0 jmp LABEL (32bit, fixed)

0 commit comments

Comments
 (0)