src/lima/pp_lir/regalloc.c
//After register allocation, rewrites the program according to the calculated
//colorings & coalescings
After register allocation, rewrites the program according to the calculated
colorings & coalescings
After register allocation rewrites the program according to the calculated colorings & coalescings
static void rewrite_regs(lima_pp_lir_prog_t* prog)
{
	unsigned i, j;
	for (i = 0; i < prog->num_regs; i++)
	{
		lima_pp_lir_reg_t* reg = prog->regs[i];
		if (reg->precolored)
			continue;
		unsigned swizzle[4] = {0, 0, 0, 0};
		lima_pp_lir_reg_t* alias = get_alias(reg, swizzle);
		lima_pp_lir_reg_t* allocated_reg;
		unsigned start_pos;
		if (alias->precolored)
		{
			start_pos = 0;
			allocated_reg = alias;
		}
		else
		{
			start_pos = alias->allocated_offset;
			allocated_reg = prog->regs[alias->allocated_index];
		}
		for (j = 0; j < reg->size; j++)
			swizzle[j] = swizzle[j] + start_pos;
		replace_reg(reg, allocated_reg, swizzle);
	}
}
static void rewrite_regs ( lima_pp_lir_prog_t * prog ) { unsigned i , j ; for ( i = 0 ; i < prog -> num_regs ; i ++ ) { lima_pp_lir_reg_t * reg = prog -> regs [ i ] ; if ( reg -> precolored ) continue ; unsigned swizzle [ 4 ] = { 0 , 0 , 0 , 0 } ; lima_pp_lir_reg_t * alias = get_alias ( reg , swizzle ) ; lima_pp_lir_reg_t * allocated_reg ; unsigned start_pos ; if ( alias -> precolored ) { start_pos = 0 ; allocated_reg = alias ; } else { start_pos = alias -> allocated_offset ; allocated_reg = prog -> regs [ alias -> allocated_index ] ; } for ( j = 0 ; j < reg -> size ; j ++ ) swizzle [ j ] = swizzle [ j ] + start_pos ; replace_reg ( reg , allocated_reg , swizzle ) ; } }
After register allocation, rewrites the program according to the calculated
colorings & coalescings
After register allocation rewrites the program according to the calculated colorings & coalescings