Ajout qq trucs

This commit is contained in:
Mylloon 2023-12-31 20:28:45 +01:00
parent 4021911ba8
commit 57f67d98e6
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -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