On 11/25/2015 03:52 PM, Dominik Vogt wrote:
Without looking into the details, I believe it's an optimization
to have certain frequently used members of the struct always on
the same cache line.
Probably better to annotate the global vars then with an alignment,
rather than waste space on the stack for locals by annotating the type.
I have two more questions regarding code copied frpm
allocate_dynamic_stack_space.
1. Is this really necessary in get_dynamic_stack_base?
+ if (crtl->preferred_stack_boundary < PREFERRED_STACK_BOUNDARY)
+ crtl->preferred_stack_boundary = PREFERRED_STACK_BOUNDARY;
Good question. Maybe it's in the wrong place. I think this is used to
get the difference between known and requested stack alignment, and
thereby reduce the amount of extra space we have to allocate in order to
ensure the requested alignment. (i.e. you want 16 bytes of alignment and
your ABI guarantees 4, you allocate 12 additional bytes. That's the
must_align stuff in allocate_dynamic_stack_space. You might want to copy
the concept into your new code in expand_stack_vars. I'm thinking the
code looking at STACK_POINTER_OFFSET/STACK_DYNAMIC_OFFSET is going to be
irrelevant when you're looking at offsets from the frame pointer, so you
just need to up the preferred stack boundary and use that.
2. What is the effect of OPTAB_LIB_WIDEN below? I've copied it
from the existing "plus" without actually understanding it.
+ target = expand_binop (Pmode, add_optab, target,
+ gen_int_mode (offset, Pmode),
+ NULL_RTX, 1, OPTAB_LIB_WIDEN);
/* Passed to expand_simple_binop and expand_binop to say which options
to try to use if the requested operation can't be open-coded on the
requisite mode. Either OPTAB_LIB or OPTAB_LIB_WIDEN says try using
a library call. Either OPTAB_WIDEN or OPTAB_LIB_WIDEN says try
using a wider mode. OPTAB_MUST_WIDEN says try widening and don't
try anything else. */
Bernd