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*)