CA2447443A1 - Method and system for optimizing a software program using interprocedural code motion - Google Patents

Method and system for optimizing a software program using interprocedural code motion Download PDF

Info

Publication number
CA2447443A1
CA2447443A1 CA002447443A CA2447443A CA2447443A1 CA 2447443 A1 CA2447443 A1 CA 2447443A1 CA 002447443 A CA002447443 A CA 002447443A CA 2447443 A CA2447443 A CA 2447443A CA 2447443 A1 CA2447443 A1 CA 2447443A1
Authority
CA
Canada
Prior art keywords
procedure
call
software program
code
upward exposed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Abandoned
Application number
CA002447443A
Other languages
French (fr)
Inventor
Shimin Cui
Roch G. Archambault
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
IBM Canada Ltd
Original Assignee
IBM Canada Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by IBM Canada Ltd filed Critical IBM Canada Ltd
Priority to CA002447443A priority Critical patent/CA2447443A1/en
Publication of CA2447443A1 publication Critical patent/CA2447443A1/en
Abandoned legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/445Exploiting fine grain parallelism, i.e. parallelism at instruction level

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

Disclosed is an interprocedural compilation technique for moving upward exposed expressions across procedure boundaries to potentially improve performance in the execution of compiled software program code. Intermediate representations of a software program, including a call graph, a control flow graph, a data flow graph and a post-dominate tree, may be generated and used. In an embodiment, a software program compiler may be configured to carry out a depth-first traversal of each procedure in the software program, as represented by nodes in a call graph intermediate representation of the software program. Candidate upward exposed expressions are identified in callee procedures, and selected for possible interprocedural code motion. In an embodiment, a procedure interface descriptor is built for each callee procedure by defining a new formal parameter for each upward exposed expression moved, replacing each upward exposed expression with the new formal parameter, and identifying any dead parameters resulting from removal of the upward exposed expression.

Description

METHOD AND SYSTEM FOR OPTIMIZING A
SOFTWARE PROGRAM USING
INTERPROCEDURAL CODE MOTION
BACKGROUND OF THE INVENTION
The present invention relates to the field of computing systems and the design of software program code compilers. More specifically, the present invention relates to a method and system for optimizing a software program during compilation using interprocedural code motion.
As well understood, a large software program is typically assembled from a plurality of interconnected procedures that cooperate to execute various computing tasks.
Typically, the procedures are interconnected via "procedure calls". That is, a "caller"
procedure makes a call to a "callee" procedure in order to transfer data or information required to perform a particular computing task.
When building a software program from a plurality of procedures, it is often necessary to rearrange some code in one or more of the procedures in order to improve overall performance of the software program. This rearrangement of code, commonly referred to in the art as "code motion", is an important optimization technique used by modern software program code compilers.
As known, code motion may be performed both "intraprocedurally" and "interprocedurally". For the purposes of the present discussion, a "procedure"
may be defined as a logical unit of code defined by a boundary. This logical unit of code is a building block which may be interconnected with other logical units of code via software interconnections. Thus, "intraprocedural" code motion is defined as the movement of software program code within a procedure, and "interprocedural" code motion is defined as the movement of software program code across a procedure boundary.
By way of example, "loop invariant" code motion is a type of intraprocedural code motion in which code for computations that are unchanged during one or more iterations of a loop is moved out of the loop. As another example, "inline substitution" is a simple form of interprocedural code motion in which a procedure call is replaced with the actual code for the called procedure. "Loop extraction", a form of partial inlining, is another example of interprocedural code motion. Loop extraction pulls an outermost enclosing loop from a procedure body into a calling procedure. The inverse option of loop extraction, or "loop embedding", pushes a loop surrounding a call site out to the called procedure.
While these known code motion techniques may improve software program performance in certain cases, other code motion techniques which may improve performance would be desirable.
SUMMARY OF THE INVENTION
There is provided a method, system, and computer readable medium containing computer readable code for moving "upward exposed" expressions across procedure boundaries during compilation of a software program in order to improve performance of the software program.

