Exemplo n.º 1
0
void DefinednessBBAnalyzer::processBB(Map &starting, CFGBlock *block) const {
    DefinednessVisitor visitor(starting);
    for (int i = 0; i < block->body.size(); i++) {
        block->body[i]->accept(&visitor);
    }
    if (block == cfg->getStartingBlock() && arguments) {
        arguments->accept(&visitor);
    }

    if (VERBOSITY("analysis") >= 2) {
        printf("At end of block %d:\n", block->idx);
        for (const auto &p : starting) {
            printf("%s: %d\n", p.first.c_str(), p.second);
        }
    }
}
Exemplo n.º 2
0
void DefinednessBBAnalyzer::processBB(Map& starting, CFGBlock* block) const {
    DefinednessVisitor visitor(starting);

    if (block == cfg->getStartingBlock() && arg_names.args) {
        for (auto e : (*arg_names.args))
            visitor._doSet(e);
        if (arg_names.vararg->size())
            visitor._doSet(*arg_names.vararg);
        if (arg_names.kwarg->size())
            visitor._doSet(*arg_names.kwarg);
    }

    for (int i = 0; i < block->body.size(); i++) {
        block->body[i]->accept(&visitor);
    }

    if (VERBOSITY("analysis") >= 2) {
        printf("At end of block %d:\n", block->idx);
        for (const auto& p : starting) {
            printf("%s: %d\n", p.first.c_str(), p.second);
        }
    }
}