[0/4] Middle-end groundwork for GFortran TRANSFER intrinsic.

Brooks Moses brooks.moses@codesourcery.com
Fri Apr 6 22:19:00 GMT 2007


Paul Thomas and I have recently been working on a constant-folding 
implementation of the TRANSFER intrinsic in GFortran.  For those 
unfamiliar with Fortran, the TRANSFER intrinsic is roughly equivalent to 
a pointer type cast, in that it takes the physical representation of a 
variable of one type, and interprets it as a variable of another type. 
The complication comes in the fact that the Fortran standard requires 
that this be calculable at compile time in some cases, and thus we need 
to have the ability to simulate target memory accesses on the host.

These patches set up the necessary groundwork for the implementation 
within the GCC middle-end.  In particular, GCC and GFortran both have 
code to convert from MPFR to REAL_VALUE_TYPE representations, and from 
GMP to double_int representations.  Parts 1, 2, and 4 consolidate those 
and export the relevant GCC functions where needed, and add the 
reverse-direction tree-to-GMP/MPFR conversion functions to GFortran 
using the existing GCC code.  Also, the TRANSFER intrinsic needs access 
to the native_encode_expr and native_interpret_expr functions in 
fold-const.c, so Part 3 makes those non-static.

- Brooks



More information about the Gcc-patches mailing list