This commit is contained in:
Mylloon 2024-01-01 20:38:19 +01:00
parent 579e163f8e
commit 566f8e2d36
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -492,8 +492,15 @@ module InstructionSelector : InstructionSelector = struct
;;
let conditional_jump ~cc ~srcl ~srcr ~ll ~lr =
(* TODO *)
failwith "Students! This is your job! (conditional_jump)"
(* Déplace src left vers r15 *)
[ Instruction (movq ~src:srcl ~dst:r15)
(* Compare src right avec r15 (= src left) ***)
; Instruction (cmpq ~src1:srcr ~src2:r15)
(* Si condition est vrai jump vers le label ll *)
; Instruction (jccl ~cc ~tgt:ll)
(* Sinon on va jump vers le label lr par défaut *****)
; Instruction (jmpl ~tgt:lr)
]
;;
let switch ?default ~discriminant ~cases () =