next up previous contents
Next: Visitors Up: Programming with the SUIF Previous: Casting and Type Identification   Contents


Cloning is a basic operation that is useful for many compiler transformations. The SUIF has an elaborate cloning subsystem (CloneStream class in iokernel/clone_stream.h) that allows the programmer to perform cloning in many different ways. The details of this system are beyond the scope of this document.

Most SUIF programmers only need to know about the two cloning methods that are defined in SuifObject. The deep_clone method clones this object and all the objects in the ownership subtree rooted by this object, and returns the clone. The shallow_clone method clones this object, copies all references this object have to the new clone, and returns the new clone.

David Heine