diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2024-09-20 20:24:55 +0200 |
---|---|---|
committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2024-11-12 14:00:51 +0100 |
commit | 2ae3bbe5b8afe60cb13b6a3314f39e6aa99b7e37 (patch) | |
tree | 1296363950d11439e8840c60f054c50861d80b0d /gcc/ada/libgnat/s-pack119.adb | |
parent | 220360870b03e81421d10a916a1a4b5f6d87b223 (diff) | |
download | gcc-2ae3bbe5b8afe60cb13b6a3314f39e6aa99b7e37.zip gcc-2ae3bbe5b8afe60cb13b6a3314f39e6aa99b7e37.tar.gz gcc-2ae3bbe5b8afe60cb13b6a3314f39e6aa99b7e37.tar.bz2 |
ada: Remove use of overlays in implementation of System.Pack_N units
The implementation uses an overlay between an address and an access value,
which is convoluted. This changes it to use a direct conversion instead.
No functional changes (and no changes to generated code at -O2).
gcc/ada/ChangeLog:
* s-pack.adb.tmpl: Add "with System.Address_To_Access_Conversions".
(Cluster_Ref): Delete.
(AAC): New instance of System.Address_To_Access_Conversions.
(Rev_Cluster_Ref): Delete.
(Rev_ACC): New instance of System.Address_To_Access_Conversions.
(ClusterU_Ref): Delete.
(AACU): New instance of System.Address_To_Access_Conversions.
(Rev_ClusterU_Ref): Delete.
(Rev_ACCU): New instance of System.Address_To_Access_Conversions.
(Get_@@): Use a direct address-to-access conversion.
(GetU_@@): Likewise.
(Set_@@): Likewise.
(SetU_@@): Likewise.
* libgnat/s-pack03.adb: Regenerate.
* libgnat/s-pack05.adb: Likewise.
* libgnat/s-pack06.adb: Likewise.
* libgnat/s-pack07.adb: Likewise.
* libgnat/s-pack09.adb: Likewise.
* libgnat/s-pack10.adb: Likewise.
* libgnat/s-pack100.adb: Likewise.
* libgnat/s-pack101.adb: Likewise.
* libgnat/s-pack102.adb: Likewise.
* libgnat/s-pack103.adb: Likewise.
* libgnat/s-pack104.adb: Likewise.
* libgnat/s-pack105.adb: Likewise.
* libgnat/s-pack106.adb: Likewise.
* libgnat/s-pack107.adb: Likewise.
* libgnat/s-pack108.adb: Likewise.
* libgnat/s-pack109.adb: Likewise.
* libgnat/s-pack11.adb: Likewise.
* libgnat/s-pack110.adb: Likewise.
* libgnat/s-pack111.adb: Likewise.
* libgnat/s-pack112.adb: Likewise.
* libgnat/s-pack113.adb: Likewise.
* libgnat/s-pack114.adb: Likewise.
* libgnat/s-pack115.adb: Likewise.
* libgnat/s-pack116.adb: Likewise.
* libgnat/s-pack117.adb: Likewise.
* libgnat/s-pack118.adb: Likewise.
* libgnat/s-pack119.adb: Likewise.
* libgnat/s-pack12.adb: Likewise.
* libgnat/s-pack120.adb: Likewise.
* libgnat/s-pack121.adb: Likewise.
* libgnat/s-pack122.adb: Likewise.
* libgnat/s-pack123.adb: Likewise.
* libgnat/s-pack124.adb: Likewise.
* libgnat/s-pack125.adb: Likewise.
* libgnat/s-pack126.adb: Likewise.
* libgnat/s-pack127.adb: Likewise.
* libgnat/s-pack13.adb: Likewise.
* libgnat/s-pack14.adb: Likewise.
* libgnat/s-pack15.adb: Likewise.
* libgnat/s-pack17.adb: Likewise.
* libgnat/s-pack18.adb: Likewise.
* libgnat/s-pack19.adb: Likewise.
* libgnat/s-pack20.adb: Likewise.
* libgnat/s-pack21.adb: Likewise.
* libgnat/s-pack22.adb: Likewise.
* libgnat/s-pack23.adb: Likewise.
* libgnat/s-pack24.adb: Likewise.
* libgnat/s-pack25.adb: Likewise.
* libgnat/s-pack26.adb: Likewise.
* libgnat/s-pack27.adb: Likewise.
* libgnat/s-pack28.adb: Likewise.
* libgnat/s-pack29.adb: Likewise.
* libgnat/s-pack30.adb: Likewise.
* libgnat/s-pack31.adb: Likewise.
* libgnat/s-pack33.adb: Likewise.
* libgnat/s-pack34.adb: Likewise.
* libgnat/s-pack35.adb: Likewise.
* libgnat/s-pack36.adb: Likewise.
* libgnat/s-pack37.adb: Likewise.
* libgnat/s-pack38.adb: Likewise.
* libgnat/s-pack39.adb: Likewise.
* libgnat/s-pack40.adb: Likewise.
* libgnat/s-pack41.adb: Likewise.
* libgnat/s-pack42.adb: Likewise.
* libgnat/s-pack43.adb: Likewise.
* libgnat/s-pack44.adb: Likewise.
* libgnat/s-pack45.adb: Likewise.
* libgnat/s-pack46.adb: Likewise.
* libgnat/s-pack47.adb: Likewise.
* libgnat/s-pack48.adb: Likewise.
* libgnat/s-pack49.adb: Likewise.
* libgnat/s-pack50.adb: Likewise.
* libgnat/s-pack51.adb: Likewise.
* libgnat/s-pack52.adb: Likewise.
* libgnat/s-pack53.adb: Likewise.
* libgnat/s-pack54.adb: Likewise.
* libgnat/s-pack55.adb: Likewise.
* libgnat/s-pack56.adb: Likewise.
* libgnat/s-pack57.adb: Likewise.
* libgnat/s-pack58.adb: Likewise.
* libgnat/s-pack59.adb: Likewise.
* libgnat/s-pack60.adb: Likewise.
* libgnat/s-pack61.adb: Likewise.
* libgnat/s-pack62.adb: Likewise.
* libgnat/s-pack63.adb: Likewise.
* libgnat/s-pack65.adb: Likewise.
* libgnat/s-pack66.adb: Likewise.
* libgnat/s-pack67.adb: Likewise.
* libgnat/s-pack68.adb: Likewise.
* libgnat/s-pack69.adb: Likewise.
* libgnat/s-pack70.adb: Likewise.
* libgnat/s-pack71.adb: Likewise.
* libgnat/s-pack72.adb: Likewise.
* libgnat/s-pack73.adb: Likewise.
* libgnat/s-pack74.adb: Likewise.
* libgnat/s-pack75.adb: Likewise.
* libgnat/s-pack76.adb: Likewise.
* libgnat/s-pack77.adb: Likewise.
* libgnat/s-pack78.adb: Likewise.
* libgnat/s-pack79.adb: Likewise.
* libgnat/s-pack80.adb: Likewise.
* libgnat/s-pack81.adb: Likewise.
* libgnat/s-pack82.adb: Likewise.
* libgnat/s-pack83.adb: Likewise.
* libgnat/s-pack84.adb: Likewise.
* libgnat/s-pack85.adb: Likewise.
* libgnat/s-pack86.adb: Likewise.
* libgnat/s-pack87.adb: Likewise.
* libgnat/s-pack88.adb: Likewise.
* libgnat/s-pack89.adb: Likewise.
* libgnat/s-pack90.adb: Likewise.
* libgnat/s-pack91.adb: Likewise.
* libgnat/s-pack92.adb: Likewise.
* libgnat/s-pack93.adb: Likewise.
* libgnat/s-pack94.adb: Likewise.
* libgnat/s-pack95.adb: Likewise.
* libgnat/s-pack96.adb: Likewise.
* libgnat/s-pack97.adb: Likewise.
* libgnat/s-pack98.adb: Likewise.
* libgnat/s-pack99.adb: Likewise.
Diffstat (limited to 'gcc/ada/libgnat/s-pack119.adb')
-rw-r--r-- | gcc/ada/libgnat/s-pack119.adb | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/gcc/ada/libgnat/s-pack119.adb b/gcc/ada/libgnat/s-pack119.adb index dd27b4c..5351727 100644 --- a/gcc/ada/libgnat/s-pack119.adb +++ b/gcc/ada/libgnat/s-pack119.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_119 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_119 -- @@ -85,9 +90,10 @@ package body System.Pack_119 is N : Natural; Rev_SSO : Boolean) return Bits_119 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_119 is E : Bits_119; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is |