Ok, I've move forward in this problem by identifying the loads I want to suggest hard registers for and I've inspired myself with code in combine_regs and finally have tried this:
/* Suggest pseudo register to hard register */ s_qtyno=reg_qty[pseudo]; if (s_qtyno >= 0) { if (qty_phys_copy_sugg[s_qtyno] != 0) { SET_HARD_REG_BIT(qty_phys_copy_sugg[s_qtyno], hard); qty_phys_num_copy_sugg[s_qtyno]++; } else if (qty_phys_sugg[s_qtyno] != 0) { SET_HARD_REG_BIT(qty_phys_sugg[s_qtyno], hard); qty_phys_num_sugg[s_qtyno]++; } } It seems that this works for most cases but there are still cases where this does not work (I of course first test if the register hard is free). This is a little bit simpler than what you find in find_free_reg. Any comments/suggestions at this point? Thanks a lot, Jc On Fri, Apr 17, 2009 at 2:50 PM, fearyourself <fearyours...@gmail.com> wrote: > Hi all, > > My target architecture has an load multiple instruction requiring a > certain number of consecutive registers. I've been working on handling > this case and trying to convince the local register allocator that he > really does want to try to get those consecutive registers for the > loads. But have been running into certain difficulties. > > For example: > > a = tab[0]; > b = tab[1]; > c = tab[2]; > d = tab[3]; > e = tab[4]; > > sum = a + b + c + d + e; > > I would like to get : > > load_multiple tab, r10-r14 > > and then have r10 linked to a, r11 to b, etc. > > Basically, I've worked in the direction of detecting a number of loads > in the block from the same base register or symbol reference. I've got > that detection running and I know in what order I want to associate > the pseudo registers to the hard registers but I can't seem to request > hard registers at that point. I thought I could be playing with the > arrays qty_phys_sugg and qty_phys_copy_sugg but I have trouble > wrapping my mind around what they really represent and how to do that. > > Do you have any ideas about how I can achieve this, am I going in the > wrong direction? > > Thanks a lot, > Jc >