首页 > 代码库 > smaller programs should improve performance
smaller programs should improve performance
COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION
In this section, we look at some of the general characteristics of and the motivation
for a reduced instruction set architecture. Specific examples will be seen later in
this chapter. We begin with a discussion of motivations for contemporary complex
instruction set architectures.
Why CISC
We have noted the trend to richer instruction sets, which include a larger number
of instructions and more complex instructions. Two principal reasons have moti-
vated this trend: a desire to simplify compilers and a desire to improve performance.
Underlying both of these reasons was the shift to HLLs on the part of programmers;
architects attempted to design machines that provided better support for HLLs.
It is not the intent of this chapter to say that the CISC designers took the
wrong direction. Indeed, because technology continues to evolve and because archi-
tectures exist along a spectrum rather than in two neat categories, a black-and-white
assessment is unlikely ever to emerge. Thus, the comments that follow are simply
meant to point out some of the potential pitfalls in the CISC approach and to pro-
vide some understanding of the motivation of the RISC adherents.
The first of the reasons cited, compiler simplification, seems obvious, but it
is not. The task of the compiler writer is to build a compiler that generates good
(fast, small, fast and small) sequences of machine instructions for HLL programs
(i.e., the compiler views individual HLL statements in the context of surrounding
HLL statements). If there are machine instructions that resemble HLL statements,
this task is simplified. This reasoning has been disputed by the RISC researchers
([HENN82], [RADI83], [PATT82b]). They have found that complex machine
instructions are often hard to exploit because the compiler must find those cases
that exactly fit the construct. The task of optimizing the generated code to mini-
mize code size, reduce instruction execution count, and enhance pipelining is much
more difficult with a complex instruction set. As evidence of this, studies cited
earlier in this chapter indicate that most of the instructions in a compiled program
are the relatively simple ones.
The other major reason cited is the expectation that a CISC will yield smaller,
faster programs. Let us examine both aspects of this assertion: that programs will be
smaller and that they will execute faster.
There are two advantages to smaller programs. First, because the program
takes up less memory, there is a savings in that resource. With memory today being
so inexpensive, this potential advantage is no longer compelling. More important,
smaller programs should improve performance, and this will happen in three ways.
First, fewer instructions means fewer instruction bytes to be fetched. Second, in a
paging environment, smaller programs occupy fewer pages, reducing page faults.
Third, more instructions fit in cache(s).
smaller programs should improve performance