Go to the previous, next section.

Example of Mixing SUIF with Builder

     void Tile(tree_for * tf, int tile_size)
     {
        block ind(tf->index());        { the index variable }
        block lb(tf->lb_op());         { operands for bounds }
        block ub(tf->ub_op());
        block body(tf->body(), FALSE); { tree_node_list of the body }
        block blksz(tile_size);
        block drv_ind(block::new_sym(cst_int, "driver_ind"));
        block inner_loop(block::FOR(ind,
                             block::max(lb, blksz*drv_ind),
                             block::min(ub, blksz*drv_ind+blksz-block(1)),
                                    body));
        block outer_loop(block::FOR(drv_ind,
                                    lb/blksz,
                                    (ub+blksz-1)/blksz,
                                    inner_loop);

        tree_for * new_tf = (tree_for *)outer_loop.make_tree_node(tf);
        tf->parent()->insert_after(new_tf, tf->list_e());
        tf->parent()->remove(tf->list_e());
     }

Go to the previous, next section.