Only ld/sd "needed"

This commit is contained in:
augustin64 2024-10-21 13:44:40 +02:00
parent 4c7a2c85a2
commit 7479ee19d8

View File

@ -18,12 +18,12 @@ class AllInMemAllocator(Allocator):
s_index = 0
for arg in old_instr.args():
if isinstance(arg, Temporary):
# TODO: don't ld/sd when nothing changed (eg don't ld a destination only,
# TODO: don't sd a source only)
s_index += 1
if arg in old_instr.used(): # needs to be read first
before.append(RiscV.ld(
S[s_index], arg.get_alloced_loc()
))
if arg in old_instr.defined(): # needs to be stored after
after.append(RiscV.sd(
S[s_index], arg.get_alloced_loc()
))