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

Interpreting Compiled Code

One of the most important skills involved in optimizing Itanium processor code is the ability to read compiler-generated assembly language output files to see what is really going on under the hood. What may look like perfectly reasonable high-level code on the surface may translate to something quite unexpected, and possibly slower than expected, under the surface.

Locating Code in an Assembly Language Listing

The assembly language listings that compilers output often look confusing, and it is easy to get disoriented without the high-level source code as a guide. Often, the only recognizable terms are the names of global procedures and variables. Consider the case of the small C language module, containing just one function, shown in Figure 11.1.

intchecksum(int *where, int count){    int sum;    sum = 0;    while (count--) {        sum += *where++;    }    return sum;}

FIGURE 11.1: A simple code module

By using the /S option, the compiler can be told to generate an assembly language file representing the way it actually translates the C code into assembly language.

ecl /S checksum.c 

The resulting file, checksum.asm, has the asm file type suffix by default.

The assembly language file so produced has 128 lines of code, but most of that consists of standard startup declarations that can be skipped over. The core assembly code for this simple function is shown in Figure...

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: Microprocessor and IC Programmers, Compilers, and Debuggers
Finish!
Privacy Policy

This is embarrasing...

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