Hardware Reference
In-Depth Information
FIGURE A.21 Change in instruction count for the programs lucas and mcf from the
SPEC2000 as compiler optimization levels vary . Level 0 is the same as unoptimized code.
Level 1 includes local optimizations, code scheduling, and local register allocation. Level 2 in-
cludes global optimizations, loop transformations (software pipelining), and global register al-
location. Level 3 adds procedure integration. These experiments were performed on Alpha
compilers.
The Impact Of Compiler Technology On The Architect's
Decisions
The interaction of compilers and high-level languages significantly affects how programs use
an instruction set architecture. There are two important questions: How are variables alloc-
ated and addressed? How many registers are needed to allocate variables appropriately? To
address these questions, we must look at the three separate areas in which current high-level
languages allocate their data:
■ The stack is used to allocate local variables. The stack is grown or shrunk on procedure call
or return, respectively. Objects on the stack are addressed relative to the stack pointer and
are primarily scalars (single variables) rather than arrays. The stack is used for activation
records, not as a stack for evaluating expressions. Hence, values are almost never pushed
or popped on the stack.
■ The global data area is used to allocate statically declared objects, such as global variables
and constants. A large percentage of these objects are arrays or other aggregate data struc-
tures.
■ The heap is used to allocate dynamic objects that do not adhere to a stack discipline. Objects
in the heap are accessed with pointers and are typically not scalars.
Register allocation is much more effective for stack-allocated objects than for global vari-
ables, and register allocation is essentially impossible for heap-allocated objects because they
are accessed with pointers. Global variables and some stack variables are impossible to alloc-
ate because they are aliased —there are multiple ways to refer to the address of a variable, mak-
ing it illegal to put it into a register. (Most heap variables are effectively aliased for today's
compiler technology.)
 
Search WWH ::




Custom Search