Given a compiled machine-language program, which statements in the source language cause the execution of the most machine-language instructions and what is the execution time of these instr
COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION
A variety of studies have been made to analyze the behavior of HLL programs.
Table 4.8, discussed in Chapter 4, includes key results from a number of studies.
There is quite good agreement in the results of this mixture of languages and appli-
cations. Assignment statements predominate, suggesting that the simple movement
of data is of high importance. There is also a preponderance of conditional state-
ments (IF, LOOP). These statements are implemented in machine language with
some sort of compare and branch instruction. This suggests that the sequence con-
trol mechanism of the instruction set is important.
These results are instructive to the machine instruction set designer, indicat-
ing which types of statements occur most often and therefore should be supported
in an “optimal” fashion. However, these results do not reveal which statements use
the most time in the execution of a typical program. That is, we want to answer the
question: Given a compiled machine-language program, which statements in the
source language cause the execution of the most machine-language instructions and
what is the execution time of these instructions?
To get at this underlying phenomenon, the Patterson programs [PATT82a],
described in Appendix 4A, were compiled on the VAX, PDP-11, and Motorola
68000 to determine the average number of machine instructions and memory refer-
ences per statement type. The second and third columns in Table 15.2 show the rela-
tive frequency of occurrence of various HLL statements in a variety of programs;
the data were obtained by observing the occurrences in running programs rather
than just the number of times that statements occur in the source code. Hence
these metrics capture dynamic behavior. To obtain the data in columns four and
five (machine-instruction weighted), each value in the second and third columns is
multiplied by the number of machine instructions produced by the compiler. These
results are then normalized so that columns four and five show the relative fre-
quency of occurrence, weighted by the number of machine instructions per HLL
statement. Similarly, the sixth and seventh columns are obtained by multiplying the
frequency of occurrence of each statement type by the relative number of memory
references caused by each statement. The data in columns four through seven pro-
vide surrogate measures of the actual time spent executing the various statement
types. The results suggest that the procedure call/return is the most time-consuming
operation in typical HLL programs.
The reader should be clear on the significance of Table 15.2. This table indi-
cates the relative performance impact of various statement types in an HLL, when
that HLL is compiled for a typical contemporary instruction set architecture. Some
other architecture could conceivably produce different results. However, this study
produces results that are representative for contemporary complex instruction set
computer (CISC) architectures. Thus, they can provide guidance to those looking
for more efficient ways to support HLLs.