For the purposes of the present discussion, an "upward exposed" expression is a computation which, when executed "upward", that is, at a procedure entry, provides the same computed value as if it was executed in its original location within the procedure body.
Conversely, an expression that is not on a definition free path from the procedure entry is not upward exposed, as its computed value may differ from its computed value at the procedure entry. An upward exposed expression may contain only non-local variables, procedure parameters, and literal constants.
In accordance with an exemplary embodiment of the invention, a software program code compiler may be adapted to generate and use a number of intermediate representations of a software program. Using one or more of these intermediate representations, the code compiler identifies and collects upward exposed expressions in each procedure, calculates the computation cost of each identified upward exposed expression, selects the best candidate upward exposed expressions) for moving across procedure boundaries, and modifies a call interface at each call site affected by the move. In an embodiment, a procedure interface descriptor associated with each callee procedure is created to define new formal parameters for each upward exposed expression moved, and to remove any resulting dead parameters. (As explained further below, parameters may become dead as a result of replacement of the upward exposed expressions with the new formal parameters in the callee procedure.) In an aspect of the invention, there is provided a method of optimizing a software program, the software program including a plurality of procedures with at least one caller procedure interconnected to a callee procedure by a procedure call, the callee procedure having at least one upward exposed expression contained therein, the method comprising:
(i) analyzing dataflow for each callee procedure and identifying any upward exposed expressions;
(ii) calculating a computation cost for each upward exposed expression identified in (i);
(iii) selecting, in dependence upon the computation cost calculated in (ii), a candidate upward exposed expression for replacement;
(iv) building a procedure interface descriptor, the building comprising:
defining a new formal parameter for each candidate upward exposed expression selected in (iii);
replacing each upward exposed expression with the new formal parameter in the callee procedure;
identifying any resulting dead parameters for removal;
(v) modifying a corresponding call interface at each affected call site in the caller procedure utilizing the procedure interface descriptor.
In an embodiment, the method further comprises generating a call graph intermediate representation of the software program, where each node of the call graph represents a procedure and each edge between nodes of the call graph represents a call point, and performing (i) to (v) at each node.

In an embodiment, (i) to (v) are performed at each node of the call graph in a depth-first traversal order.
In an embodiment, the software program involves symmetric mufti-processing (SMP) and (ii) comprises identifying and collecting address loading operations at each call point.
In an embodiment, (iii) comprises selecting candidate upward exposed expressions from a ranking of the computation costs calculated in (ii).
In another aspect of the invention, there is provided a computer readable medium containing computer readable code for optimizing a software program, the software program including a plurality of procedures with at least one caller procedure interconnected to a callee procedure by a procedure call, the callee procedure having at least one upward exposed expression contained therein, the computer readable code comprising:
(a) code for analyzing dataflow for each callee procedure and identifying any upward exposed expressions;
(b) code for calculating a computation cost for each upward exposed expression identified in (a);
(c) code for selecting, in dependence upon the computation cost calculated in (b), a candidate upward exposed expression for replacement;
(d) code for building a procedure interface descriptor, the building comprising:
defining a new formal parameter for each candidate upward exposed expression selected in (c);

