aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnat/s-pack70.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/libgnat/s-pack70.adb')
-rw-r--r--gcc/ada/libgnat/s-pack70.adb42
1 files changed, 26 insertions, 16 deletions
diff --git a/gcc/ada/libgnat/s-pack70.adb b/gcc/ada/libgnat/s-pack70.adb
index 9432384..aa320f6 100644
--- a/gcc/ada/libgnat/s-pack70.adb
+++ b/gcc/ada/libgnat/s-pack70.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_70 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);
-- The following declarations are for the case where the address
-- passed to GetU_70 or SetU_70 is not guaranteed to be aligned.
@@ -84,12 +89,13 @@ package body System.Pack_70 is
type ClusterU is new Cluster;
for ClusterU'Alignment use 1;
- type ClusterU_Ref is access ClusterU;
+ package AACU is new Address_To_Access_Conversions (ClusterU);
type Rev_ClusterU is new ClusterU
with Bit_Order => Reverse_Bit_Order,
Scalar_Storage_Order => Reverse_Bit_Order;
- type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU);
------------
-- Get_70 --
@@ -100,9 +106,10 @@ package body System.Pack_70 is
N : Natural;
Rev_SSO : Boolean) return Bits_70
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
@@ -138,9 +145,10 @@ package body System.Pack_70 is
N : Natural;
Rev_SSO : Boolean) return Bits_70
is
- A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
- C : ClusterU_Ref with Address => A'Address, Import;
- RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : constant AACU.Object_Pointer := AACU.To_Pointer (A);
+ RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A);
+
begin
return
(if Rev_SSO then
@@ -177,9 +185,10 @@ package body System.Pack_70 is
E : Bits_70;
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
@@ -216,9 +225,10 @@ package body System.Pack_70 is
E : Bits_70;
Rev_SSO : Boolean)
is
- A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
- C : ClusterU_Ref with Address => A'Address, Import;
- RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : constant AACU.Object_Pointer := AACU.To_Pointer (A);
+ RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A);
+
begin
if Rev_SSO then
case N07 (Uns (N) mod 8) is