Skip to content
Snippets Groups Projects
  • Eric Botcazou's avatar
    65ea0024
    ada: Do not unnecessarily use component-wise loop for slice assignment · 65ea0024
    Eric Botcazou authored
    This relaxes the condition under which Expand_Assign_Array leaves the
    assignment to or from an array slice untouched.  The main prerequisite
    for the code generator is that everything be aligned on byte boundaries
    and Is_Possibly_Unaligned_Slice is too strong a predicate for this, so
    it is replaced by the combination of Possible_Bit_Aligned_Component and
    Is_Bit_Packed_Array, modulo a change to Possible_Bit_Aligned_Component
    to take into account the specific case of slices.
    
    gcc/ada/
    
    	* exp_ch5.adb (Expand_Assign_Array): Adjust comment above the
    	calls to Possible_Bit_Aligned_Component on the LHS and RHS. Do not
    	call Is_Possibly_Unaligned_Slice in the slice case.
    	* exp_util.ads (Component_May_Be_Bit_Aligned): Add For_Slice
    	boolean parameter.
    	(Possible_Bit_Aligned_Component): Likewise.
    	* exp_util.adb (Component_May_Be_Bit_Aligned): Do not return False
    	for the slice of a small record or bit-packed array component.
    	(Possible_Bit_Aligned_Component): Pass For_Slice in recursive
    	calls, except in the slice case where True is passed, as well as
    	in call to Component_May_Be_Bit_Aligned.
    65ea0024
    History
    ada: Do not unnecessarily use component-wise loop for slice assignment
    Eric Botcazou authored
    This relaxes the condition under which Expand_Assign_Array leaves the
    assignment to or from an array slice untouched.  The main prerequisite
    for the code generator is that everything be aligned on byte boundaries
    and Is_Possibly_Unaligned_Slice is too strong a predicate for this, so
    it is replaced by the combination of Possible_Bit_Aligned_Component and
    Is_Bit_Packed_Array, modulo a change to Possible_Bit_Aligned_Component
    to take into account the specific case of slices.
    
    gcc/ada/
    
    	* exp_ch5.adb (Expand_Assign_Array): Adjust comment above the
    	calls to Possible_Bit_Aligned_Component on the LHS and RHS. Do not
    	call Is_Possibly_Unaligned_Slice in the slice case.
    	* exp_util.ads (Component_May_Be_Bit_Aligned): Add For_Slice
    	boolean parameter.
    	(Possible_Bit_Aligned_Component): Likewise.
    	* exp_util.adb (Component_May_Be_Bit_Aligned): Do not return False
    	for the slice of a small record or bit-packed array component.
    	(Possible_Bit_Aligned_Component): Pass For_Slice in recursive
    	calls, except in the slice case where True is passed, as well as
    	in call to Component_May_Be_Bit_Aligned.