replacing each upward exposed expression with the new formal parameter in the callee procedure, identifying any resulting dead parameters for removal;
(e) modifying a corresponding call interface at each affected call site in the caller procedure utilizing the procedure interface descriptor.
In an embodiment, the computer readable code further includes code to convert the software program to a call graph intermediate representation, where each node of the call graph represents a procedure and each edge between nodes of the call graph represents a call point, and code to execute (a) to (e) at each node of the call graph.
In an embodiment, the computer readable code further includes code to execute (a) to (e) at each node of the call graph in a depth-first traversal order.
In an embodiment, the software program involves symmetric mufti-processing (SMP), and (b) comprises code for identifying and collecting address loading operations at each the call point.
In an embodiment, (c) comprises code for selecting candidate upward exposed expressions from a ranking of computation costs calculated by (b).
In another aspect of the invention, there is provided a system for optimizing a software program, the software program including a plurality of procedures with at least one caller procedure interconnected to a callee procedure by a procedure call, the callee procedure having at least one upward exposed expression contained therein, the system comprising:
(a) means for analyzing dataflow for each the cahee procedure and identifying any upward exposed expressions;
(b) means for calculating a computation cost for each upward exposed expression identified in (a);
(c) means for selecting, in dependence upon the computation cost calculated in (b), a candidate upward exposed expression for replacement;
(d) means for building a procedure interface descriptor, the building comprising:
defining a new formal parameter for each candidate upward exposed expression selected in (c);
replacing each upward exposed expression with the new formal parameter in the callee procedure;
identifying any resulting dead parameters for removal;
(e) means for modifying a corresponding call interface at each affected call site in the caller procedure utilizing the procedure interface descriptor.
In an embodiment, the system further includes means for generating a call graph intermediate representation of the software program, where each node of the call graph represents a procedure and each edge between nodes of the call graph represents a call point.
In an embodiment the system further includes means for traversing each node of the call graph in a depth-first traversal order.

In another aspect of the invention, there is provided a system comprising a processor and computer readable memory, the memory storing code for optimizing a software program, the code being adapted to:
(a) analyze dataflow for each the callee procedure and identifying any upward exposed expressions;
(b) calculate a computation cost for each upward exposed expression identified in (a);
(c) select, in dependence upon the computation cost calculated in (b), a candidate upward exposed expression for replacement;
IO (d) build a procedure interface descriptor by defining a new formal parameter for each candidate upward exposed expression selected in (c);
replacing each upward exposed expression with the new formal parameter in the callee procedure;
identifying any resulting dead parameters for removal;
(e) modify a corresponding call interface at each affected call site in the caller procedure utilizing the procedure interface descriptor.
In an embodiment, the code is further adapted to generate a call graph intermediate representation of the software program, where each node of the call graph represents a procedure and each edge between nodes of the call graph represents a call point.

In an embodiment, the code is further adapted to traverse each node of the call graph in a depth-first traversal order.
The foregoing and other aspects of the invention will be apparent from the following more particular descriptions of exemplary embodiments of the invention.
BRIEF DESCRIPTION OF THE DRAWINGS
In the figures which illustrate exemplary embodiments of the invention:
FIG. 1 is a schematic block diagram of a generic computer system which may provide an operating environment for exemplary embodiments of the invention.
FIG. 2 is an illustrative example of software pseudo-code that may be optimized during compilation, in accordance with an embodiment of the invention.
FIG. 3 is an illustrative example of the software pseudo-code of FIG. 2 after completion of interprocedural code motion in accordance with an embodiment of the invention.
FIG. 4 is a schematic flow chart of a method in accordance with an embodiment of the invention.
DETAILED DESCRIPTION OF EXEMPLARY EMBODIMENTS
Referring to FIG. 1, shown is an exemplary computer system 100 that may provide an operating environment for exemplary embodiments of the invention. The computer system 100 may include a central processing unit ("CPU") 102 connected to a storage unit 104 and to a random access memory ("RAM") 106. The CPU 102 may execute an operating system 101, and a software program 103 compiled by a software program code compiler 123. The operating system 101, software program code compiler 123 and the software program 103 may be stored in the storage unit 104 and loaded into RAM 106, as required. A user 107 may interact with the computer system 100 using a video display 108 connected by a video interface 105, and various inpudoutput devices such as a keyboard 110, mouse 112, and disk drive 114 connected by an I/O
interface 109. The disk drive 114 may be configured to accept computer readable media 116.
Optionally, the computer system 100 may be network enabled via a network interface 111. It will be appreciated that the computer system 100 of FIG. 1 is merely illustrative and is not meant to be limiting in terms of the type of system that might provide a suitable operating environment for the invention.
As will become apparent, the software program code compiler 123 of FIG. 1 may be configured to make multiple passes of each procedure in the software program 103 in order to collect information about the procedures that can be used for optimizing the software program 103.
The collected information can then be used for both interprocedural and intraprocedural code motion optimization. As an example, U.S. Patent No. 5,768,595 entitled "System and method for recompiling software programs for enhanced optimization" describes in detail a two-pass interprocedural analysis (IPA). More specifically, a first IPA pass is performed at compile time to collect summary information for each procedure compiled. Then, a second IPA pass is performed at link time. As will become apparent, information collected from the first IPA pass may be analyzed and used to identify interprocedural code motion that may improve the structure of executable code during the second IPA pass.

