From e71edea69caa8ae09083b63f8f51a8e796a8489e Mon Sep 17 00:00:00 2001 From: Mylloon Date: Mon, 1 Jan 2024 20:16:08 +0100 Subject: [PATCH] fmt --- flap/src/x86-64/retrolixToX86_64.ml | 36 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/flap/src/x86-64/retrolixToX86_64.ml b/flap/src/x86-64/retrolixToX86_64.ml index 2fc17f4..d5f2d47 100644 --- a/flap/src/x86-64/retrolixToX86_64.ml +++ b/flap/src/x86-64/retrolixToX86_64.ml @@ -522,28 +522,26 @@ module FrameManager (IS : InstructionSelector) : FrameManager = struct Mint.size_in_bytes + ((if empty_frame fd then 0 else 1) * Mint.size_in_bytes) + fd.locals_space - - 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 = - (* TODO: Student! Implement me! *) - let stack = add_stack S.IdMap.empty locals (-8) (fun x -> x - 8) in - let stack = add_stack stack params 16 (fun x -> x + 8) in - {param_count = List.length params; locals_space = (List.length locals) * 8; stack_map = stack; } - ;; - (* 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 = + (* Ajout à la pile les variables présentent dans la liste *) + let stack = add_stack S.IdMap.empty locals (-8) (fun x -> x - 8) in + let stack = add_stack stack params 16 (fun x -> x + 8) in + { param_count = List.length params + ; locals_space = List.length locals * 8 + ; stack_map = stack + } ;; let location_of fd id : T.address =