From 57f67d98e6c9d4b609e6c17d58d410d42b971414 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 31 Dec 2023 20:28:45 +0100 Subject: [PATCH] Ajout qq trucs --- flap/src/x86-64/retrolixToX86_64.ml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/flap/src/x86-64/retrolixToX86_64.ml b/flap/src/x86-64/retrolixToX86_64.ml index 75f6153..7237741 100644 --- a/flap/src/x86-64/retrolixToX86_64.ml +++ b/flap/src/x86-64/retrolixToX86_64.ml @@ -438,9 +438,9 @@ module InstructionSelector : InstructionSelector = struct ;; let mov ~(dst : dst) ~(src : src) = + match src, dst with (* Si les sources sont égaux (même adresse ou même registre), on ne bouge rien *) - match src, dst with | `Reg x, `Reg y when x = y -> [] | `Addr x, `Addr y when x = y -> [] (* Si au moins un des deux est un accès mémoire, @@ -462,13 +462,13 @@ module InstructionSelector : InstructionSelector = struct ;; let add ~dst ~srcl ~srcr = - (* TODO *) - failwith "Students! This is your job! (add)" + (* Addition *) + move_execute addq ~dst ~srcl ~srcr ;; let sub ~dst ~srcl ~srcr = (* Soustraction *) - move_execute imulq ~dst ~srcl ~srcr + move_execute subq ~dst ~srcl ~srcr ;; let mul ~dst ~srcl ~srcr = @@ -482,13 +482,13 @@ module InstructionSelector : InstructionSelector = struct ;; let andl ~dst ~srcl ~srcr = - (* TODO *) - failwith "Students! This is your job! (andl)" + (* ET *) + move_execute andq ~dst ~srcl ~srcr ;; let orl ~dst ~srcl ~srcr = - (* TODO *) - failwith "Students! This is your job! (orl)" + (* OU *) + move_execute orq ~dst ~srcl ~srcr ;; let conditional_jump ~cc ~srcl ~srcr ~ll ~lr = @@ -549,8 +549,9 @@ module FrameManager (IS : InstructionSelector) : FrameManager = struct ;; let call fd ~kind ~f ~args = - (* TODO *) - failwith "Students! This is your job! (call)" + (* TODO: je segfault.. *) + (* Appelle la fonction *) + [ T.Instruction (T.calldi ~tgt:f) ] ;; end