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 =
|
||||
(* 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 () =
|
||||
|
@ -523,16 +530,15 @@ module FrameManager (IS : InstructionSelector) : FrameManager = struct
|
|||
+ ((if empty_frame fd then 0 else 1) * Mint.size_in_bytes)
|
||||
+ 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 =
|
||||
|
@ -543,9 +549,10 @@ module FrameManager (IS : InstructionSelector) : FrameManager = struct
|
|||
(* ON créé le frame descriptor ensuite*)
|
||||
{param_count = List.length params; locals_space = (List.length locals) * 8; stack_map = stack; }
|
||||
|
||||
|
||||
;;
|
||||
|
||||
|
||||
|
||||
let location_of fd id : T.address =
|
||||
(* TODO: use fd *)
|
||||
{ offset = Some (Lab (data_label_of_global id))
|
||||
|
|
Reference in a new issue