diff options
author | Jason Ekstrand <jason.ekstrand@intel.com> | 2015-07-30 20:49:22 -0700 |
---|---|---|
committer | Jason Ekstrand <jason.ekstrand@intel.com> | 2015-08-10 11:58:45 -0700 |
commit | 7539ac7fe2077f7634250dcb34497e1ac643b0df (patch) | |
tree | 13176a86bb84d7e4eab07a21e948cdf7f38a363f /src/util | |
parent | c1d9b3ae0bb0f1222719d7737dd9986e437bf5b9 (diff) |
ra: Refactor ra_set_finalize
All this commit does is change an early return to an if with an else
clause.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/register_allocate.c | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/src/util/register_allocate.c b/src/util/register_allocate.c index 95be20fcc1..129d58d229 100644 --- a/src/util/register_allocate.c +++ b/src/util/register_allocate.c @@ -321,32 +321,31 @@ ra_set_finalize(struct ra_regs *regs, unsigned int **q_values) regs->classes[b]->q[c] = q_values[b][c]; } } - return; - } - - /* Compute, for each class B and C, how many regs of B an - * allocation to C could conflict with. - */ - for (b = 0; b < regs->class_count; b++) { - for (c = 0; c < regs->class_count; c++) { - unsigned int rc; - int max_conflicts = 0; - - for (rc = 0; rc < regs->count; rc++) { - int conflicts = 0; - unsigned int i; - - if (!reg_belongs_to_class(rc, regs->classes[c])) - continue; - - for (i = 0; i < regs->regs[rc].num_conflicts; i++) { - unsigned int rb = regs->regs[rc].conflict_list[i]; - if (reg_belongs_to_class(rb, regs->classes[b])) - conflicts++; - } - max_conflicts = MAX2(max_conflicts, conflicts); - } - regs->classes[b]->q[c] = max_conflicts; + } else { + /* Compute, for each class B and C, how many regs of B an + * allocation to C could conflict with. + */ + for (b = 0; b < regs->class_count; b++) { + for (c = 0; c < regs->class_count; c++) { + unsigned int rc; + int max_conflicts = 0; + + for (rc = 0; rc < regs->count; rc++) { + int conflicts = 0; + unsigned int i; + + if (!reg_belongs_to_class(rc, regs->classes[c])) + continue; + + for (i = 0; i < regs->regs[rc].num_conflicts; i++) { + unsigned int rb = regs->regs[rc].conflict_list[i]; + if (reg_belongs_to_class(rb, regs->classes[b])) + conflicts++; + } + max_conflicts = MAX2(max_conflicts, conflicts); + } + regs->classes[b]->q[c] = max_conflicts; + } } } } |