Programming Itanium-based Systems: Developing High Performance Applications for Intel's New Architecture

Where The Compiler Needs Help

There are three major areas where the compiler, despite all its built-in optimization intelligence, really needs and benefits from the help of the application programmer:

  • Understanding aliasing constraints

  • Performing interprocedural optimizations

  • Using code test runs to help the optimization

In attending to these considerations, there is still a lot that a programmer can do to help the compiler do its job well.

Avoiding Aliasing

The terms alias and aliasing are somewhat overloaded with meanings in the context of computer science. In signal processing, they refer to a form of artifact that is related to discrete signal sampling and the consequent errors introduced when trying to digitally reconstruct or analyze a signal. That is not what aliasing refers to in this context, though. Here aliasing refers to having a section of code dealing with, say, two pointers to memory, one for reading and one for writing, and dealing with the problem that they might sometimes point to the same place. If the pointers ever (or always) point to the same place, then reads and writes to the pointer addresses cannot be reordered as part of an optimization strategy; reads and writes must occur in strict program order or else a read might get the wrong data. It is called aliasing because one pointer is said to be an alias for the other when they point to the same place.

As an example, consider Figure 11.13. The relatively simple function in this listing performs the exclusive-OR operation...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Laser Pointers
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.