[Ada] Ease interface with builtins that returns void *
Duncan Sands
baldrick@free.fr
Mon Jul 16 13:16:00 GMT 2012
Hi Arnaud,
> The natural way to import a builtin that returns void * is to use
> System.Address in Ada, which is in fact an integral type.
how about doing this for formal arguments too and not just the return type?
This would improve optimization by LLVM of calls to standard library functions
since the optimizers bail out when they see an "int" parameter where normally
there would be a void* (or other pointer type).
Ciao, Duncan.
>
> Addressed by this patch, which makes it possible to e.g. compile:
>
> with System;
> procedure Btins1 is
>
> function Frame_Address (Level : Integer) return System.Address;
> pragma Import (Intrinsic, Frame_Address, "__builtin_frame_address");
>
> Ptr : System.Address;
> pragma Volatile (Ptr);
> begin
> Ptr := Frame_Address (0);
> end;
>
> Tested on x86_64-pc-linux-gnu, committed on trunk
>
> 2012-07-16 Tristan Gingold <gingold@adacore.com>
>
> * gcc-interface/decl.c (intrin_return_compatible_p): Map Address to
> void *.
>
More information about the Gcc-patches
mailing list