User`s guide
Improving the Performance of Ported Code
4.2 Code Flow and Branch Prediction
4.2.1 Default Code Flow and Branch Prediction
Generally, the compiler generates Alpha and Itanium code that follows
unconditional VAX MACRO branches and falls through conditional VAX MACRO
branches unless it is directed otherwise. For example, consider the following VAX
MACRO code sequence:
(Code block A)
BLBS R0,10$
(Code block B)
10$:
(Code block C)
BRB 30$
20$:
.
(Code block D)
.
30$:
(Code block E)
The Alpha code generated for this sequence looks like the following:
(Code block A)
BLBS R0,10$
(Code block B)
10$:
(Code block C)
30$:
(Code block E)
Note that the compiler fell through the BLBS instruction, continuing with the
instructions immediately following the BLBS. At the BRB instruction, it did not
generate a branch instruction at all but followed the Alpha and Itanium code
generated from Code block C with the Alpha and Itanium code generated from
Code block E, at the branch destination. Code from Code block D at label 20$
will be generated at a later point in the routine. If there is no branch to the label
20$, the compiler will report the following informational message and will not
generate Alpha or Itanium code for Code block D:
UNRCHCODE, unreachable code
In most cases, this algorithm produces Alpha and Itanium code that matches the
assumptions of the architecture:
• If a conditional branch is backward in the VAX MACRO code, then the
destination likely has been generated already in the Alpha and Itanium code,
and so the generated branch will also be backward.
• If the conditional branch is forward in the VAX MACRO code, then the
destination will likely not have been generated yet in the Alpha and Itanium
code, and so the generated branch will also be forward.
However, because the compiler follows unconditional branches, the destination
of a backward VAX MACRO branch may not have been generated yet. In this
case, a conditional branch that was backward in the VAX MACRO source code
may become a forward branch in the generated Alpha and Itanium code. See
Section 4.2.5 for a further discussion and resolution of this problem.
There are some cases where the compiler may assume that a forward branch is
taken. For example, consider the following common VAX MACRO coding practice:
4–4 Improving the Performance of Ported Code