5-14
Intel® PXA27x Processor Family
Optimization Guide
High Level Language Optimization
5.1.13
Placing Literal Pools
The Intel XScale® Microarchitecture does not have a single instruction that can load a literal (a
constant or address) to a register; all literals require multiple instructions to load. One technique to
load registers with literals in the Intel XScale® Microarchitecture is by loading the literal from a
memory location that has been initialized with the constant or address. These blocks of constants
are referred to as literal pools. These data blocks are located in the text or code address space so
that they can be loaded using PC relative addressing. However, references to the literal pool area
load the data into the data cache instead of the instruction cache. Therefore it is possible that the
literal may be present in both the data and instruction caches, resulting in wasted space.
For maximum efficiency, the compiler should align all literal pools on cache boundaries and size
each pool to a multiple of 32 bytes (the size of a cache line). One additional optimization would be
to group frequently used literal pool references into the same cache line. The advantage is that once
one of the literals has been loaded, the other seven are available immediately from the data cache.
5.1.14
Global versus Local Variables
The use of variables can impact the efficiency of operation due to additional memory bandwidth
requirements. Generally, choosing local variables over global variables provides a greater
opportunity to benefit from spatial locality. However, local variables should also be kept to a
minimum so that fewer register values must be pushed and subsequently popped from the stack.
Also, loops run much more efficiently if all the data operated on can be fit into the registers. Using
many variables at once causes memory fetches that decrease performance.
5.1.15
Number of Parameters in Functions
Only the first few (usually the first four) arguments passed into a function are stored in registers.
Each additional argument is pushed onto the stack. Keeping the number of parameters in a function
equal to or below this amount results in less stack activity over the function call.
5.1.16
Other General Optimizations
•
Using the Intel XScale® Microarchitecture mini-data cache to store tables and data that is
often used but expensive to calculate enhances performance.
•
Limiting the use of unnecessary recursion reduces function call overhead and memory
requirements. Many recursive routines can easily be converted to iterative routines which
execute much more quickly using much less memory.
•
Avoid library calls and system calls in inner loops.
•
For two dimensional arrays, modifying algorithms to stride in a row-major fashion might offer
higher opportunity for preloading and caching opportunities.
•
In-lining small functions as much as possible and using macros for commonly executed code
sequences reduces the function call overhead and increases performance.
•
Storing data in binary format as opposed to ASCII format reduces the consumption of the
limited memory resources found in typical embedded targets.
•
Loops can often be terminated without iterating until the conditional is false. Using a break
statement to exit the loop as quickly as possible can greatly enhance the loop performance.
Содержание PXA270
Страница 1: ...Order Number 280004 001 Intel PXA27x Processor Family Optimization Guide April 2004...
Страница 10: ...x Intel PXA27x Processor Family Optimization Guide Contents...
Страница 20: ...1 10 Intel PXA27x Processor Family Optimization Guide Introduction...
Страница 30: ...2 10 Intel PXA27x Processor Family Optimization Guide Microarchitecture Overview...
Страница 48: ...3 18 Intel PXA27x Processor Family Optimization Guide System Level Optimization...
Страница 114: ...5 16 Intel PXA27x Processor Family Optimization Guide High Level Language Optimization...
Страница 122: ...6 8 Intel PXA27x Processor Family Optimization Guide Power Optimization...
Страница 143: ...Intel PXA27x Processor Family Optimization Guide Index 5 Index...
Страница 144: ......