File tree Expand file tree Collapse file tree 2 files changed +22
-9
lines changed Expand file tree Collapse file tree 2 files changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -169,14 +169,12 @@ let coerce ltyp rtyp exp = match ltyp,rtyp with
169
169
170
170
171
171
let create_arg size i intent name t (data ,exp ) sub =
172
- let ltyp = match size#bits t with
173
- | None -> Type. imm (Size. in_bits size#pointer)
174
- | Some m -> Type. imm m in
175
172
let layout = match data with
176
173
| Data. Ptr _ ->
177
174
if Bap_c_type. is_pointer t then layout size t
178
175
else layout size (Bap_c_type. pointer t)
179
176
| _ -> layout size t in
177
+ let ltyp = Type. imm (size_of_layout size layout) in
180
178
let rtyp = Type. infer_exn exp in
181
179
let name = if String. is_empty name then sprintf " arg%d" (i+ 1 ) else name in
182
180
let var = Var. create (Sub. name sub ^ " _" ^ name) ltyp in
@@ -633,6 +631,9 @@ module Arg = struct
633
631
with_hidden @@ fun () ->
634
632
register file (C.Type. pointer t)
635
633
634
+ let pointer file t =
635
+ register file (C.Type. pointer t)
636
+
636
637
let update_stack f =
637
638
let * s = Arg. get () in
638
639
match s.stack with
Original file line number Diff line number Diff line change @@ -322,17 +322,29 @@ module Arg : sig
322
322
@since 2.5.0 *)
323
323
val discard : ?n : int -> arena -> unit t
324
324
325
- (* * [reference arena t] passes the argument of type [t] as a pointer
326
- to [t] via the first available register in [arena].
325
+ (* * [reference arena t] passes a hidden pointer to [t] via
326
+ the first available register in [arena].
327
327
328
328
Rejects the computation if there are no available registers in
329
- [arena] or if the target doesn't have a register with the stack
330
- pointer role. The size of [t] is not required. *)
329
+ [arena]. The size of [t] is not required.
330
+
331
+ Note, that [reference] and [hidden] are increasing the number of
332
+ hidden arguments of a subroutine, but do not add the actual
333
+ arguments. *)
331
334
val reference : arena -> ctype -> unit t
332
335
333
336
334
- (* * [hidden t] passes the argument of type [t] as a pointer
335
- to [t] via the first available stack slot.
337
+ (* * [pointer arena t] passes argument [t] as a pointer.
338
+
339
+ Rejects the computation if [arena] is empty. The size of [t] is
340
+ not required.
341
+
342
+ @since 2.5.0 *)
343
+ val pointer : arena -> ctype -> unit t
344
+
345
+
346
+ (* * [hidden t] inserts a hidden pointer to [t] into the next
347
+ available stack slot.
336
348
337
349
The computation is rejected if the target doesn't have a stack.
338
350
You can’t perform that action at this time.
0 commit comments