This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Arranging for -Os to imply -mpreferred-stack-boundary=2 on x86





On Wed, 24 Oct 2001, Richard Henderson wrote:

  On Tue, Oct 23, 2001 at 07:56:34AM -0200, Alexandre Oliva wrote:
  > I'm considering introducing a function attribute to specify the
  > alignment requirements of a given function, with similar effects to
  > RTH's FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN, so that one can control
  > performance-critical (re-)entry points that would benefit from
  > additional alignment.
  
  I'd rather detect the required alignment of a function than use
  an attribute.  Much friendlier when interacting with SSE code
  that doesn't just prefer 16 byte alignment, but requires it.
  
I don't understand exactly what you mean here. If I have two parts of
a program which have been compiled separately, how can we "detect"
the alignment of functions in the other unit? The only information
we have is that from the function declaration.

It seems to me that there are three options for ensuring proper
stack alignment in a function f:

  1. maintain an invariant that the stack is aligned at all places
  2. have a subset M of functions marked as requiring and maintaining the
     aligned stack invariant, and only do alignment in the prologue of f
     if f is not in M. 
  3. assume the stack may be misaligned and do alignment in the prologue of f

Do you mean maybe using the second approach, but determine the set of
functions in M based on the parameter profile?

  -Geert


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]