Skip to content

Commit

Permalink
修好了4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tao1122334 committed Jan 12, 2024
1 parent a79303e commit b4b8f66
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions phase4/splc.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,11 @@ def translate(tac: str) -> "list[str]":
fi_command.append(f'lw ${ind + save_reg},{r}')
c = c.replace(r, f'${ind + save_reg}')
fi_command.append(c)
for ind, r in enumerate(regs):
if ':=' in tac:
x, _ = tac.split(' := ')
r = reg(x)
if '$sp' in r:
fi_command.append(f'sw ${ind + save_reg},{r}')
fi_command.append(f'sw ${save_reg},{r}')
return fi_command


Expand Down

0 comments on commit b4b8f66

Please sign in to comment.