Fix subtle register corruption bug where aliases weren't taken into account
when assigning input registers to phis, which could cause the same hreg to be assigned to two vregs of different types. Also improve tracing.
This commit is contained in:
parent
436d50b54c
commit
65a20ce2d6
|
@ -492,7 +492,7 @@ static void assign_hregs_to_vregs(void)
|
|||
{
|
||||
tracef('R', "R: import hreg %s for input %%%d from %s\n",
|
||||
hreg->id, vreg->id, prevbb->name);
|
||||
assert(!pmap_findleft(old, hreg));
|
||||
assert(!register_used(old, hreg));
|
||||
pmap_put(old, hreg, vreg);
|
||||
goto nextvreg;
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ static void assign_hregs_to_vregs(void)
|
|||
|
||||
struct hreg* hreg = pmap_findright(
|
||||
phi->prev->regsout, phi->ir->result);
|
||||
if (hreg && !pmap_findleft(old, hreg))
|
||||
if (hreg && !register_used(old, hreg))
|
||||
{
|
||||
tracef('R', "R: import hreg %s for %%%d, imported from %s %%%d\n",
|
||||
hreg->id, vreg->id,
|
||||
|
|
|
@ -38,6 +38,18 @@ static void print_blocks(char k)
|
|||
}
|
||||
}
|
||||
|
||||
static void print_vreg(char k, register_assignment_t* assignments, struct vreg* vreg)
|
||||
{
|
||||
struct hreg* hreg;
|
||||
tracef(k, "%%%d", vreg->id);
|
||||
if (assignments)
|
||||
{
|
||||
hreg = pmap_findright(assignments, vreg);
|
||||
if (hreg)
|
||||
tracef(k, "(%s)", hreg->id);
|
||||
}
|
||||
}
|
||||
|
||||
static void print_hops(char k)
|
||||
{
|
||||
int i;
|
||||
|
@ -73,7 +85,10 @@ static void print_hops(char k)
|
|||
{
|
||||
tracef(k, "%c: INS:", k);
|
||||
for (j=0; j<bb->liveins.count; j++)
|
||||
tracef(k, " %%%d", bb->liveins.item[j]->id);
|
||||
{
|
||||
tracef(k, " ");
|
||||
print_vreg(k, &bb->regsin, bb->liveins.item[j]);
|
||||
}
|
||||
tracef(k, "\n");
|
||||
}
|
||||
|
||||
|
@ -81,7 +96,10 @@ static void print_hops(char k)
|
|||
{
|
||||
tracef(k, "%c: OUTS:", k);
|
||||
for (j=0; j<bb->liveouts.count; j++)
|
||||
tracef(k, " %%%d", bb->liveouts.item[j]->id);
|
||||
{
|
||||
tracef(k, " ");
|
||||
print_vreg(k, bb->regsout, bb->liveouts.item[j]);
|
||||
}
|
||||
tracef(k, "\n");
|
||||
}
|
||||
|
||||
|
@ -93,10 +111,10 @@ static void print_hops(char k)
|
|||
struct vreg* vreg = bb->phis.item[j].left;
|
||||
struct phi* phi = bb->phis.item[j].right;
|
||||
|
||||
tracef(k, " %%%d(via %s)=>%%%d",
|
||||
tracef(k, " %%%d(via %s)=>",
|
||||
phi->ir->result->id,
|
||||
phi->prev->name,
|
||||
vreg->id);
|
||||
phi->prev->name);
|
||||
print_vreg(k, &bb->regsin, vreg);
|
||||
}
|
||||
tracef(k, "\n");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue