I read the document and it says that "Call" can be used to create va_arg calls.
I did the following things, but it doesn't work.
First, I define a variable:

let __builtin_va_arg: varinfo option ref = ref None;;

Then, I use a visitor class to visit all variables and assign the
variable to __builtin_va_arg if a variable's name is
"__builtin_va_arg". I suppose in this way the correct varinfo of
__builtin_va_arg can be get.
Then, I create the call like this (assuming ap is the va_list, and typ
is the type):
let call = Call(Some lval, Lval (var __builtin_va_arg), [Lval(var ap);
SizeOf(typ)]).
The resulting code in generated code of va_arg(ap, int) is:
__builtin_va_arg(ap, sizeof(int))
rather than
__builtin_va_arg(ap, int)
Does any know how to create a va_arg call with a va_list and a type.

------------------------------------------------------------------------------
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to