FIG. 2 is an illustrative example of a "C" style software program pseudo-code 200 (as embodied in software program 103 of FIG. 1, for example) that may be optimized according to an exemplary embodiment of the present invention. In the illustrative example of FIG. 2, "a", "b", and "c" are external variables. A caller procedure "barn (at lines 201-207) calls a callee procedure "foo" (at lines 208-214) from a call site (at line 204) by passing a variable "a"
through a parameter "pa" (at line 210). An integer "x" is also passed through parameter "px". In this illustrative example, "UEE1 (pa, c ) " (at line 210) is an upward exposed expression containing parameters "pa " and " c ". The "UEE 1 ( pa , c ) "
upward exposed expression may optionally contain literal constants (not shown in this example). As shown, "UEE2 ( b ) " (at line 212) is another upward exposed expression containing parameter "b"
Again, the "UEE2 ( b ) " upward exposed expression may optionally contain literal constants (not shown in this example).
FIG. 3 shows an illustrative example of resulting pseudo-code 300, after interprocedural code motion has been performed, in accordance with an exemplary embodiment of the invention, on the pseudo-code 200 of FIG. 2. More specifically, the upward exposed expressions "UEE1 (pa, c ) " (line 210) and "UEE2 (b) " (line 212) have both been moved out of the callee procedure "foo" (lines 208-214) by passing through new formal parameters, "icml" and "icm2 ", which are provided in their place. A more detailed description of this interprocedural code motion technique is provided further below.

In an embodiment, pseudo-code 300 may be further improved by using one or more of the known intraprocedual code motion techniques previously discussed. For example, the computation of "UEE1 (a, c) " and "UEE2 (b) " (at line 304) in the loop of procedure "bar"
(lines 301-307) might be moved out of the loop in accordance with loop invariant code motion, if such code motion is calculated to improve software program performance.
FIG. 4 shows a schematic flow chart of a method 400 in accordance with an exemplary embodiment of the invention. Method 400 performs the following, for each target callee procedure:
(i) at block 402, method 400 analyzes dataflow for each callee procedure and identifies any upward exposed expressions;
(ii) at block 404, method 400 calculates a computation cost for each upward exposed expression identified in (i);
(iii) at block 406, method 400 selects, in dependence upon the computation cost calculated in (ii), a candidate upward exposed expression for replacement;
(iv) at block 408, method 400 builds a procedure interface descriptor, the building comprising:
defining a new formal parameter for each candidate upward exposed expression selected in (iii);
replacing each upward exposed expression with the new formal parameter in the callee procedure;
identifying any resulting dead parameters for removal;

