EasyManua.ls Logo

Intel i960 - Dead-Code Elimination

Intel i960
347 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Optimization
11-5
11
Dead-code Elimination
The compiler eliminates two kinds of dead code:
unused when code generates a value that is not used
subsequently in the program or in its output.
unreachable when the control flow of the program can never
execute the instructions.
Unused code operations can arise from several sources, including:
Naive code generation can produce operations that are useless in some
contexts as part of a generic translation.
Other optimizations, such as common sub-expression elimination, can
make some operations useless.
Conditional compilation or other code improvements can eliminate the
uses of the results of an operation.
By analyzing a program, the compiler can detect and remove useless
operations from generated code.
Commonly, instructions become unreachable when function inlining
substitutes constants for variables or when the preprocessor substitutes
constants for preprocessor symbols. By analyzing the control flow in a
program, the compiler can detect many (though not all) instances of
unreachable instructions and remove them from the generated code.
Identity Collapsing
The compiler recognizes instances of arithmetic operations in which an
identity constant is one of the operands. For an identity constant, the result
of the operation is the same as one of the operands. The examples in
Table 11-3 demonstrate identity collapsing.

Table of Contents

Related product manuals