load_tex->src[0].pipeline = load->dest.pipeline = ppir_pipeline_reg_discard;
/* Always create move node since there can be successors in other blocks */
- ppir_node *move = ppir_node_insert_mov_all_blocks(node);
+ ppir_node *move = ppir_node_insert_mov(node);
if (unlikely(!move))
return false;
ppir_dep_type type)
{
/* don't add dep for two nodes from different block */
- if (succ->block != pred->block)
+ if (succ->block != pred->block) {
+ pred->succ_different_block = true;
return;
+ }
/* don't add duplicated dep */
ppir_node_foreach_pred(succ, dep) {
printf("====================\n");
}
-ppir_node *ppir_node_insert_mov(ppir_node *node)
+static ppir_node *ppir_node_insert_mov_local(ppir_node *node)
{
ppir_node *move = ppir_node_create(node->block, ppir_op_mov, -1, 0);
if (unlikely(!move))
return move;
}
-ppir_node *ppir_node_insert_mov_all_blocks(ppir_node *old)
+ppir_node *ppir_node_insert_mov(ppir_node *old)
{
- ppir_node *move = ppir_node_insert_mov(old);
+ ppir_node *move = ppir_node_insert_mov_local(old);
ppir_compiler *comp = old->block->comp;
list_for_each_entry(ppir_block, block, &comp->block_list, list) {
return move;
}
+
bool ppir_node_has_single_src_succ(ppir_node *node)
{
- if (list_is_singular(&node->succ_list) &&
+ if (ppir_node_has_single_succ(node) &&
list_first_entry(&node->succ_list,
ppir_dep, succ_link)->type == ppir_dep_src)
return true;
int instr_pos;
struct ppir_block *block;
bool is_end;
+ bool succ_different_block;
/* for scheduler */
struct list_head succ_list;
ppir_dep *ppir_dep_for_pred(ppir_node *node, ppir_node *pred);
/* Assumes that node successors are in the same block */
ppir_node *ppir_node_insert_mov(ppir_node *node);
-ppir_node *ppir_node_insert_mov_all_blocks(ppir_node *node);
static inline bool ppir_node_is_root(ppir_node *node)
{
static inline bool ppir_node_has_single_succ(ppir_node *node)
{
- return list_is_singular(&node->succ_list);
+ return list_is_singular(&node->succ_list)
+ && !node->succ_different_block;
}
bool ppir_node_has_single_src_succ(ppir_node *node);