(v) at block 410, method 400 modifies a corresponding call interface at each affected call site in the caller procedure utilizing the procedure interface descriptor.
In an embodiment, the software program code compiler 123 is configured to generate an intermediate representation of the software program 103 known as a "call graph". As will be familiar to those in the art, a "call graph" is a directed mufti-graph in which the nodes represent procedures in the code being compiled, and in which the edges between the nodes represent call points. For a more detailed discussion on call graphs, the reader is directed to reference texts in the field, such as Steven S. Muchnuk, Advanced Compiler Design and Implementation, (Morgan Kaufmann, 1997).
In an exemplary embodiment, the software program code compiler 123 may be configured to also generate a "control flow graph". As known in the art, a "control flow graph"
is a directed graph in which the nodes represent basic blocks, and the edges between the nodes represent flow of control between the basic blocks. Here, a basic block is a sequence of consecutive statements in which flow of control enters at the beginning and leaves at the end without halt or possibility of branching, except at the end. The data structures of a control flow graph, and their uses in an intermediate representation of code in an optimizing compiler, are known to those skilled in the art. For a more detailed discussion on control flow graphs, the reader is directed to the Muchnuk text, above.
In an exemplary embodiment, the software program code compiler 123 may be configured to also generate a "data flow graph". As known in the art, a "data flow graph" is a directed graph in which the nodes represent data operations (loads or stores), and the edges between the nodes represent data dependency relations. The data structures of a data flow graph, and their uses in an intermediate representation of code in an optimizing compiler, are known to those skilled in the art. For a more detailed discussion on data flow graphs, the reader is directed to the Muchnuk text, above.
In an exemplary embodiment, the software program code compiler 123 may be configured to generate a "post-dominator tree". As known in the art, a "post-dominator tree" is derived from the control flow graph and represents the control flow "post-dominator"
relationship between blocks in the software program 103 code. As a simple example, if a "block B" post-dominates "block A" , and if "block A" is executed, then "block B"
must also be executed. For a more detailed discussion on post-dominator trees, the reader is again directed to the Muchnuk text, above.
In an exemplary embodiment, the software program code compiler 123 may be configured to generate a "procedure interface descriptor" for each procedure.
The "procedure interface descriptor", as previously introduced, is a data structure that may be used to keep track of parameters for each callee procedure. In an embodiment, the procedure interface descriptor may be a parameter set, and each entry in the parameter set may hold the following attributes:
(i) An upward exposed expression for a parameter to be added.
(ii) A variable identification for the parameter.
(iii) A type of parameter selected from the following possibilities:
(a) the parameter is to be replaced (OLD_PARAM);

(b) the parameter is to be removed (DEAD_PARAM);
(c) the parameter represents an upward exposed expression which is to be moved (NEW_PARAM).
In operation; in accordance with an exemplary embodiment, the code compiler 123 is configured to traverse each node of a call graph of the software program 103 (e.g. a call graph of the pseudo-code 200 being compiled) in depth-first order. That is to say, the deepest or lowest hierarchy nodes are traversed first. If an intermediate call graph representation for a procedure is not available, then, for the present purposes, the procedure is identified as an undefined procedure. A procedure called by any undefined procedure cannot have its call interface changed, even if it is itself a defined procedure.
In an embodiment, by making use of a data flow graph intermediate representation of the software program 103, upward exposed expressions in a target callee procedure can be determined using known computer optimization techniques. Also, in accordance with an exemplary embodiment, by analyzing the post-dominate tree for the software program 103, only those upward exposed expressions which post-dominate the procedure entry are considered for movement across procedure boundaries.
In accordance with an embodiment of the invention, a heuristic may be used to select suitable candidate upward exposed expressions for interprocedural code motion.
For example, in an embodiment, the heuristic may consider a ranking of calculated computation costs to select candidate upward exposed expressions.

As there may be a limit on the number of extra parameters available for any given computer system (e.g. computer system 100 of FIG. 1), only one or a few of the top ranked upward exposed expressions may be selected for code motion. However, when the expression is costly enough, one can consider exceeding the number of available register parameters as long as the benefit of moving these expensive computations overcome any overhead of going through storage (e.g. storage 104 of FIG. 1) when the extra parameters are being passed.
In another embodiment, the computation cost may be calculated heuristically by taking into account various performance factors. These performance factors may include, for example, hardware instruction cycle count, frequency of execution, and parameter passing overhead.
As a particular example, consider an upward exposed expression that performs address loading operations. By definition, address loading operations produce constant values, and typically have a low computation cost. Thus, normally, moving an upward exposed expression involving a plain invariant address loading operation may not necessarily generate a meaningful performance gain. However, in the case of symmetric multi-processing ("SMP"), moving address loading operations of thread private variables out of a procedure may make a significant difference in performance. Thus, when SMP is involved, upward exposed expressions which involve address loading of thread private variables may be identified as good candidates for interprocedural code motion, since they may call the SMP runtime procedures.

