aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/StructPassing.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2018-03-09 14:41:15 +0100
committerXavier Leroy <xavier.leroy@inria.fr>2018-03-09 14:41:15 +0100
commita45ddea290008a8a340f3a2b076268e04f80bab4 (patch)
tree2552e17e035dc4dbf0a014d94ddfc25261a0bd49 /cparser/StructPassing.ml
parent49bc45ed256f2d4d68ddab6868a2de06a67647be (diff)
downloadcompcert-kvx-a45ddea290008a8a340f3a2b076268e04f80bab4.tar.gz
compcert-kvx-a45ddea290008a8a340f3a2b076268e04f80bab4.zip
StructPassing and annotations, continued
struct/union arguments to annotations should not be transformed at top level, but the regular function calls contained within must be transformed recursively.
Diffstat (limited to 'cparser/StructPassing.ml')
-rw-r--r--cparser/StructPassing.ml16
1 files changed, 7 insertions, 9 deletions
diff --git a/cparser/StructPassing.ml b/cparser/StructPassing.ml
index 10aa6fd5..5c6454f0 100644
--- a/cparser/StructPassing.ml
+++ b/cparser/StructPassing.ml
@@ -317,23 +317,21 @@ let rec transf_expr env ctx e =
and transf_call env ctx opt_lhs fn args ty =
let ty' = transf_type env ty in
let fn' = transf_expr env Val fn in
- let (assignments, args') = transf_arguments env args in
let opt_eassign e =
match opt_lhs with
| None -> e
| Some lhs -> eassign lhs e in
match fn with
- | {edesc = EVar { C.name = "__builtin_annot"
+ | {edesc = EVar { C.name = "__builtin_va_arg"
+ | "__builtin_annot"
| "__builtin_annot_intval"
| "__builtin_ais_annot" } } ->
- (* Do not transform the call in this case, just use the default
- pass-by-reference mode for struct/union arguments. *)
- opt_eassign {edesc = ECall(fn, args); etyp = ty}
- | {edesc = EVar { C.name = "__builtin_va_arg" } } ->
- (* Do not transform the call in this case, just use the default
- pass-by-reference mode for struct/union arguments. *)
- opt_eassign {edesc = ECall(fn, args'); etyp = ty}
+ (* Do not transform the call in this case, just use the default
+ pass-by-reference mode for struct/union arguments. *)
+ let args' = List.map (fun arg -> transf_expr env Val arg) args in
+ opt_eassign {edesc = ECall(fn, args'); etyp = ty}
| _ ->
+ let (assignments, args') = transf_arguments env args in
let call =
match classify_return env ty with
| Ret_scalar ->