Patent ID: 7743368

Claim:
A method of providing class hierarchy information for function devirtualization of a program that includes a plurality of classes, the plurality of classes having virtual functions, the method comprising: identifying a plurality of nodes from virtual tables in an intermediate representation of the program generated by a compiler front end in a compiler in a computer system, wherein the intermediate representation of the program includes virtual tables and type structure information of each of the plurality of classes, and wherein identifying a plurality of nodes from virtual tables comprises: creating a node for each virtual table in the intermediate representation; determining a class name of the created node for each virtual table; if a node corresponding to the class name does exist in the plurality of nodes, deleting the created node from the class hierarchy information; and if a node corresponding to the class name does not exist in the plurality of nodes, adding the created node to the plurality of nodes in the class hierarchy information; identifying relationships between the plurality of nodes using the type structure information in the intermediate representation of the program by the compiler front end, wherein identifying relationships between the plurality of nodes comprises: identifying list of virtual functions from virtual table of a node; identifying a baseclass by following pointers of each of the virtual functions to the type structure information; if the baseclass is identified in the type structure information, determining a node corresponding to the identified baseclass and defining a superclass-subclass relationship between the determined node and the node; and if the baseclass is not identified in the type structure information, repeating identifying list of virtual functions, identifying a baseclass, and determining node corresponding to the identified baseclass and defining a superclass-subclass for all other nodes in the plurality of nodes; and creating the class hierarchy information by the compiler front end in the compiler based on the identified plurality of nodes and the identified relationships between the plurality of nodes, wherein the class hierarchy information includes nodes corresponding to the identified plurality of nodes and edges corresponding to the identified relationships between the plurality of nodes.