From 5a17c4164e2bc86f500bff516e0074c438169dc9 Mon Sep 17 00:00:00 2001 From: Nicolas PENELOUX Date: Mon, 1 Jan 2024 21:52:06 +0100 Subject: [PATCH] =?UTF-8?q?refonte=20location=5Fof=20pas=20s=C3=BBr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flap/src/x86-64/retrolixToX86_64.ml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flap/src/x86-64/retrolixToX86_64.ml b/flap/src/x86-64/retrolixToX86_64.ml index 913f952..9052a36 100644 --- a/flap/src/x86-64/retrolixToX86_64.ml +++ b/flap/src/x86-64/retrolixToX86_64.ml @@ -554,12 +554,12 @@ module FrameManager (IS : InstructionSelector) : FrameManager = struct let location_of fd id : T.address = - (* TODO: use fd *) - { offset = Some (Lab (data_label_of_global id)) - ; base = Some RIP - ; idx = None - ; scale = `One - } + + match S.IdMap.find_opt id fd.stack_map with + (* Si on retrouve id dans la stack map, alors c'est une variable locale*) + | Some o -> {offset = Some (Lit o); base = Some (RBP); idx = None; scale = `One;} + (* Sinon, variable globale*) + | None -> {offset = Some (Lab (data_label_of_global id)); base = Some (RIP); idx = None; scale = `One;} ;; open T (* Necessaire pour pouvoir créer des instructions*)