Intel® PXA27x Processor Family
Optimization Guide
5-5
High Level Language Optimization
Unfortunately, preload loop unrolling does not work on loops with indeterminate iterations.
5.1.1.3.2
Coding Technique: Pointer Preload
Not all looping constructs contain induction variables. However, preloading techniques can still be
applied. Refer to this linked list traversal example:
while(p) {
do_something(p->data);
p = p->next;
}
The pointer variable
p
becomes a pseudo induction variable and the data pointed to by
p->next
can
be pre-loaded to reduce data transfer latency for the next iteration of the loop. Linked lists should
be converted to arrays as much as possible.
while(p) {
prefetch(p->next);
do_something(p->data);
p = p->next;
}
Recursive data structure traversal is another construct where preloading can be applied. This is
similar to linked list traversal. Refer to this pre-order traversal of a binary tree:
preorder(treeNode *t) {
if(t) {
process(t->data);
preorder(t->left);
preorder(t->right);
}
}
The pointer variable
t
becomes the pseudo induction variable in a recursive loop. The data
structures pointed to by the values
t->left
and
t->right
can be pre-loaded for the next iteration of
the loop.
preorder(treeNode *t) {
if(t) {
prefetch(t->right);
prefetch(t->left);
process(t->data);
preorder(t->left);
preorder(t->right);
}
}
The variables are pre-loaded in the opposite order that they are used. If there is a cache conflict and
data is evicted from the cache then only the data from the first preload is lost.
Содержание 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: ......