This commit is contained in:
Mylloon 2024-01-02 02:20:54 +01:00
parent 4db39f807f
commit fba41fee18
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -452,28 +452,24 @@ module InstructionSelector : InstructionSelector = struct
| _ -> execute ~dst (movq ~src) | _ -> execute ~dst (movq ~src)
;; ;;
let move_execute f ~dst ~srcl ~srcr =
mov ~src:srcr ~dst:r15 @ execute ~dst (f ~src:srcl)
;;
let bin ins ~dst ~srcl ~srcr = let bin ins ~dst ~srcl ~srcr =
(* TODO *) (* Opération binaire *)
failwith "Students! This is your job! (bin)" mov ~src:srcr ~dst:r15 @ execute ~dst (ins ~src:srcl)
;; ;;
let add ~dst ~srcl ~srcr = let add ~dst ~srcl ~srcr =
(* Addition *) (* Addition *)
move_execute addq ~dst ~srcl ~srcr bin addq ~dst ~srcl ~srcr
;; ;;
let sub ~dst ~srcl ~srcr = let sub ~dst ~srcl ~srcr =
(* Soustraction *) (* Soustraction *)
move_execute subq ~dst ~srcl:srcr ~srcr:srcl bin subq ~dst ~srcl:srcr ~srcr:srcl
;; ;;
let mul ~dst ~srcl ~srcr = let mul ~dst ~srcl ~srcr =
(* Multiplication *) (* Multiplication *)
move_execute imulq ~dst ~srcl ~srcr bin imulq ~dst ~srcl ~srcr
;; ;;
let div ~dst ~srcl ~srcr = let div ~dst ~srcl ~srcr =
@ -489,12 +485,12 @@ module InstructionSelector : InstructionSelector = struct
let andl ~dst ~srcl ~srcr = let andl ~dst ~srcl ~srcr =
(* ET *) (* ET *)
move_execute andq ~dst ~srcl ~srcr bin andq ~dst ~srcl ~srcr
;; ;;
let orl ~dst ~srcl ~srcr = let orl ~dst ~srcl ~srcr =
(* OU *) (* OU *)
move_execute orq ~dst ~srcl ~srcr bin orq ~dst ~srcl ~srcr
;; ;;
let conditional_jump ~cc ~srcl ~srcr ~ll ~lr = let conditional_jump ~cc ~srcl ~srcr ~ll ~lr =