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

The IR Tree

The state of the entire compilation process is held by the suif_env object, and there are no other global variables or states. The suif_env holds onto the root of the program being compiled FileSetBlock and references to all the modules imported into the environment.

As discussed in Section 2, the program is embedded in an ownership tree. Every object in the SUIF IR has precisely one owner, which can be retrieved by the get_parent() method in a SuifObject. You do not need to set the owner explicitly; it is set implicitly when a pointer to the object is assigned to a pointer field with the ``owner'' property defined in the Hoof description. You will get an error message if you try to create multiple owners for a single node.

The set of nodes owned by a node can be obtained using the collect_instance_objects iterator, defined in basesuif/suifkernel/utilities.h, as is done in the WalkingMap implementation in walking_maps.cpp of the same directory.

David Heine