OpenAD - Tangent-Linear Code for Toy Problem

The transformation for the toy problem
`        subroutine head(x,y)           double precision,intent(in) :: x          double precision,intent(out) :: y          y=sin(x*x)        end subroutine`
in practice leads to a slightly more complex representation in code which is given below. It shows colored sections for
• function value
• partial computation
• elimination operations and saxpy call for Jacobian entry
Note that the generated code contains additional temporaries due to the fact that currenty we do not have any interprocedural alias analysis. Without an interprocedural alias analysis one has to conservatively assume that there may be a call head(w,w), i.e. the formal parameters x and y may be aliased. This requires additional temporary variables in the code to properly handle potential overwrites.
`C ***********************************************************C Fortran file translated from WHIRL Mon Sep 13 04:52:02 2004C ***********************************************************C ***********************************************************      SUBROUTINE head(X, Y)      use w2f__types      use active_module      IMPLICIT NONECC     **** Global Variables ****C      REAL(w2f__8) OpenAD_Symbol_0      REAL(w2f__8) OpenAD_Symbol_1      REAL(w2f__8) OpenAD_Symbol_2      REAL(w2f__8) OpenAD_Symbol_3      REAL(w2f__8) OpenAD_Symbol_4      REAL(w2f__8) OpenAD_Symbol_5      type(active) :: OpenAD_Symbol_6CC     **** Parameters and Result ****C      type(active) :: X      INTENT(IN)  X      type(active) :: Y      INTENT(OUT)  YCC     **** statements ****C      OpenAD_Symbol_0 = (X%v*X%v)      OpenAD_Symbol_4 = SIN(OpenAD_Symbol_0)      OpenAD_Symbol_2 = X%v      OpenAD_Symbol_3 = X%v      OpenAD_Symbol_1 = COS(OpenAD_Symbol_0)      Y%v = OpenAD_Symbol_4      OpenAD_Symbol_5 = ((OpenAD_Symbol_3 + OpenAD_Symbol_2) *     >  OpenAD_Symbol_1)      CALL setderiv(OpenAD_Symbol_6,X)      CALL sax(OpenAD_Symbol_5,OpenAD_Symbol_6,Y)      RETURN      END SUBROUTINE`