D'oh, need multiple passes over the edge splitter in order to properly find all
cases.
This commit is contained in:
parent
fac12aae32
commit
a4d06d1795
1 changed files with 23 additions and 8 deletions
|
@ -63,29 +63,44 @@ static void split_edge(struct basicblock* source, struct basicblock* sink)
|
||||||
array_append(¤t_proc->blocks, bb);
|
array_append(¤t_proc->blocks, bb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void consider_edges_leading_to(struct basicblock* bb)
|
static bool consider_edges_leading_from(struct basicblock* bb)
|
||||||
{
|
{
|
||||||
if (bb->prevs.count > 1)
|
bool changed = false;
|
||||||
|
|
||||||
|
if (bb->nexts.count > 1)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i<bb->prevs.count; i++)
|
for (i=0; i<bb->nexts.count; i++)
|
||||||
{
|
{
|
||||||
struct basicblock* prev = bb->prevs.item[i];
|
struct basicblock* next = bb->nexts.item[i];
|
||||||
if (prev->nexts.count > 1)
|
if (next->prevs.count > 1)
|
||||||
split_edge(prev, bb);
|
{
|
||||||
|
split_edge(bb, next);
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pass_split_critical_edges(struct procedure* proc)
|
void pass_split_critical_edges(struct procedure* proc)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
bool changed;
|
||||||
|
|
||||||
current_proc = proc;
|
current_proc = proc;
|
||||||
|
|
||||||
for (i=0; i<proc->blocks.count; i++)
|
do
|
||||||
consider_edges_leading_to(proc->blocks.item[i]);
|
{
|
||||||
|
changed = false;
|
||||||
|
|
||||||
|
for (i=0; i<proc->blocks.count; i++)
|
||||||
|
changed |= consider_edges_leading_from(proc->blocks.item[i]);
|
||||||
|
|
||||||
|
}
|
||||||
|
while (changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set sw=4 ts=4 expandtab : */
|
/* vim: set sw=4 ts=4 expandtab : */
|
||||||
|
|
Loading…
Reference in a new issue