Newsgroups: | comp.arch,comp.compilers |
From: | pardo@cs.washington.edu (David Keppel) |
Keywords: | C, optimize, design |
Organization: | Computer Science & Engineering, U. of Washington, Seattle |
References: | 94-10-108 94-10-207 |
Date: | Wed, 9 Nov 1994 05:41:56 GMT |
>>[Structure reordering operations?]
ddg@cci.com (D. Dale Gulledge) writes:
>[Completely rearranging the actual layout may not be possible
> in the general case.]
A few thoughts: to do structure reorganization you either need to
- Change the programmer-visible language rules
- Implement cleverly so the programmer sees behavior "as if"
it was implemented according to the language rules (e.g.,
all struct elements in ascending order).
Since we don't get to play with the language rules, we have to make do
with the second. C rules allow a programmer to take a pointer to a
structure element and use that pointer out of context of the structure.
That makes a variety of cases hard to implement efficiently.
Even the easier cases get hard when control passes across optimization
boundaries. These cases make things like whole-program optimizers much
more effective than single-file optimizers or single-procedure
optimizers.
Another detail is that programs still ultimately communicates with the
outside world, which means that even ``whole program'' optimization has
boundaries. If no structs or pointers into them are used for external
communication, everything is fine. If the structs are communicated
externally, a reorganized struct must be converted to the standard
representation before the external communication.
;-D on ( New World Reorder ) Pardo
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.