This commit is contained in:
Mylloon 2023-12-31 14:30:16 +01:00
parent 07a65e7bcb
commit 66c374b28f
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -426,16 +426,55 @@ end
module InstructionSelector : InstructionSelector = struct module InstructionSelector : InstructionSelector = struct
open T open T
let mov ~(dst : dst) ~(src : src) = failwith "Students! This is your job!" let mov ~(dst : dst) ~(src : src) =
let bin ins ~dst ~srcl ~srcr = failwith "Students! This is your job!" (* TODO *)
let add ~dst ~srcl ~srcr = failwith "Students! This is your job!" failwith "Students! This is your job!"
let sub ~dst ~srcl ~srcr = failwith "Students! This is your job!" ;;
let mul ~dst ~srcl ~srcr = failwith "Students! This is your job!"
let div ~dst ~srcl ~srcr = failwith "Students! This is your job!" let bin ins ~dst ~srcl ~srcr =
let andl ~dst ~srcl ~srcr = failwith "Students! This is your job!" (* TODO *)
let orl ~dst ~srcl ~srcr = failwith "Students! This is your job!" failwith "Students! This is your job!"
let conditional_jump ~cc ~srcl ~srcr ~ll ~lr = failwith "Students! This is your job!" ;;
let switch ?default ~discriminant ~cases () = failwith "Students! This is your job!"
let add ~dst ~srcl ~srcr =
(* TODO *)
failwith "Students! This is your job!"
;;
let sub ~dst ~srcl ~srcr =
(* TODO *)
failwith "Students! This is your job!"
;;
let mul ~dst ~srcl ~srcr =
(* TODO *)
failwith "Students! This is your job!"
;;
let div ~dst ~srcl ~srcr =
(* TODO *)
failwith "Students! This is your job!"
;;
let andl ~dst ~srcl ~srcr =
(* TODO *)
failwith "Students! This is your job!"
;;
let orl ~dst ~srcl ~srcr =
(* TODO *)
failwith "Students! This is your job!"
;;
let conditional_jump ~cc ~srcl ~srcr ~ll ~lr =
(* TODO *)
failwith "Students! This is your job!"
;;
let switch ?default ~discriminant ~cases () =
(* TODO *)
failwith "Students! This is your job!"
;;
end end
module FrameManager (IS : InstructionSelector) : FrameManager = struct module FrameManager (IS : InstructionSelector) : FrameManager = struct
@ -461,23 +500,29 @@ module FrameManager (IS : InstructionSelector) : FrameManager = struct
;; ;;
let frame_descriptor ~params ~locals = let frame_descriptor ~params ~locals =
(* Student! Implement me! *) (* TODO: Student! Implement me! *)
{ param_count = 0; locals_space = 0; stack_map = S.IdMap.empty } { param_count = 0; locals_space = 0; stack_map = S.IdMap.empty }
;; ;;
let location_of fd id = failwith "Students! This is your job!" let location_of fd id =
(* TODO *)
failwith "Students! This is your job!"
;;
let function_prologue fd = let function_prologue fd =
(* Student! Implement me! *) (* TODO: Student! Implement me! *)
[] []
;; ;;
let function_epilogue fd = let function_epilogue fd =
(* Student! Implement me! *) (* TODO: Student! Implement me! *)
[] []
;; ;;
let call fd ~kind ~f ~args = failwith "Students! This is your job!" let call fd ~kind ~f ~args =
(* TODO *)
failwith "Students! This is your job!"
;;
end end
module CG = Codegen (InstructionSelector) (FrameManager (InstructionSelector)) module CG = Codegen (InstructionSelector) (FrameManager (InstructionSelector))