On Jul 16, 2012, at 3:16 PM, Duncan Sands wrote:

> 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?

Formal arguments were already handled.

Tristan.

> 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  <ging...@adacore.com>
>> 
>>      * gcc-interface/decl.c (intrin_return_compatible_p): Map Address to
>>      void *.
>> 
> 
> 

Reply via email to