7 The Inline Substitution technique (IL)
8 tries to decrease the overhead associated
9 with procedure calls (invocations).
10 During a procedure call, several actions
11 must be undertaken to set up the right
12 environment for the called procedure.
14 johnson calling sequence
16 On return from the procedure, most of these
17 effects must be undone.
18 This entire process introduces significant
19 costs in execution time as well as
22 The inline substitution technique replaces
23 some of the calls by the modified body of
24 the called procedure, hence eliminating
26 Furthermore, as the calling and called procedure
27 are now integrated, they can be optimized
28 together, using other techniques of the optimizer.
29 This often leads to extra opportunities for
32 ball predicting effects
35 carter code generation cacm
41 An inline substitution of a call to a procedure P increases
42 the size of the program, unless P is very small or P is
44 In the latter case, P can be eliminated.
45 In practice, procedures that are called only once occur
46 quite frequently, due to the
47 introduction of structured programming.
52 states that almost 50% of the Pascal procedures
53 he analyzed were called just once).
59 has a more general view of inline substitution.
60 In his model, the program under consideration is
61 allowed to grow by a certain amount,
62 i.e. code size is sacrificed to speed up the program.
63 The above two cases are just special cases of
64 his model, obtained by setting the size-change to
66 He formulates the substitution problem as follows:
68 "Given a program, a subset of all invocations,
69 a maximum program size, and a maximum procedure size,
70 find a sequence of substitutions that minimizes
71 the expected execution time."
73 Scheifler shows that this problem is NP-complete
75 aho hopcroft ullman analysis algorithms
77 by reduction to the Knapsack Problem.
78 Heuristics will have to be used to find a near-optimal
81 In the following chapters we will extend
82 Scheifler's view and adapt it to the EM Global Optimizer.
83 We will first describe the transformations that have
84 to be applied to the EM text when a call is substituted
86 Next we will examine in which cases inline substitution
87 is not possible or desirable.
88 Heuristics will be developed for
89 chosing a good sequence of substitutions.
90 These heuristics make no demand on the user
91 (such as making profiles
97 ichbiah ada military standard
99 although the model could easily be extended
100 to use such information.
101 Finally, we will discuss the implementation
102 of the IL phase of the optimizer.
104 We will often use the term inline expansion
105 as a synonym of inline substitution.
107 The inverse technique of procedure abstraction
108 (automatic subroutine generation)
110 shaffer subroutine generation
112 will not be discussed in this report.