refonte location_of pas sûr

This commit is contained in:
Nicolas PENELOUX 2024-01-01 21:52:06 +01:00
parent 9aa28054f7
commit 5a17c4164e

View file

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