Once such upward exposed expressions are identified, and the corresponding computation costs are calculated, an upward exposed expression set may be built. Each entry in this upward exposed expression set is then a candidate for moving across a procedure boundary.
In the present illustrative example, as shown in FIG. 3, for each candidate upward exposed expression (e.g. expression "UEE1 (pa, c) " at line 210) selected for code motion, a new parameter (e.g. parameter " i cm1 " at line 310) is created to replace all occurrences of the upward exposed expression ("UEE1 (pa, c ) "). The computation of the selected expression ("UEE1 (pa, c ) ") is then moved to the call site (i.e. line 304 in caller procedure "bar") and the computed value of the moved upwardly exposed expression is passed back as an argument to the called procedure (" foo") using the new formal parameter (" icml "). A
variable identifying the new parameter is then created. All the uses of the upward exposed expression are thus replaced with the new formal parameter. As this may cause some of the original parameters to go dead (e.g. parameter "pa"), the dead parameters are identified and removed.

In an embodiment, a modification of a procedure interface is recorded in the procedure interface descriptor, as introduced above. More specifically, on entry, a procedure interface descriptor is added for a new parameter with a type NEW PARAM. A pointer to an expression tree is also recorded. An entry in the procedure interface descriptor is also added for each removed parameter with a type of DEAD_PARAM. Finally, an entry in the procedure interface descriptor is also added for each retained parameter in the moved expression with a type of OLD PARAM. This information may then be used to modify the various affected call sites.

In the present illustrative example, a resulting procedure interface descriptor for the callee procedure " f oo" of FIG. 3 may look like this:
[0]:DEAD PARAM, id = pa [ 1 ] :OI.D_PARAM, id = px [2]:NEW_PARAM, id = icml, expr = UEE1(a,c) [3]:NEW PARAM, id = icm2, expr = UEE2(b) Thus, when a new call interface is created in the callee procedure " f oo ", the corresponding call site may be modified using the above procedure interface descriptor. This may involve, for example, importing variables into a call site's compilation unit when an upward exposed expression uses an external or reference parameter.
In an embodiment, proceeding in a depth-first traversal fashion, method 400 of FIG. 4 may be repeated for each procedure (i.e. each node of a call graph) of a software program 103.
As will be appreciated, since the method 400 traverses a call graph in a depth-first order, a "percolating" effect may emerge where candidate upward exposed expressions are hoisted up the call graph. In other words, those upward exposed expressions that are selected as the best candidates for code motion from the deepest or lowest nodes may be moved up the call graph hierarchy more than one procedure level.
As previously mentioned, after interprocedural code motion is performed according to method 400, other interprocedural and intraprocedural optimization techniques may be applied to further improve software program performance.

Although various exemplary embodiments of the invention have been described above, it will be appreciated that variations and modifications may be made thereto without departing from the scope of the invention.
For example, interprocedural code motion may be implemented using any suitable intermediate representation of a software program where the necessary procedure call information is accessible. Furthermore, the teachings of the present invention may be practiced with virtually any computer program code compiler compiling a wide variety of computer languages (FORTRAN, C, C++, etc.). It will also be appreciated that the method as described above may be applied at other-levels of the software program code compilation process as well.
Thus, the scope of the invention is defined by the following claims.

Claims (16)

