Lines Matching defs:cursor

1023 /* Reduces a cursor by trying to convert everything to after and trying to
1027 reduce_cursor(nir_cursor cursor)
1029 switch (cursor.option) {
1031 if (exec_list_is_empty(&cursor.block->instr_list)) {
1033 cursor.option = nir_cursor_after_block;
1035 return cursor;
1038 return cursor;
1041 nir_instr *prev_instr = nir_instr_prev(cursor.instr);
1044 cursor.instr = prev_instr;
1045 cursor.option = nir_cursor_after_instr;
1048 cursor.block = cursor.instr->block;
1049 cursor.option = nir_cursor_before_block;
1051 return reduce_cursor(cursor);
1055 if (nir_instr_next(cursor.instr) == NULL) {
1057 cursor.option = nir_cursor_after_block;
1058 cursor.block = cursor.instr->block;
1060 return cursor;
1063 unreachable("Inavlid cursor option");
1128 nir_instr_insert(nir_cursor cursor, nir_instr *instr)
1130 switch (cursor.option) {
1134 assert(exec_list_is_empty(&cursor.block->instr_list));
1136 instr->block = cursor.block;
1138 exec_list_push_head(&cursor.block->instr_list, &instr->node);
1142 nir_instr *last = nir_block_last_instr(cursor.block);
1146 instr->block = cursor.block;
1148 exec_list_push_tail(&cursor.block->instr_list, &instr->node);
1153 instr->block = cursor.instr->block;
1155 exec_node_insert_node_before(&cursor.instr->node, &instr->node);
1159 assert(cursor.instr->type != nir_instr_type_jump);
1163 assert(cursor.instr == nir_block_last_instr(cursor.instr->block));
1165 instr->block = cursor.instr->block;
1167 exec_node_insert_after(&cursor.instr->node, &instr->node);
1179 nir_instr_move(nir_cursor cursor, nir_instr *instr)
1181 /* If the cursor happens to refer to this instruction (either before or
1184 if ((cursor.option == nir_cursor_before_instr ||
1185 cursor.option == nir_cursor_after_instr) &&
1186 cursor.instr == instr)
1190 nir_instr_insert(cursor, instr);
1359 /* If we're removing the instr where our cursor is, then we have to
1360 * point the cursor elsewhere.
2217 cursor_next_instr(nir_cursor cursor)
2219 switch (cursor.option) {
2221 for (nir_block *block = cursor.block; block;
2230 cursor.block = nir_block_cf_tree_next(cursor.block);
2231 if (cursor.block == NULL)
2234 cursor.option = nir_cursor_before_block;
2235 return cursor_next_instr(cursor);
2238 return cursor.instr;
2241 if (nir_instr_next(cursor.instr))
2242 return nir_instr_next(cursor.instr);
2244 cursor.option = nir_cursor_after_block;
2245 cursor.block = cursor.instr->block;
2246 return cursor_next_instr(cursor);
2249 unreachable("Inavlid cursor option");
2302 b.cursor = nir_after_instr(instr);