From 6a9dcaf891ccacd13b0d6f502069c65de9b78f14 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 31 Dec 2023 18:49:43 +0100 Subject: [PATCH] failwith --- flap/src/x86-64/retrolixToX86_64.ml | 38 ++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/flap/src/x86-64/retrolixToX86_64.ml b/flap/src/x86-64/retrolixToX86_64.ml index 66afedd..75f6153 100644 --- a/flap/src/x86-64/retrolixToX86_64.ml +++ b/flap/src/x86-64/retrolixToX86_64.ml @@ -458,37 +458,47 @@ module InstructionSelector : InstructionSelector = struct let bin ins ~dst ~srcl ~srcr = (* TODO *) - failwith "Students! This is your job!" + failwith "Students! This is your job! (bin)" ;; let add ~dst ~srcl ~srcr = (* TODO *) - failwith "Students! This is your job!" + failwith "Students! This is your job! (add)" ;; - let sub ~dst ~srcl ~srcr = move_execute imulq ~dst ~srcl ~srcr - let mul ~dst ~srcl ~srcr = move_execute imulq ~dst ~srcl ~srcr + let sub ~dst ~srcl ~srcr = + (* Soustraction *) + move_execute imulq ~dst ~srcl ~srcr + ;; + + let mul ~dst ~srcl ~srcr = + (* Multiplication *) + move_execute imulq ~dst ~srcl ~srcr + ;; let div ~dst ~srcl ~srcr = (* TODO *) - failwith "Students! This is your job!" + failwith "Students! This is your job! (div)" ;; - let andl ~dst ~srcl ~srcr = failwith "Students! This is your job!" + let andl ~dst ~srcl ~srcr = + (* TODO *) + failwith "Students! This is your job! (andl)" + ;; let orl ~dst ~srcl ~srcr = (* TODO *) - failwith "Students! This is your job!" + failwith "Students! This is your job! (orl)" ;; let conditional_jump ~cc ~srcl ~srcr ~ll ~lr = (* TODO *) - failwith "Students! This is your job!" + failwith "Students! This is your job! (conditional_jump)" ;; let switch ?default ~discriminant ~cases () = (* TODO *) - failwith "Students! This is your job!" + failwith "Students! This is your job! (switch)" ;; end @@ -519,9 +529,13 @@ module FrameManager (IS : InstructionSelector) : FrameManager = struct { param_count = 0; locals_space = 0; stack_map = S.IdMap.empty } ;; - let location_of fd id = - (* TODO *) - failwith "Students! This is your job! (location_of)" + 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 + } ;; let function_prologue fd =