From 1ddde8dca28e6e8d35db1782938d33e5320145e2 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 2 Oct 2015 09:18:34 +0000 Subject: ada-tree.h (DECL_RESTRICTED_ALIASING_P): New flag. * gcc-interface/ada-tree.h (DECL_RESTRICTED_ALIASING_P): New flag. * gcc-interface/decl.c (gnat_to_gnu_param): For parameters passed by reference but whose type isn't by-ref and whose mechanism hasn't been forced to by-ref, set the DECL_RESTRICTED_ALIASING_P flag directly on them instead of changing their type. * gcc-interface/trans.c (scan_rhs_r): New helper function. (independent_iterations_p): New predicate. (Loop_Statement_to_gnu): For a loop with an iteration scheme, set an ivdep pragma if the iterations are independent. From-SVN: r228377 --- gcc/ada/gcc-interface/decl.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'gcc/ada/gcc-interface/decl.c') diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index cb3d778..ca36ce5 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -5585,6 +5585,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech, bool ro_param = in_param && !Address_Taken (gnat_param); bool by_return = false, by_component_ptr = false; bool by_ref = false; + bool restricted_aliasing_p = false; tree gnu_param; /* Copy-return is used only for the first parameter of a valued procedure. @@ -5675,15 +5676,12 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech, || (!foreign && default_pass_by_ref (gnu_param_type))))) { + gnu_param_type = build_reference_type (gnu_param_type); /* We take advantage of 6.2(12) by considering that references built for parameters whose type isn't by-ref and for which the mechanism hasn't - been forced to by-ref are restrict-qualified in the C sense. */ - bool restrict_p + been forced to by-ref allow only a restricted form of aliasing. */ + restricted_aliasing_p = !TYPE_IS_BY_REFERENCE_P (gnu_param_type) && mech != By_Reference; - gnu_param_type = build_reference_type (gnu_param_type); - if (restrict_p) - gnu_param_type - = change_qualified_type (gnu_param_type, TYPE_QUAL_RESTRICT); by_ref = true; } @@ -5731,6 +5729,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech, DECL_POINTS_TO_READONLY_P (gnu_param) = (ro_param && (by_ref || by_component_ptr)); DECL_CAN_NEVER_BE_NULL_P (gnu_param) = Can_Never_Be_Null (gnat_param); + DECL_RESTRICTED_ALIASING_P (gnu_param) = restricted_aliasing_p; /* If no Mechanism was specified, indicate what we're using, then back-annotate it. */ -- cgit v1.1