[Ada] Improve handling of explicit by-reference mechanism
This improves the handling of an explicit by-reference passing mechanism
specified by means of the GNAT pragma Export_Function. This device sort
of circumvents the rules of the language for the by-reference passing
mechanism and it's then up to the programmer to ensure that the actual
parameter is addressable; if it is not, the compiler will generate a
temporary around the call, thus effectively passing the actual by copy.
It turns out that the compiler was too conservative when determining
whether the actual parameter is addressable, in particular if it's a
component of a record type subject to a representation clause.
The change effectively moves this computation from the front-end to the
back-end, which has much more information on the layout and alignment
of types and thus can be less conservative.
2019-09-19 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_ch6.adb (Is_Legal_Copy): Also return false for an aliased
formal and a formal passed by reference in convention Ada. Add
missing guard to the existing test on Is_Valued_Procedure.
From-SVN: r275931