This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Ada] Ease interface with builtins that returns void *


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 *.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]