8.4.5 Manual Inlining Example

Manual inlining and IPA allow you greater control over the routines that are inlined/analyzed at CALL sites. They use directives (C*$*inline and C*$*ipa ) that are placed into the source code. The directives are normally ignored by KAP, but are enabled when an inlining or IPA qualifier, respectively, is given on the command line.

The following example is based on the Recursive Inlining example from the previous section. It was run with default qualifiers, except for /inline_manual .

The directives used have different scopes. Routine S1 is inlined everywhere it is used, routine S3 is inlined only in the main program, and routine S4 is inlined only in routine S1 , which is then inlined elsewhere.

With the default value for /scalaropt , forward substitution places the assigned values into the PRINT statement and dead-code elimination deletes the now-unneeded inlined assignments:

C*$* INLINE GLOBAL (S1)
C*$* INLINE ROUTINE (S3)
PROGRAM EXDTST
REAL  A,B,C,D,E,F,G

CALL S1 (A,B)
CALL S2 (C,D,E,F)
CALL S3 (G)

PRINT *,A,B,C,D,E,F,G
END
SUBROUTINE S1 (W,X)
REAL W,X
W=1.0
C*$* INLINE
CALL S4(X)
RETURN
END

SUBROUTINE S2 (Q,R,S,T)
REAL Q,R,S,T
Q = 2.0
CALL S1 (R,S)
CALL S3 (T)
RETURN
END
SUBROUTINE S3 (U)
REAL U
U = 137.0
RETURN
END

SUBROUTINE S4 (V)
REAL V
V = 2.7
RETURN
END

Becomes:

C   KAP/F_DEC_OSF/1_AXP 0.0 k093201 911011  o5r3so3  11-Aug-1992 21:23:10
C*$* INLINE (  ) GLOBAL  S1
C*$* INLINE (  ) ROUTINE  S3
PROGRAM EXDTST
REAL A, B, C, D, E, F, G
SAVE G, F, E, D, C, B, A
EXTERNAL S4
CALL S2 (C,D,E,F)

PRINT *, 1., 2.7, C, D, E, F, 137.
END
C KAP/F_DEC_OSF/1_AXP 0.0 k093201 911011  o5r3so3  11-Aug-1992 21:23:10

SUBROUTINE S1 (W, X)
REAL W, X
W = 1.
C*$* INLINE (  )
X = 2.7
RETURN
END

C KAP/F_DEC_OSF/1_AXP 0.0 k093201 911011  o5r3so3  11-Aug-1992 21:23:10

SUBROUTINE S2 (Q, R, S, T)
REAL Q, R, S, T
EXTERNAL S4
Q = 2.
R = 1.
S = 2.7
CALL S3 (T)
RETURN
END

Subroutines S3 and S4 are unchanged.


Previous Page | Next Page | Contents | Index |
Command-Line Qualifiers

Copyright © Digital Equipment Corporation. 1999. All Rights Reserved.