Correction de l'erreur sur le sens des moves

This commit is contained in:
MysaaJava 2022-11-15 01:43:00 +01:00
parent 0a8c02ec83
commit 0647039a4c
Signed by: Mysaa
GPG Key ID: DBA23608F23F5A10
2 changed files with 6 additions and 6 deletions

View File

@ -53,7 +53,7 @@ def generate_moves_from_phis_smart(pool: TemporaryPool, phis: List[PhiNode], par
if(isinstance(dest,Temporary)):
dest = pool.get_alloced_loc(dest)
assert(isinstance(dest,DataLocation))
moves.append((dest,src))
moves.append((src,dest))
realmoves = sequentialize_moves(set(moves))
return realmoves

View File

@ -26,7 +26,7 @@ def generate_smart_move(dest: DataLocation, src: DataLocation) -> List[BlockInst
instr.append(RiscV.ld(dest,src))
elif(isinstance(dest,Register) and isinstance(src,Register)):
# Classic move
instr.append(RiscV.mv(src,dest))
instr.append(RiscV.mv(dest,src))
else:
raise MiniCInternalError("Cannot generate smart move from parameters that are no Offset or Register:",src,dest)
return instr
@ -61,7 +61,7 @@ def sequentialize_moves(parallel_moves: Set[Tuple[DataLocation, DataLocation]]
head = None
else:
pred = preds.pop()
moves.append((pred,head))
moves.append((head,pred))
move_graph.delete_vertex(head)
head = pred
@ -73,14 +73,14 @@ def sequentialize_moves(parallel_moves: Set[Tuple[DataLocation, DataLocation]]
pass
else:
head = cycle[0]
moves.append((head,tmp))
moves.append((tmp,head))
while True:
pred = move_graph.pred(head).pop()
if(pred==cycle[0]):
break
moves.append((pred,head))
moves.append((head,pred))
head = pred
moves.append((tmp,head))
moves.append((head,tmp))
# Transform the moves to do in actual RiscV instructions
moves_instr: List[BlockInstr] = []
for dest, src in moves: