mathematics
and
computer
science

LANS

LANS Publications

"Control Flow Reversal for Adjoint Code Generation"

U. Naumann, J. Utke, A. Lyons, and M. Fagan

Preprint ANL/MCS-P1145-0404

Preprint Version: [pdf]

We describe an approach to the reversal of the control flow of structured programs. It is used to automatically generate adjoint code for numerical programs by semantic source transformation. After a short introduction to applications and the implementation tool set, we describe the building blocks using a simple example. We then illustrate the code reversal within basic blocks. The main part of the paper covers the reversal of structured control flow graphs. We show the algorithmic steps for simple branches and loops and give a detailed algorithm for the reversal of arbitrary combinations of loops and branches in a general control flow graph.