This is the mail archive of the
mailing list for the GCC project.
suggestion for projects page: sort frame vars
- From: DJ Delorie <dj at redhat dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 10 Jan 2005 15:30:39 -0500
- Subject: suggestion for projects page: sort frame vars
The theory behind this change is that some ports either have limited
frame pointer or stack pointer displacements, or can optimize smaller
displacements. By sorting frame variables by size, gcc can cause more
of them to be within this limited displacement.
int TARGET_SORT_FRAME(int frame_size, int fp_eliminated);
This target hook controls if/how variables in the local stack frame
are sorted. Normally, such variables are not sorted, assuming that
all accesses to the frame cost the same. However, the target may
specify a sort algorithm which may produce more optimal code. This
hook is passed two variables: frame_size is the estimated size of the
frame in bytes, and fp_eliminated is true if the frame pointer will be
eliminated (i.e. gcc is optimizing stack pointer displacements
instead). The hook shall return one of these values:
This value indicates that no sorting is required; this is the default,
and is equivalent to what older versions of gcc do.
This value indicates that smaller sized variables (i.e. overall byte
size) should be sorted to be closer to the top of stack (i.e. lower
addresses for STACK_GROWS_DOWNWARD, higher addresses for
STACK_GROWS_UPWARD). Note that total size is used, not element size.
A structure with 3 QI vars will sort "bigger than" a single HI var on
Similar to the previous option, but sorting in the opposite direction.