public static FunctionType Create(ExprType ret_type, List <Tuple <String, ExprType> > args, Boolean is_varargs)
{
Tuple <Int32, IReadOnlyList <Int32> > r_pack = Utils.PackArguments(args.ConvertAll(_ => _.Item2));
IReadOnlyList <Int32> offsets = r_pack.Item2;
if (ret_type is StructOrUnionType)
{
offsets = offsets.Select(_ => _ + 3 * SIZEOF_POINTER).ToList();
}
else
{
offsets = offsets.Select(_ => _ + 2 * SIZEOF_POINTER).ToList();
}
return(new FunctionType(
ret_type,
args.Zip(offsets,
(name_type, offset) => new Utils.StoreEntry(name_type.Item1, name_type.Item2, offset)
).ToList(),
is_varargs
));
}