Method and apparatus for conflict-based block reordering
First Claim
Patent Images
1. A method of ordering the blocks of a computer program for efficient execution, the method comprising the steps, performed by a data processing system, of:
- dividing the computer program into a plurality of blocks;
generating a control flow graph representing a flow of control between the plurality of blocks;
generating a conflict graph in accordance with the control flow graph, where the edges of the conflict graph indicate which paths in the flow of control have conflicts;
determining a maximum weight independent set of the conflict graph; and
ordering the blocks of the computer program in accordance with the determined maximum weight independent set.
3 Assignments
0 Petitions
Accused Products
Abstract
A method and apparatus for ordering blocks of code by a compiler. The compiler generates a conflict graph in accordance with the blocks of a computer program being compiled. Once the conflict graph is generated, a preferred embodiment of the present invention finds maximum weight independent set (MWS) of nodes in the conflict graph. By definition, the nodes in the MWS have no flow control conflicts between them. The compiler then generates an object program having blocks ordered in accordance with the maximum weight independent set.
38 Citations
15 Claims
-
1. A method of ordering the blocks of a computer program for efficient execution, the method comprising the steps, performed by a data processing system, of:
-
dividing the computer program into a plurality of blocks; generating a control flow graph representing a flow of control between the plurality of blocks; generating a conflict graph in accordance with the control flow graph, where the edges of the conflict graph indicate which paths in the flow of control have conflicts; determining a maximum weight independent set of the conflict graph; and ordering the blocks of the computer program in accordance with the determined maximum weight independent set. - View Dependent Claims (2, 3, 4, 5, 6)
-
-
7. A method of ordering the blocks of a computer program for efficient execution, the method comprising the steps, performed by a data processing system, of:
-
dividing the computer program into a plurality of blocks; generating a control flow graph representing a flow of control between the plurality of blocks; generating a conflict graph in accordance with the control flow graph, where the edges of the conflict graph indicate which paths in the flow of control have conflicts; determining a maximum weight independent set of the conflict graph, the determining step including the steps of; turning an initial node in the conflict graph ON and placing it on a queue in a memory, removing a next node, v, from the queue, when the direction of a next node on the queue is ON, and when any neighbor nodes of v are selected and ON, turning the neighbor nodes OFF and placing the neighbor nodes on the queue, when the direction of a next node on the queue is OFF, and when any neighbor nodes of v are OFF, turning the neighbor nodes ON and placing the neighbor nodes on the queue, and keeping the highest weight set thus far as the new maximum weight independent set; and ordering the blocks of the computer program in accordance with the determined maximum weight independent set. - View Dependent Claims (8)
-
-
9. An apparatus that orders the blocks of a computer program for efficient execution, the apparatus comprising:
-
a portion configured to divide the computer program into a plurality of blocks; a portion configured to generate a control flow graph representing a flow of control between the plurality of blocks; a portion configured to generate a conflict graph in accordance with the control flow graph, where the edges of the conflict graph indicate which paths in the flow of control have conflicts; a portion configured to determine a maximum weight independent set of the conflict graph; and a portion configured to order the blocks of the computer program in accordance with the determined maximum weight independent set. - View Dependent Claims (10, 11, 12, 13, 14)
-
-
15. A computer program product, including:
-
a computer usable medium having computer readable code embodied therein for causing ordering of the blocks of a computer program for efficient execution, the computer program product comprising; computer readable program code devices configured to cause a computer to effect dividing the computer program into a plurality of blocks; computer readable program code devices configured to cause a computer to effect generating a control flow graph representing the flow of control between the plurality of blocks; computer readable program code devices configured to cause a computer to effect generating a conflict graph in accordance with the control flow graph, where the edges of the conflict graph indicate which paths in the flow of control have conflicts; computer readable program code devices configured to cause a computer to effect determining a maximum weight independent set of the conflict graph; and computer readable program code devices configured to cause a computer to effect ordering the blocks of the computer program in accordance with the determined maximum weight independent set.
-
Specification