aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.cc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-12-28 17:36:32 +0100
committerMarc Poulhiès <poulhies@adacore.com>2023-01-16 15:44:54 +0100
commit8daf80ff0ecd2aee50bf8e4f0f0dda906aeb190d (patch)
treec459c050e664056134b0efb0e5e81fdd5e4f3335 /gcc/ada/gcc-interface/utils.cc
parent967592488c64a86f37bef3dabebb56364f14acdd (diff)
downloadgcc-8daf80ff0ecd2aee50bf8e4f0f0dda906aeb190d.zip
gcc-8daf80ff0ecd2aee50bf8e4f0f0dda906aeb190d.tar.gz
gcc-8daf80ff0ecd2aee50bf8e4f0f0dda906aeb190d.tar.bz2
ada: Optimize interface objects initialized with function calls
This optimizes the implementation of (class-wide) interface objects that are initialized with function calls, by avoiding an unnecessary copy operation. This also removes useless access checks generated by the expansion of return statements involving class-wide types. gcc/ada/ * exp_ch3.adb (Expand_N_Object_Declaration): Factor out conditions needed for an initializating expression that is a function call to be renamable into the Is_Renamable_Function_Call predicate. Use it to implement the renaming in the case of class-wide interface objects. Remove an interface conversion on all paths, separate and optimize the renaming path in the special expansion for interfaces. (Is_Renamable_Function_Call): New predicate. (Make_Allocator_For_Return): Put back an interface conversion. * exp_ch6.adb (Apply_CW_Accessibility_Check): Remove useless access checks on RE_Tag_Ptr.
Diffstat (limited to 'gcc/ada/gcc-interface/utils.cc')
0 files changed, 0 insertions, 0 deletions