aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2024-12-02 21:58:29 +0100
committerMarc Poulhiès <dkm@gcc.gnu.org>2025-01-03 16:39:11 +0100
commit1e3619a37aebd8005c8505aebded7957b661577c (patch)
tree89587954aa9afe8e573c1b84a420c75a3ff73662 /gcc/fortran
parentd9ba2b857eb39ab52b1e2f93246af444e837dce4 (diff)
downloadgcc-1e3619a37aebd8005c8505aebded7957b661577c.zip
gcc-1e3619a37aebd8005c8505aebded7957b661577c.tar.gz
gcc-1e3619a37aebd8005c8505aebded7957b661577c.tar.bz2
ada: Improve expansion of conditional expressions in object declarations
This arranges for conditional expressions in objects declarations to have their expansion delayed when they have a type that cannot be easily copied or copied at all, including limited and controlled types. The ultimate goal is to replace the declaration with a renaming declaration of the dereference of an access value designating an object initialized with the dependent expression chosen by the condition. gcc/ada/ChangeLog: * einfo.ads (Is_Independent): Document usage on Master_Node objects. * exp_aggr.adb (In_Place_Assign_OK): Remove Parent_Kind variable. (Convert_To_Assignments): Call Unconditional_Parent and remove the restriction on the known size for the in-place expansion of the aggregate in the context of an object declaration. (Expand_Array_Aggregate): Remove Parent_Kind variable and call Unconditional_Parent and Delay_Conditional_Expressions_Between * exp_ch3.adb: Remove clauses for Exp_Dbug. (Expand_N_Object_Declaration): Factor out the code rewriting the declaration as a renaming in Rewrite_Object_Declaration_As_Renaming and call the procedure. * exp_ch4.adb (Insert_Conditional_Object_Declaration): Declare. (Expand_N_Case_Expression): Delay expanding the expression if it is in the context of an optimizable object declaration. If the parent node is this object declaration, then replace it with a renaming of the dereference of an access value designating an object initialized with the dependent expression chosen by the condition. (Expand_N_If_Expression): Likewise. (Insert_Conditional_Object_Declaration): New procedure. * exp_ch6.adb (Expand_Ctrl_Function_Call): Test the unconditional parent in the case of an object declaration too. * exp_ch7.adb (Build_Finalizer.Process_Declarations): Pass Strict to Processing_Actions from the Is_Independent flag on a Master_Node. * exp_util.ads (Rewrite_Object_Declaration_As_Renaming): Declare. * exp_util.adb: Add clauses for Exp_Dbug. (Rewrite_Object_Declaration_As_Renaming): New procedure extracted from Expand_N_Object_Declaration. * sem_ch3.adb (Analyze_Object_Declaration): Also leave the analysis if the declaration has been replaced with a renaming in the case of an initialization expression that is a conditional expression.
Diffstat (limited to 'gcc/fortran')
0 files changed, 0 insertions, 0 deletions