Lines Matching refs:tree
336 bitsize_tree *tree = rzalloc(mem_ctx, bitsize_tree); in build_bitsize_tree() local
342 tree->num_srcs = info.num_inputs; in build_bitsize_tree()
343 tree->common_size = 0; in build_bitsize_tree()
345 tree->is_src_sized[i] = !!nir_alu_type_get_type_size(info.input_types[i]); in build_bitsize_tree()
346 if (tree->is_src_sized[i]) in build_bitsize_tree()
347 tree->src_size[i] = nir_alu_type_get_type_size(info.input_types[i]); in build_bitsize_tree()
348 tree->srcs[i] = build_bitsize_tree(mem_ctx, state, expr->srcs[i]); in build_bitsize_tree()
350 tree->is_dest_sized = !!nir_alu_type_get_type_size(info.output_type); in build_bitsize_tree()
351 if (tree->is_dest_sized) in build_bitsize_tree()
352 tree->dest_size = nir_alu_type_get_type_size(info.output_type); in build_bitsize_tree()
358 tree->num_srcs = 0; in build_bitsize_tree()
359 tree->is_dest_sized = true; in build_bitsize_tree()
360 tree->dest_size = nir_src_bit_size(state->variables[var->variable].src); in build_bitsize_tree()
365 tree->num_srcs = 0; in build_bitsize_tree()
366 tree->is_dest_sized = false; in build_bitsize_tree()
367 tree->common_size = 0; in build_bitsize_tree()
373 assert(!tree->is_dest_sized || tree->dest_size == value->bit_size); in build_bitsize_tree()
374 tree->common_size = value->bit_size; in build_bitsize_tree()
377 return tree; in build_bitsize_tree()
381 bitsize_tree_filter_up(bitsize_tree *tree) in bitsize_tree_filter_up() argument
383 for (unsigned i = 0; i < tree->num_srcs; i++) { in bitsize_tree_filter_up()
384 unsigned src_size = bitsize_tree_filter_up(tree->srcs[i]); in bitsize_tree_filter_up()
388 if (tree->is_src_sized[i]) { in bitsize_tree_filter_up()
389 assert(src_size == tree->src_size[i]); in bitsize_tree_filter_up()
390 } else if (tree->common_size != 0) { in bitsize_tree_filter_up()
391 assert(src_size == tree->common_size); in bitsize_tree_filter_up()
392 tree->src_size[i] = src_size; in bitsize_tree_filter_up()
394 tree->common_size = src_size; in bitsize_tree_filter_up()
395 tree->src_size[i] = src_size; in bitsize_tree_filter_up()
399 if (tree->num_srcs && tree->common_size) { in bitsize_tree_filter_up()
400 if (tree->dest_size == 0) in bitsize_tree_filter_up()
401 tree->dest_size = tree->common_size; in bitsize_tree_filter_up()
402 else if (!tree->is_dest_sized) in bitsize_tree_filter_up()
403 assert(tree->dest_size == tree->common_size); in bitsize_tree_filter_up()
405 for (unsigned i = 0; i < tree->num_srcs; i++) { in bitsize_tree_filter_up()
406 if (!tree->src_size[i]) in bitsize_tree_filter_up()
407 tree->src_size[i] = tree->common_size; in bitsize_tree_filter_up()
411 return tree->dest_size; in bitsize_tree_filter_up()
415 bitsize_tree_filter_down(bitsize_tree *tree, unsigned size) in bitsize_tree_filter_down() argument
417 if (tree->dest_size) in bitsize_tree_filter_down()
418 assert(tree->dest_size == size); in bitsize_tree_filter_down()
420 tree->dest_size = size; in bitsize_tree_filter_down()
422 if (!tree->is_dest_sized) { in bitsize_tree_filter_down()
423 if (tree->common_size) in bitsize_tree_filter_down()
424 assert(tree->common_size == size); in bitsize_tree_filter_down()
426 tree->common_size = size; in bitsize_tree_filter_down()
429 for (unsigned i = 0; i < tree->num_srcs; i++) { in bitsize_tree_filter_down()
430 if (!tree->src_size[i]) { in bitsize_tree_filter_down()
431 assert(tree->common_size); in bitsize_tree_filter_down()
432 tree->src_size[i] = tree->common_size; in bitsize_tree_filter_down()
434 bitsize_tree_filter_down(tree->srcs[i], tree->src_size[i]); in bitsize_tree_filter_down()
591 bitsize_tree *tree = build_bitsize_tree(bitsize_ctx, &state, replace); in nir_replace_instr() local
592 bitsize_tree_filter_up(tree); in nir_replace_instr()
593 bitsize_tree_filter_down(tree, instr->dest.dest.ssa.bit_size); in nir_replace_instr()
606 instr->dest.dest.ssa.num_components, tree, in nir_replace_instr()