Exemple #1
0
bool
sortVerticesByAddress(const ControlFlowGraph::ConstVertexNodeIterator &a,
                      const ControlFlowGraph::ConstVertexNodeIterator &b) {
    const CfgVertex &av = a->value();
    const CfgVertex &bv = b->value();
    if (av.type() != bv.type() || av.type() != V_BASIC_BLOCK)
        return av.type() < bv.type();
    return av.address() < bv.address();
}
Exemple #2
0
Sawyer::Optional<bool>
Partitioner::basicBlockOptionalMayReturn(const ControlFlowGraph::ConstVertexNodeIterator &start) const {
    ASSERT_require(start != cfg_.vertices().end());

    // Return a cached value if there is one
    if (start->value().type() == V_BASIC_BLOCK) {
        if (BasicBlock::Ptr bblock = start->value().bblock()) {
            bool b;
            if (bblock->mayReturn().getOptional().assignTo(b))
                return b;
        }
    }
    
    // Do the hard work
    std::vector<MayReturnVertexInfo> vertexInfo(cfg_.nVertices());
    return basicBlockOptionalMayReturn(start, vertexInfo);
}