Dead-Code Elimination - Intel i960 User Manual

Processor compiler
Hide thumbs Also See for i960:
Table of Contents

Advertisement

Optimization

Dead-code Elimination

The compiler eliminates two kinds of dead code:
unused
unreachable
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.
when code generates a value that is not used
subsequently in the program or in its output.
when the control flow of the program can never
execute the instructions.
11
11-5

Advertisement

Table of Contents
loading

Table of Contents