From caa9d12a2b675da20f5a3016e6f306a84ee96a2a Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 24 Apr 2009 08:04:38 +0000 Subject: ttypes.ads (Target_Double_Float_Alignment): New variable. * ttypes.ads (Target_Double_Float_Alignment): New variable. (Target_Double_Scalar_Alignment): Likewise. * get_targ.ads (Get_Strict_Alignment): Adjust external name. (Get_Double_Float_Alignment): New imported function. (Get_Double_Scalar_Alignment): Likewise. * layout.adb (Set_Elem_Alignment): Take into account specific caps for the alignment of "double" floating-point types and "double" or larger scalar types, as parameterized by Target_Double_Float_Alignment and Target_Double_Scalar_Alignment respectively. * gcc-interface/gigi.h (double_float_alignment): Declare. (double_scalar_alignment): Likewise. (is_double_float_or_array): Likewise. (is_double_scalar_or_array): Likewise. (get_target_double_float_alignment): Likewise. (get_target_double_scalar_alignment): Likewise. * gcc-interface/targtyps.c (get_strict_alignment): Rename into... (get_target_strict_alignment): ...this. (get_target_double_float_alignment): New function. (get_target_double_scalar_alignment): Likewise. * gcc-interface/decl.c (gnat_to_gnu_entity) : Test the presence of an alignment clause for under-aligned integer types. Take into account specific caps for the alignment of "double" floating-point types and "double" or larger scalar types, as parameterized by Target_Double_Float_Alignment and Target_Double_Scalar_Alignment respectively. (validate_alignment): Likewise. * gcc-interface/trans.c (Attribute_to_gnu) : Likewise. (gigi): Initialize double_float_alignment and double_scalar_alignment. * gcc-interface/utils.c (double_float_alignment): New global variable. (double_scalar_alignment): Likewise. (is_double_float_or_array): New predicate. (is_double_scalar_or_array): Likewise. From-SVN: r146675 --- gcc/ada/layout.adb | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'gcc/ada/layout.adb') diff --git a/gcc/ada/layout.adb b/gcc/ada/layout.adb index 7c39220..4e72153 100644 --- a/gcc/ada/layout.adb +++ b/gcc/ada/layout.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2009, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -3033,15 +3033,36 @@ package body Layout is -- the type, or the maximum allowed alignment. declare - S : constant Int := - UI_To_Int (Esize (E)) / SSU; - A : Nat; + S : constant Int := UI_To_Int (Esize (E)) / SSU; + Max_Alignment, A : Nat; begin + -- If the default alignment of "double" floating-point types is + -- specifically capped, enforce the cap. + + if Ttypes.Target_Double_Float_Alignment > 0 + and then S = 8 + and then Is_Floating_Point_Type (E) + then + Max_Alignment := Ttypes.Target_Double_Float_Alignment; + + -- If the default alignment of "double" or larger scalar types is + -- specifically capped, enforce the cap. + + elsif Ttypes.Target_Double_Scalar_Alignment > 0 + and then S >= 8 + and then Is_Scalar_Type (E) + then + Max_Alignment := Ttypes.Target_Double_Scalar_Alignment; + + -- Otherwise enforce the overall alignment cap + + else + Max_Alignment := Ttypes.Maximum_Alignment; + end if; + A := 1; - while 2 * A <= Ttypes.Maximum_Alignment - and then 2 * A <= S - loop + while 2 * A <= Max_Alignment and then 2 * A <= S loop A := 2 * A; end loop; -- cgit v1.1