AMD Typewriter x86 사용자 설명서
56
Sort Variables According to Base Type Size
AMD Athlon™ Processor x86 Code Optimization
22007E/0—November 1999
Example:
struct
{
char
a[5];
long
k;
doublex;
} baz;
} baz;
The structure components should be allocated (lowest to
highest address) as follows:
highest address) as follows:
x, k, a[4], a[3], a[2], a[1], a[0], padbyte6, ..., padbyte0
See “C Language Structure Component Considerations” on
page 27 for more information from a C source code perspective.
page 27 for more information from a C source code perspective.
Sort Variables According to Base Type Size
Sort local variables according to their base type size and
allocate variables with larger base type size ahead of those with
smaller base type size. Assuming the first variable allocated is
naturally aligned, all other variables are naturally aligned
without any padding. The following example is a declaration of
local variables in a C function:
allocate variables with larger base type size ahead of those with
smaller base type size. Assuming the first variable allocated is
naturally aligned, all other variables are naturally aligned
without any padding. The following example is a declaration of
local variables in a C function:
Example:
short
ga, gu, gi;
long
foo, bar;
double
x, y, z[3];
char
a, b;
float
baz;
Allocate in the following order from left to right (from higher to
lower addresses):
lower addresses):
x, y, z[2], z[1], z[0], foo, bar, baz, ga, gu, gi, a, b;
See “Sort Local Variables According to Base Type Size” on page
28 for more information from a C source code perspective.
28 for more information from a C source code perspective.