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: m68k structure packing


	If you pack the structure on any hardware with strict alignment then
	you have to access any non-byte element using ONLY byte accesses since
	you can not assume the alignment of the address of the start of the structure.
	Unfortunately on the 68k this produces some really slow code. Ex: 

The solution is simple.  If you care about performance, then don't pack your
structures.

	If you want packed structures then they should be sized up to a short, and
	anything that is not a char in a packed struct should be aligned on a
	short boundary(BIGGEST_ALIGNMENT). But this is what happens on the 68k
	anyway.

It makes no sense to disable structure packing because of performance
concerns.  People who are packing structures are doing it because they
actually need a particular structure layout.  If the programmer requests
packed structures, then the compiler should obey, and the compiler should
make structure packing work the same way for all targets.  Mike Stump's
patch is a step in this direction.

Jim


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