This is the mail archive of the gcc@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: egcs-1.1 release schedule



  In message <rzqaf79nru7.fsf@djlvig.dl.ac.uk>you write:
  > _Please_ include some means of allowing Fortran (at least) to get
  > stack-allocated doubles double-aligned on x86 (modulo libc).  (I hope
  > I haven't missed this going in at some stage!)  The one-line patch for
  > STACK_BOUNDARY used by g77 0.5.22 is good enough.
I'm still waiting on some kind of solution that doesn't totally break
the ABI.

To do this "right" you have to:

	* Make sure gcc always allocates stack in multiples of 8 bytes,
	  adding dummy outgoing args as necessary to keep the stack
	  properly aligned at call points.

	  You can't do this with STACK_BOUNDARY since that says we
	  will 100% always have a properly aligned stack, which can
	  never be true since we might be linking in code from
	  another compiler which didn't keep the stack suitably
	  aligned.

	  If the stack gets mis-aligned relative to STACK_BOUNDARY
	  combine could end up removing a seemingly useless
	  stack operation/address calculation.

	  The idea is to make sure the stack is 8 byte aligned in the
	  common cases, but not absolutely rely on it for correct code
	  generation.


	* Second, assuming that gcc always keeps the pointer aligned
	  for itself, then arrange for doubles to end up 8 byte
	  aligned relative to the stack pointer.

	  If the stack gets mis-aligned due to an old module, then
	  our doubles won't be aligned correctly, but the vast majority
	  of the time they will be suitably aligned.

	  I don't think there's any mechanism to do this when the
	  desired alignment is less than STACK_BOUNDARY.  I fact
	  I know that to be the case since I worked on a similar
	  problem recently.

	* The ABI is still going to mandate that some doubles in
	  argument lists are going to be mis-aligned.  We'd have
	  to arrange to copy them from the arglist into a suitable
	  stack slot.  This may be more trouble than its worth.



Note that some non-ABI breaking changes to align doubles and other
values have gone into the x86 compiler.  In particular we should be
properly aligning all data in the static store.

jeff





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