WHAT IS CLAIMED IS:
1. A method of optimizing a software program, said software program including a plurality of procedures with at least one caller procedure interconnected to a callee procedure by a procedure call, said callee procedure having at least one upward exposed expression contained therein, said method comprising:
(i) analyzing dataflow for each said callee procedure and identifying any said upward exposed expressions;
(ii) calculating a computation cost for each said upward exposed expression identified in (i);
(iii) selecting, in dependence upon said computation cost calculated in (ii), a candidate upward exposed expression for replacement;
(iv) building a procedure interface descriptor, said building comprising:
defining a new formal parameter for each said candidate upward exposed expression selected in (iii);
replacing each said upward exposed expression with said new formal parameter in said callee procedure;
identifying any resulting dead parameters for removal;
(v) modifying a corresponding call interface at each affected call site in said caller procedure utilizing said procedure interface descriptor.
2. The method of claim 1, further comprising generating a call graph intermediate representation of said software program, where each node of said call graph represents a procedure and each edge between said nodes of said call graph represents a call point, and performing (i) to (v) at each said node.
3. The method of claim 2, wherein (i) to (v) are performed at each said node of said call graph in a depth-first traversal order.
4. The method of claim 1, wherein said software program involves symmetric multi-processing (SMP) and (ii) comprises identifying and collecting address loading operations at each said call point.
5. The method of claim 1, wherein (iii) comprises selecting said candidate upward exposed expressions from a ranking of said computation costs calculated in (ii).
6. A computer readable medium containing computer readable code for optimizing a software program, said software program including a plurality of procedures with at least one caller procedure interconnected to a callee procedure by a procedure call, said callee procedure having at least one upward exposed expression contained therein, said computer readable code comprising:
(a) code for analyzing dataflow for each said callee procedure and identifying any said upward exposed expressions;

(b) code for calculating a computation cost for each said upward exposed expression identified in (a);
(c) code for selecting, in dependence upon said computation cost calculated in (b), a candidate upward exposed expression for replacement;
(d) code for building a procedure interface descriptor, said building comprising:
defining a new formal parameter for each said candidate upward exposed expression selected in (c);
replacing each said upward exposed expression with said new formal parameter in said callee procedure;
identifying any resulting dead parameters for removal;
(e) modifying a corresponding call interface at each affected call site in said caller procedure utilizing said procedure interface descriptor.
7. The computer readable medium of claim 6, wherein said computer readable code further includes code to convert said software program to a call graph intermediate representation, where each node of said call graph represents a procedure and each edge between said nodes of said call graph represents a call point, and code to execute (a) to (e) at each said node of said call graph.
8. The computer readable medium of claim 6, wherein said computer readable code further includes code to execute (a) to (e) at each said node of said call graph in a depth-first traversal order.
9. The computer readable medium of claim 6, wherein said software program involves symmetric multi-processing (SMP), and (b) comprises code for identifying and collecting address loading operations at each said call point.
10. The computer readable medium of claim 6, wherein (c) comprises code for selecting said candidate upward exposed expressions from a ranking of computation costs calculated by (b).
11. A system for optimizing a software program, said software program including a plurality of procedures with at least one caller procedure interconnected to a callee procedure by a procedure call, said callee procedure having at least one upward exposed expression contained therein, said system comprising:
(a) means for analyzing dataflow for each said callee procedure and identifying any said upward exposed expressions;
(b) means for calculating a computation cost for each said upward exposed expression identified in (a);
(c) means for selecting, in dependence upon said computation cost calculated in (b), a candidate upward exposed expression for replacement;
(d) means for building a procedure interface descriptor, said building comprising:
defining a new formal parameter for each said candidate upward exposed expression selected in (c);
replacing each said upward exposed expression with said new formal parameter in said callee procedure;
identifying any resulting dead parameters for removal;

(e) means for modifying a corresponding call interface at each affected call site in said caller procedure utilizing said procedure interface descriptor.
12. The system of claim 11, wherein said system further includes means for generating a call graph intermediate representation of said software program, where each node of said call graph represents a procedure and each edge between said nodes of said call graph represents a call point.
13. The system of claim 11, wherein said system further includes means for traversing each said node of said call graph in a depth-first traversal order.
14. A system comprising a processor and computer readable memory, said memory storing code for optimizing a software program, said code being adapted to:
(a) analyze dataflow for each said callee procedure and identifying any said upward exposed expressions;
(b) calculate a computation cost for each said upward exposed expression identified in (a);
(c) select, in dependence upon said computation cost calculated in (b), a candidate upward exposed expression for replacement;
(d) build a procedure interface descriptor by defining a new formal parameter for each said candidate upward exposed expression selected in (c);

