AMD Typewriter x86 사용자 설명서

다운로드
페이지 256
Align TBYTE Variables on Quadword Aligned Addresses
55
22007E/0—November 1999
AMD Athlon™ Processor x86 Code Optimization 
Example (Preferred):  
Prolog: 
PUSH 
EBP         
MOV 
EBP, ESP
SUB 
ESP, SIZE_OF_LOCALS
;size of local variables
AND 
ESP, –8
;push registers that need to be preserved
Epilog: 
;pop register that needed to be preserved
MOV
ESP, EBP
POP
EBP
RET
With this technique, function arguments can be accessed via
EBP, and local variables can be accessed via ESP. In order to
free EBP for general use, it needs to be saved and restored
between the prolog and the epilog.
Align TBYTE Variables on Quadword Aligned Addresses
Align variables of type TBYTE on quadword aligned addresses.
In order to make an array of TBYTE variables that are aligned,
array elements are 16-bytes apart. In general, TBYTE variables
should be avoided. Use double-precision variables instead.
C Language Structure Component Considerations
Structures (‘struct’ in C language) should be made the size of a
multiple of the largest base type of any of their components. To
me et this require ment, padding  should be use d where
necessary.
Language definitions permitting, to minimiz e padding,
structure components should be sorted and allocated such that
the components with a larger base type are allocated ahead of
those with a smaller base type. For example, consider the
following code: