コード例 #1
0
ファイル: Namespace.cpp プロジェクト: BielBdeLuna/DarkRadiant
void Namespace::connect(const scene::INodePtr& root)
{
    // Now traverse the subgraph and connect the nodes
    ConnectNamespacedWalker firstWalker(this);
    root->traverse(firstWalker);

    ConnectNameObserverWalker secondWalker;
    root->traverse(secondWalker);
}
コード例 #2
0
ファイル: SSA.cpp プロジェクト: unitedroad/harmony-for-haiku
// check for new Vars which are not in SSA form; if there are any, fix up all occurrences of 
// that var, put into SSA form.
bool SSABuilder::fixupVars(ControlFlowGraph*fg, MethodDesc& methodDesc) {
    // clear out all Phi args
    MemoryManager localMM("SSABuilder::fixupVars::memManager");

#ifdef DEBUG_SSA
    if (Log::isEnabled()) {
        Log::out() << "Starting fixupVars" << ::std::endl;
        
        FlowGraph::printDotFile(*fg, methodDesc, "midfixupvars-0");
    }
#endif

    StlVectorSet<VarOpnd *> usedOutOfSsa(localMM);
    ScanSsaVarsWalker firstWalker(this, usedOutOfSsa);
    typedef Inst2NodeWalker<true, ScanSsaVarsWalker> ScanSsaVarsNodeWalker;
    ScanSsaVarsNodeWalker scanSsaVarsNodeWalker(firstWalker);
    NodeWalk<ScanSsaVarsNodeWalker>(*fg, scanSsaVarsNodeWalker);

    // now usedOutOfSsa has vars that need to be fixed up

    if (!usedOutOfSsa.empty()) {
        // cleanup in case there are any other uses still.
        DeSsaVarsWalker cleanupWalker(this, usedOutOfSsa);

        typedef Inst2NodeWalker<true, DeSsaVarsWalker> DeSsaVarsNodeWalker;
        DeSsaVarsNodeWalker cleanupNodeWalker(cleanupWalker);

        NodeWalk<DeSsaVarsNodeWalker>(*fg, cleanupNodeWalker);
        
        // now all vars in usedOutOfSsa are not used in SSA form, and have no Phis.
        
#ifdef DEBUG_SSA
        if (Log::isEnabled()) {
            FlowGraph::printDotFile(*fg,methodDesc, "midfixupvars-1");
        }
#endif

        // just run the conversion pass
        convertSSA(methodDesc);
    }

#ifdef DEBUG_SSA
    if (Log::isEnabled()) {
        FlowGraph::printDotFile(*fg, methodDesc, "midfixupvars-3");
        
        Log::out() << "Finished fixupVars" << ::std::endl;
    }
#endif

    return !usedOutOfSsa.empty();
}