replacing each said upward exposed expression with said new formal parameter in said callee procedure;
identifying any resulting dead parameters for removal;
(e) modify a corresponding call interface at each affected call site in said caller procedure utilizing said procedure interface descriptor.
15. The system of claim 14, wherein said code is further adapted to generate a call graph intermediate representation of said software program, where each node of said call graph represents a procedure and each edge between said nodes of said call graph represents a call point.
16. The system of claim 14, wherein said code is further adapted to traverse each said node of said call graph in a depth-first traversal order.
CA002447443A 2003-10-29 2003-10-29 Method and system for optimizing a software program using interprocedural code motion Abandoned CA2447443A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CA002447443A CA2447443A1 (en) 2003-10-29 2003-10-29 Method and system for optimizing a software program using interprocedural code motion

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CA002447443A CA2447443A1 (en) 2003-10-29 2003-10-29 Method and system for optimizing a software program using interprocedural code motion

Publications (1)

Publication Number Publication Date
CA2447443A1 true CA2447443A1 (en) 2005-04-29

Family

ID=34468747

Family Applications (1)

Application Number Title Priority Date Filing Date
CA002447443A Abandoned CA2447443A1 (en) 2003-10-29 2003-10-29 Method and system for optimizing a software program using interprocedural code motion

Country Status (1)

Country Link
CA (1) CA2447443A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9367434B2 (en) 2013-10-02 2016-06-14 Accenture Global Services Limited Testing framework for policy-based workflows

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9367434B2 (en) 2013-10-02 2016-06-14 Accenture Global Services Limited Testing framework for policy-based workflows

Similar Documents

Publication Publication Date Title
US6381739B1 (en) Method and apparatus for hierarchical restructuring of computer code
Pop et al. GRAPHITE: Polyhedral analyses and optimizations for GCC
US5889999A (en) Method and apparatus for sequencing computer instruction execution in a data processing system
US6631518B1 (en) Generating and utilizing organized profile information
JP4003830B2 (en) Method and system for transparent dynamic optimization in a multiprocessing environment
US5740443A (en) Call-site specific selective automatic inlining
US6718541B2 (en) Register economy heuristic for a cycle driven multiple issue instruction scheduler
JP3337174B2 (en) Compilation method
US6523173B1 (en) Method and apparatus for allocating registers during code compilation using different spill strategies to evaluate spill cost
US6412105B1 (en) Computer method and apparatus for compilation of multi-way decisions
EP1618470B1 (en) Method and apparatus for recovering data values in dynamic runtime systems
Kulkarni et al. Automatic construction of inlining heuristics using machine learning
Leopoldseder et al. Dominance-based duplication simulation (DBDS): code duplication to enable compiler optimizations
JPH0336632A (en) Optimizing method at time of compile
US5937191A (en) Determining and reporting data accessing activity of a program
Ball Predicting the effects of optimization on a procedure body
Agrawal et al. Interprocedural compilation of irregular applications for distributed memory machines
US20020166115A1 (en) System and method for computer program compilation using scalar register promotion and static single assignment representation
Suganuma et al. A region-based compilation technique for dynamic compilers
US7069555B1 (en) Super-region instruction scheduling and code generation for merging identical instruction into the ready-to-schedule instruction
Leopoldseder et al. Fast-path loop unrolling of non-counted loops to enable subsequent compiler optimizations
Mosaner et al. Using machine learning to predict the code size impact of duplication heuristics in a dynamic compiler
Huang et al. Improving Sequential Performance of Erlang Based on a Meta-tracing Just-In-Time Compiler
Briggs et al. Goal-directed interprocedural optimization
Mahlke Design and implementation of a portable global code optimizer

Legal Events

Date Code Title Description
EEER Examination request
FZDE Discontinued
FZDE Discontinued

Effective date: 20061030