merge conflict
This commit is contained in:
commit
9aa28054f7
1 changed files with 20 additions and 13 deletions
|
@ -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 *)
|
||||||
(* Ajout à la pile les variables présentent dans la liste *)
|
|
||||||
let add_stack stack list start op_addr =
|
let add_stack stack list start op_addr =
|
||||||
let stack, _ = List.fold_left
|
fst
|
||||||
(fun (stack,addr) id ->
|
(List.fold_left
|
||||||
S.IdMap.add id (Mint.of_int addr) stack,
|
(fun (stack, addr) id -> S.IdMap.add id (Mint.of_int addr) stack, op_addr addr)
|
||||||
op_addr addr)
|
|
||||||
(stack, start)
|
(stack, start)
|
||||||
list
|
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))
|
||||||
|
|
Reference in a new issue