当前位置: 首页>>代码示例>>C++>>正文


C++ PEdge::IsAssume方法代码示例

本文整理汇总了C++中PEdge::IsAssume方法的典型用法代码示例。如果您正苦于以下问题:C++ PEdge::IsAssume方法的具体用法?C++ PEdge::IsAssume怎么用?C++ PEdge::IsAssume使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PEdge的用法示例。


在下文中一共展示了PEdge::IsAssume方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetLoopIsomorphicPoints

// marks the points in cfg which are isomorphic to points in the loop_cfg
// invoked by cfg at the specified edge. code in a syntactic loop body
// will be reflected in CFGs for both the loop and its parent if it may
// reach both the recursive loop edge and a loop exit point. this common
// code will be isomorphic between the two CFGs.
void GetLoopIsomorphicPoints(BlockCFG *cfg, PEdge *loop_edge,
                             BlockCFG *loop_cfg)
{
    // mapping from points in cfg to isomorphic points in loop_cfg.
    PPointListHash remapping;

    // worklist items are isomorphic points whose outgoing edges have not
    // been examined.
    Vector<PPoint> worklist;

    PPoint target = loop_edge->GetTarget();
    remapping.Insert(target, loop_cfg->GetEntryPoint());
    cfg->AddLoopIsomorphic(target);
    worklist.PushBack(target);

    while (!worklist.Empty()) {
        PPoint cfg_point = worklist.Back();
        worklist.PopBack();

        PPoint loop_point = remapping.LookupSingle(cfg_point);

        const Vector<PEdge*> &cfg_outgoing =
            cfg->GetOutgoingEdges(cfg_point);
        const Vector<PEdge*> &loop_outgoing =
            loop_cfg->GetOutgoingEdges(loop_point);

        for (size_t eind = 0; eind < cfg_outgoing.Size(); eind++) {
            PEdge *edge = cfg_outgoing[eind];
            PPoint target = edge->GetTarget();

            // check for an existing remapping entry. some isomorphic points have
            // multiple incoming edges. we don't need to check all such incoming
            // edges; if any edge is isomorphic, they all will be.
            if (remapping.Lookup(target, false))
                continue;

            // look for an equivalent outgoing edge from the loop.
            PPoint loop_target = 0;

            for (size_t lind = 0; lind < loop_outgoing.Size(); lind++) {
                PEdge *loop_edge = loop_outgoing[lind];

                if (PEdge::CompareInner(edge, loop_edge) == 0) {
                    loop_target = loop_edge->GetTarget();
                    break;
                }
            }

            if (!loop_target) {
                Assert(edge->IsAssume());
                continue;
            }

            remapping.Insert(target, loop_target);
            cfg->AddLoopIsomorphic(target);
            worklist.PushBack(target);
        }
    }
}
开发者ID:wh5a,项目名称:xgill,代码行数:64,代码来源:loopsplit.cpp


注:本文中的PEdge::IsAssume方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。