i960 Processor Compiler User's Guide
11-8
11
• A load operation from a memory location found to contain a constant
value is replaced by a copy of the constant value into the destination
register of the original instruction. For example, the following
program fragment loads the constant value
5 from the memory
location
_i into g3:
lda 5, g2
st g2, _i
ld _i, g3
st g3, _j
• After constant propagation, the code contains these optimized
instructions:
lda 5, g2
st g2, _i
lda 5, g3
st g3, _j
• Complex memory-addressing modes are sometimes reduced to less
complex addressing modes when registers that are components of a
memory reference contain constant integer values. For example, this
code fragment contains a complex memory-addressing mode in the
third instruction:
mov 2, g2
lda _i, g3
ld 10(g3)[g2*4],g4
• After constant propagation, the code contains these optimized
instructions:
mov 2, g2
lda _i, g3
ld 18(g3),g4