Correction de l'erreur sur le sens des moves
This commit is contained in:
parent
0a8c02ec83
commit
0647039a4c
@ -53,7 +53,7 @@ def generate_moves_from_phis_smart(pool: TemporaryPool, phis: List[PhiNode], par
|
|||||||
if(isinstance(dest,Temporary)):
|
if(isinstance(dest,Temporary)):
|
||||||
dest = pool.get_alloced_loc(dest)
|
dest = pool.get_alloced_loc(dest)
|
||||||
assert(isinstance(dest,DataLocation))
|
assert(isinstance(dest,DataLocation))
|
||||||
moves.append((dest,src))
|
moves.append((src,dest))
|
||||||
realmoves = sequentialize_moves(set(moves))
|
realmoves = sequentialize_moves(set(moves))
|
||||||
return realmoves
|
return realmoves
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ def generate_smart_move(dest: DataLocation, src: DataLocation) -> List[BlockInst
|
|||||||
instr.append(RiscV.ld(dest,src))
|
instr.append(RiscV.ld(dest,src))
|
||||||
elif(isinstance(dest,Register) and isinstance(src,Register)):
|
elif(isinstance(dest,Register) and isinstance(src,Register)):
|
||||||
# Classic move
|
# Classic move
|
||||||
instr.append(RiscV.mv(src,dest))
|
instr.append(RiscV.mv(dest,src))
|
||||||
else:
|
else:
|
||||||
raise MiniCInternalError("Cannot generate smart move from parameters that are no Offset or Register:",src,dest)
|
raise MiniCInternalError("Cannot generate smart move from parameters that are no Offset or Register:",src,dest)
|
||||||
return instr
|
return instr
|
||||||
@ -61,7 +61,7 @@ def sequentialize_moves(parallel_moves: Set[Tuple[DataLocation, DataLocation]]
|
|||||||
head = None
|
head = None
|
||||||
else:
|
else:
|
||||||
pred = preds.pop()
|
pred = preds.pop()
|
||||||
moves.append((pred,head))
|
moves.append((head,pred))
|
||||||
move_graph.delete_vertex(head)
|
move_graph.delete_vertex(head)
|
||||||
head = pred
|
head = pred
|
||||||
|
|
||||||
@ -73,14 +73,14 @@ def sequentialize_moves(parallel_moves: Set[Tuple[DataLocation, DataLocation]]
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
head = cycle[0]
|
head = cycle[0]
|
||||||
moves.append((head,tmp))
|
moves.append((tmp,head))
|
||||||
while True:
|
while True:
|
||||||
pred = move_graph.pred(head).pop()
|
pred = move_graph.pred(head).pop()
|
||||||
if(pred==cycle[0]):
|
if(pred==cycle[0]):
|
||||||
break
|
break
|
||||||
moves.append((pred,head))
|
moves.append((head,pred))
|
||||||
head = pred
|
head = pred
|
||||||
moves.append((tmp,head))
|
moves.append((head,tmp))
|
||||||
# Transform the moves to do in actual RiscV instructions
|
# Transform the moves to do in actual RiscV instructions
|
||||||
moves_instr: List[BlockInstr] = []
|
moves_instr: List[BlockInstr] = []
|
||||||
for dest, src in moves:
|
for dest, src in moves:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user