diff options
author | Jason Ekstrand <jason.ekstrand@intel.com> | 2015-08-15 09:43:05 -0700 |
---|---|---|
committer | Jason Ekstrand <jason.ekstrand@intel.com> | 2015-08-18 17:48:45 -0700 |
commit | 9b49284c223b284295675775d4344f066b4455db (patch) | |
tree | f9b7e8da578da579ff49c6ffb03db558962c9f7b /src/util | |
parent | 7c8e53f1bee370c1a8a0c640313c12df220f4114 (diff) | |
download | external_mesa3d-9b49284c223b284295675775d4344f066b4455db.zip external_mesa3d-9b49284c223b284295675775d4344f066b4455db.tar.gz external_mesa3d-9b49284c223b284295675775d4344f066b4455db.tar.bz2 |
util/ra: Add a function for making all conflicts on a register transitive
Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/register_allocate.c | 23 | ||||
-rw-r--r-- | src/util/register_allocate.h | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/util/register_allocate.c b/src/util/register_allocate.c index 436e008..c9867e3 100644 --- a/src/util/register_allocate.c +++ b/src/util/register_allocate.c @@ -266,6 +266,29 @@ ra_add_transitive_reg_conflict(struct ra_regs *regs, } } +/** + * Makes every conflict on the given register transitive. In other words, + * every register that conflicts with r will now conflict with every other + * register conflicting with r. + * + * This can simplify code for setting up multiple register classes + * which are aggregates of some base hardware registers, compared to + * explicitly using ra_add_reg_conflict. + */ +void +ra_make_reg_conflicts_transitive(struct ra_regs *regs, unsigned int r) +{ + struct ra_reg *reg = ®s->regs[r]; + BITSET_WORD tmp; + int c; + + BITSET_FOREACH_SET(c, tmp, reg->conflicts, regs->count) { + struct ra_reg *other = ®s->regs[c]; + for (unsigned i = 0; i < BITSET_WORDS(regs->count); i++) + other->conflicts[i] |= reg->conflicts[i]; + } +} + unsigned int ra_alloc_reg_class(struct ra_regs *regs) { diff --git a/src/util/register_allocate.h b/src/util/register_allocate.h index 61f182e..ed3854c 100644 --- a/src/util/register_allocate.h +++ b/src/util/register_allocate.h @@ -51,6 +51,7 @@ void ra_add_reg_conflict(struct ra_regs *regs, unsigned int r1, unsigned int r2); void ra_add_transitive_reg_conflict(struct ra_regs *regs, unsigned int base_reg, unsigned int reg); +void ra_make_reg_conflicts_transitive(struct ra_regs *regs, unsigned int reg); void ra_class_add_reg(struct ra_regs *regs, unsigned int c, unsigned int reg); void ra_set_num_conflicts(struct ra_regs *regs, unsigned int class_a, unsigned int class_b, unsigned int num_conflicts); |