Ejemplo n.º 1
0
bool
sortVerticesByAddress(const ControlFlowGraph::ConstVertexIterator &a,
                      const ControlFlowGraph::ConstVertexIterator &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();
}
Sawyer::Optional<bool>
Partitioner::basicBlockOptionalMayReturn(const ControlFlowGraph::ConstVertexIterator &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);
}