implement size_ty
Signed-off-by: Mariano Uvalle <u.g.a.mariano@gmail.com>
This commit is contained in:
parent
ca3e1df031
commit
ea32e468a3
1 changed files with 6 additions and 1 deletions
|
|
@ -173,7 +173,12 @@ let compile_operand (ctxt : ctxt) (dest : X86.operand) : Ll.operand -> ins = fun
|
|||
Your function should simply return 0 in those cases
|
||||
*)
|
||||
let rec size_ty (tdecls : (tid * ty) list) (t : Ll.ty) : int =
|
||||
failwith "size_ty not implemented"
|
||||
match t with
|
||||
| Struct tl -> List.fold_left (fun acc st -> acc + size_ty tdecls st) 0 tl
|
||||
| Array (sz, at) -> sz * size_ty tdecls at
|
||||
| Namedt lb -> size_ty tdecls (lookup tdecls lb)
|
||||
| I1 | I64 | Ptr _ -> 8
|
||||
| Void | I8 | Fun _ -> 0
|
||||
;;
|
||||
|
||||
(* Generates code that computes a pointer value.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue