Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends

OA::SSA::SSAStandard Class Reference

#include <SSAStandard.hpp>

Collaboration diagram for OA::SSA::SSAStandard:
Collaboration graph
[legend]

List of all members.

Classes

class  Def
class  DefBlocksIterator
class  LeafDef
class  LeafUse
class  NonLocalsIterator
class  PhiDef
class  PhiNodesIterator
class  PhiUse
class  Use

Public Member Functions

 SSAStandard (const SymHandle name, OA_ptr< SSAIRInterface > ir, OA_ptr< CFG::CFGInterface > cfg)
virtual ~SSAStandard ()
void dump (std::ostream &)
OA_ptr< PhiNodesIteratorgetPhiNodesIterator (OA_ptr< CFG::NodeInterface > n)
OA_ptr< NonLocalsIteratorgetNonLocalsIterator ()
OA_ptr< DefBlocksIteratorgetDefBlocksIterator (SymHandle nm)

Private Member Functions

void compute_uses_sets ()

Private Attributes

SymHandle name
OA_ptr< CFG::CFGInterfacecfg
std::map< OA_ptr
< CFG::NodeInterface >
, std::set< OA_ptr< SSA::Phi > > > 
phi_node_sets
OA_ptr< SSAIRInterfacemIR
std::set< LeafHandlenon_locals
std::map< SymHandle, std::set
< OA_ptr< CFG::NodeInterface > > > 
def_blocks_set

Friends

class PhiNodesIterator
class NonLocalsIterator
class DefBlocksIterator

Detailed Description

CFGStandard implements the CFG::Interface using the DGraph class. FIXME -- we should have an SSAStandard, etc.

Definition at line 49 of file SSAStandard.hpp.


Constructor & Destructor Documentation

OA::SSA::SSAStandard::SSAStandard ( const SymHandle  name_,
OA_ptr< SSAIRInterface ir_,
OA_ptr< CFG::CFGInterface cfg_ 
)

SSA constructor computes the dominator tree, and dominance frontiers from it, for the given CFG. Using the dominance frontiers, it then inserts phi functions using the following algorithm (from the book "Engineering a Compiler", by Keith D. Cooper and Linda Torczon, chapter "Data-flow Analysis"). The set NonLocals is the set of all upwardly exposed uses in each node of the CFG and is computed using the CFG method "compute_uses_sets". The map Blocks maps a variable name i to the set of CFG nodes (basic blocks) where it is defined.

    for each name i in NonLocals
        WorkList <-- Blocks(i)
        for each block b in WorkList
            for each block d in Dominance_Frontier(b)
                insert a phi function for i in d
                WorkList <-- WorkList + d
    

Definition at line 61 of file SSAStandard.cpp.

OA::SSA::SSAStandard::~SSAStandard (  )  [virtual]

Definition at line 118 of file SSAStandard.cpp.


Member Function Documentation

void OA::SSA::SSAStandard::compute_uses_sets (  )  [private]

Compute "uses" set for each basic block (one CFG node corresponds to one basic block). The set of uses is computed by traversing the statements in each node and eliminating the uses that get killed. In other words, only upwardly exposed uses are computed. Simultaneously, for each variable, the set of blocks that defines that variable, is also built (def_blocks_set).

Definition at line 133 of file SSAStandard.cpp.

void OA::SSA::SSAStandard::dump ( std::ostream &   ) 
OA_ptr<DefBlocksIterator> OA::SSA::SSAStandard::getDefBlocksIterator ( SymHandle  nm  )  [inline]

Definition at line 210 of file SSAStandard.hpp.

References DefBlocksIterator.

OA_ptr<NonLocalsIterator> OA::SSA::SSAStandard::getNonLocalsIterator (  )  [inline]

Definition at line 205 of file SSAStandard.hpp.

References NonLocalsIterator.

OA_ptr<PhiNodesIterator> OA::SSA::SSAStandard::getPhiNodesIterator ( OA_ptr< CFG::NodeInterface n  )  [inline]

Definition at line 200 of file SSAStandard.hpp.

References PhiNodesIterator.


Friends And Related Function Documentation

friend class DefBlocksIterator [friend]

Definition at line 58 of file SSAStandard.hpp.

Referenced by getDefBlocksIterator().

friend class NonLocalsIterator [friend]

Definition at line 57 of file SSAStandard.hpp.

Referenced by getNonLocalsIterator().

friend class PhiNodesIterator [friend]

Definition at line 55 of file SSAStandard.hpp.

Referenced by getPhiNodesIterator().


Member Data Documentation

Definition at line 221 of file SSAStandard.hpp.

Definition at line 227 of file SSAStandard.hpp.

Definition at line 220 of file SSAStandard.hpp.


The documentation for this class was generated from the following files: