Ejemplo n.º 1
0
CopyArrayConfig 
ComputeCopyConfig( const DepCompAstRefAnal& stmtorder,
                   const DepCompCopyArrayCollect::CopyArrayUnit& unit,
                   const DepCompAstRefGraphNode* initcut)
{
    assert (unit.refs.size() > 0);

    AstInterface& ai = LoopTransformInterface::getAstInterface();
    const DepCompAstRef& initInfo = initcut->GetInfo();

    AstNodePtr lhs;
    bool is_init = ai.IsAssignment(initInfo.stmt->GetOrigStmt(), &lhs) 
                   && (lhs == initcut->GetInfo().orig);
    AstNodeType inittype;
    if (ai.IsExpression(initInfo.orig, &inittype)==AST_NULL)
      assert(false);
    bool has_write = false;

    AstNodePtr arr;
    std::string arrname, elemtypename;
    ai.GetTypeInfo(inittype, 0, &elemtypename); //QY: strip out ref info &
    AstNodeType elemtype = ai.GetType(elemtypename);

    AstInterface::AstNodeList initIndex;
    if (!LoopTransformInterface::IsArrayAccess(initInfo.orig, &arr, &initIndex) || !ai.IsVarRef(arr,0,&arrname))
       assert(false);

    SelectArray cursel(elemtype, arrname, initIndex.size());
    cursel.select(initInfo.stmt, unit.root, initIndex);

    for (DepCompCopyArrayCollect::CopyArrayUnit::NodeSet::const_iterator p = unit.refs.begin();
          !p.ReachEnd(); ++p)  {
        const DepCompAstRefGraphNode* curref = *p;
        const DepCompAstRef& curinfo = curref->GetInfo();
        if (stmtorder.is_mod_ref(curinfo.orig))
            has_write = true;
        AstInterface::AstNodeList curIndex;
        if (!LoopTransformInterface::IsArrayAccess(curinfo.orig, 0, &curIndex))
           assert(false);
        if (cursel.select(curinfo.stmt, unit.root, curIndex)) 
          is_init = false;
   }
   cursel.set_bufsize(ai);
   LoopTreeNode* shift = 0;
   if (unit.carrybyroot)
       shift = unit.root; 
   int copyopt = 0;
   if (!is_init) 
      copyopt |= INIT_COPY;
   if  (has_write)
      copyopt |= SAVE_COPY;
      
   CopyArrayOpt opt = (CopyArrayOpt)copyopt;
   CopyArrayConfig curconfig(ai, cursel, opt, shift);
   return curconfig;
}
Ejemplo n.º 2
0
void OutputPane::OnEditorFocus(wxCommandEvent& e)
{
    e.Skip();
    if (EditorConfigST::Get()->GetOptions()->GetHideOutpuPaneOnUserClick()) {

        // Optionally don't hide the various panes (sometimes it's irritating, you click to do something and...)
        size_t cursel(m_book->GetSelection());
        if (cursel != Notebook::npos
            && EditorConfigST::Get()->GetPaneStickiness(m_book->GetPageText(cursel))) {
            return;
        }

        if(m_buildInProgress)
            return;

        wxAuiPaneInfo &info = PluginManager::Get()->GetDockingManager()->GetPane(wxT("Output View"));
        DockablePaneMenuManager::HackHidePane(true, info, PluginManager::Get()->GetDockingManager());
    }
}