src/lima/pp_lir/regalloc.c
//Replaces a given register with a given subset of another register,
//with a possible swizzle
//Used for register allocation and copy propagation
//Each channel x of src will be replaced with channel swizzle[x] of dst
Replaces a given register with a given subset of another register,
with a possible swizzle
Used for register allocation and copy propagation
Each channel x of src will be replaced with channel swizzle[x] of dst
Replaces a given register with a given subset of another register with a possible swizzle Used for register allocation and copy propagation Each channel x of src will be replaced with channel swizzle [ x ] of dst
static void replace_reg(lima_pp_lir_reg_t* src, lima_pp_lir_reg_t* dst,
						unsigned* swizzle)
{
	ptrset_iter_t iter = ptrset_iter_create(src->defs);
	lima_pp_lir_instr_t* def;
	ptrset_iter_for_each(iter, def)
	{
		replace_reg_dest(def, src, dst, swizzle);
	}
	ptrset_union(&dst->defs, src->defs);
	ptrset_empty(&src->defs);
	iter = ptrset_iter_create(src->uses);
	lima_pp_lir_instr_t* use;
	ptrset_iter_for_each(iter, use)
	{
		unsigned i;
		for (i = 0; i < lima_pp_hir_op[use->op].args; i++)
			replace_reg_src(use, i, src, dst, swizzle);
	}
	ptrset_union(&dst->uses, src->uses);
	ptrset_empty(&src->uses);
}
static void replace_reg ( lima_pp_lir_reg_t * src , lima_pp_lir_reg_t * dst , unsigned * swizzle ) { ptrset_iter_t iter = ptrset_iter_create ( src -> defs ) ; lima_pp_lir_instr_t * def ; ptrset_iter_for_each ( iter , def ) { replace_reg_dest ( def , src , dst , swizzle ) ; } ptrset_union ( & dst -> defs , src -> defs ) ; ptrset_empty ( & src -> defs ) ; iter = ptrset_iter_create ( src -> uses ) ; lima_pp_lir_instr_t * use ; ptrset_iter_for_each ( iter , use ) { unsigned i ; for ( i = 0 ; i < lima_pp_hir_op [ use -> op ] . args ; i ++ ) replace_reg_src ( use , i , src , dst , swizzle ) ; } ptrset_union ( & dst -> uses , src -> uses ) ; ptrset_empty ( & src -> uses ) ; }
Replaces a given register with a given subset of another register,
with a possible swizzle
Used for register allocation and copy propagation
Each channel x of src will be replaced with channel swizzle[x] of dst
Replaces a given register with a given subset of another register with a possible swizzle Used for register allocation and copy propagation Each channel x of src will be replaced with channel swizzle [ x ] of dst