示例#1
0
void cpp_from_isl::process_block(isl_ast_node *node)
{
    // The generate AST is weird:
    // Blocks have at most 2 statements.
    // If there are more consecutive statements,
    // all but the last are grouped into a nested block,
    // and so on recursively.

    //auto block = make_shared<block_statement>();

    //m_ctx->push(&block->statements);

    auto list = isl_ast_node_block_get_children(node);
    int n_children = isl_ast_node_list_n_ast_node(list);

    for(int i = 0; i < n_children; ++i)
    {
        auto child = isl_ast_node_list_get_ast_node(list, i);
        process_node(child);
        isl_ast_node_free(child);
    }

    isl_ast_node_list_free(list);

    //m_ctx->pop();

    //m_ctx->add(block);
}
示例#2
0
instruction_list * isl_block_to_noclock (isl_ast_node * block_node)
{
    isl_ast_node_list * children = isl_ast_node_block_get_children (block_node);
    int n = isl_ast_node_list_n_ast_node (children);

    instruction_list * list = NULL;

    for (int i = 0; i < n; ++i)
    {
        isl_ast_node * current = isl_ast_node_list_get_ast_node (children, i);
        instruction_list * instr = isl_ast_to_noclock_ast (current);
        list = instruction_list_cat (list, instr);
    }

    return list;
}