Go to the first, previous, next, last section, table of contents.


Copying the Objects

Once the exposed references have been resolved, the code can be copied. The tree_node_list, tree_node, operand, instruction, block_symtab, and proc_symtab classes have clone_helper methods to perform the actual copying. These methods change references to objects in the original objects lists of the replacements structure to references to the newly created replacements.

Annotations on the objects are also cloned. The clone_annotes method is used to copy the annotations from one suif_object to another. Unregistered annotations cannot be copied because the structure of their data fields is unknown. The clone_helper methods call clone_annotes for each object that is cloned; you generally do not need to call it directly.

The clone_helper and clone_annotes methods can also be used to perform another related function. It is occasionally necessary to replace references to one set of objects with references to another set of objects. Since the cloning methods do that anyway, it is easy to have them update the references without actually making copies. Setting the no_copy parameter causes them to update the references as specified in a replacements structure without copying the objects.


Go to the first, previous, next, last section, table of contents.