Ada: Get rid of temporary in assignment of others-equivalent array aggregate
Optimizes Ada array aggregate assignments by avoiding unnecessary temporaries.
This commit simplifies the expansion of Ada array aggregates used in assignments. It removes an unnecessary temporary variable that was introduced to handle potential sliding operations, which are not applicable to ‘others’ aggregates. By directly expanding these aggregates, the compiler generates more efficient code.
In Details
In exp_aggr.adb, Expand_Array_Aggregate previously created a temporary to support sliding window operations, even for 'others' aggregates where such operations are semantically irrelevant. This change modifies the expansion to directly transform an 'others'-equivalent aggregate into an 'others' aggregate within an assignment context, eliminating the need for the temporary and simplifying the generated code.
- others aggregate
- In Ada, an array aggregate can use the 'others' keyword to specify a value for all elements not explicitly listed. This is a shorthand for defining large or complex arrays.
- Array aggregate
- An expression in Ada that denotes an array value by specifying values for its components. It can be positional or named, and may use 'others' for unspecified elements.