merge conflict

This commit is contained in:
Nicolas PENELOUX 2024-01-01 20:55:12 +01:00
commit 9aa28054f7

View file

@ -492,8 +492,15 @@ module InstructionSelector : InstructionSelector = struct
;; ;;
let conditional_jump ~cc ~srcl ~srcr ~ll ~lr = let conditional_jump ~cc ~srcl ~srcr ~ll ~lr =
(* TODO *) (* Déplace src left vers r15 *)
failwith "Students! This is your job! (conditional_jump)" [ 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 () = let switch ?default ~discriminant ~cases () =
@ -523,16 +530,15 @@ module FrameManager (IS : InstructionSelector) : FrameManager = struct
+ ((if empty_frame fd then 0 else 1) * Mint.size_in_bytes) + ((if empty_frame fd then 0 else 1) * Mint.size_in_bytes)
+ fd.locals_space + fd.locals_space
(* Ajoute les éléments de liste sur la pile *)
let add_stack stack list start op_addr =
fst
(List.fold_left
(fun (stack, addr) id -> S.IdMap.add id (Mint.of_int addr) stack, op_addr addr)
(stack, start)
list)
(* Ajout à la pile les variables présentent dans la liste *)
let add_stack stack list start op_addr =
let stack, _ = List.fold_left
(fun (stack,addr) id ->
S.IdMap.add id (Mint.of_int addr) stack,
op_addr addr)
(stack,start)
list
in stack
let frame_descriptor ~params ~locals = let frame_descriptor ~params ~locals =
@ -543,9 +549,10 @@ module FrameManager (IS : InstructionSelector) : FrameManager = struct
(* ON créé le frame descriptor ensuite*) (* ON créé le frame descriptor ensuite*)
{param_count = List.length params; locals_space = (List.length locals) * 8; stack_map = stack; } {param_count = List.length params; locals_space = (List.length locals) * 8; stack_map = stack; }
;; ;;
let location_of fd id : T.address = let location_of fd id : T.address =
(* TODO: use fd *) (* TODO: use fd *)
{ offset = Some (Lab (data_label_of_global id)) { offset = Some (Lab (data_label_of_global id))