diff --git a/MiniC/TP05/ExitSSA.py b/MiniC/TP05/ExitSSA.py index 15ce9f0..b609b51 100644 --- a/MiniC/TP05/ExitSSA.py +++ b/MiniC/TP05/ExitSSA.py @@ -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 diff --git a/MiniC/TP05/SequentializeMoves.py b/MiniC/TP05/SequentializeMoves.py index c6d39d8..b63e02d 100644 --- a/MiniC/TP05/SequentializeMoves.py +++ b/MiniC/TP05/SequentializeMoves.py @@ -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: