diff options
author | Rob Clark <[email protected]> | 2019-10-22 16:05:41 -0700 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-02-01 02:40:22 +0000 |
commit | 9a9f78f1f9f0019687eb374aae5abcd3b0617cf4 (patch) | |
tree | 6d7e6798b53c4545854a2d25899cc8fdc036ca53 /src/freedreno/ir3 | |
parent | a5f24f966ae217981cd39e867a0de1fee029e740 (diff) |
freedreno/ir3/ra: make use()/def() functions instead of macros
Originally these were nested functions, which worked nicely, giving us
the function of a local macro that was actual 'c' syntax (ie. not token
pasted macro). But these were converted to macros because clang doesn't
let us have nice gcc extensions.
Extract these back out into functions, before adding more things and
making the macros even more cumbersome.
Signed-off-by: Rob Clark <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3569>
Diffstat (limited to 'src/freedreno/ir3')
-rw-r--r-- | src/freedreno/ir3/ir3_ra.c | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/src/freedreno/ir3/ir3_ra.c b/src/freedreno/ir3/ir3_ra.c index 7ea21076784..823968a5cec 100644 --- a/src/freedreno/ir3/ir3_ra.c +++ b/src/freedreno/ir3/ir3_ra.c @@ -670,26 +670,35 @@ ra_destroy(struct ir3_ra_ctx *ctx) } static void +__def(struct ir3_ra_ctx *ctx, struct ir3_ra_block_data *bd, unsigned name, + struct ir3_instruction *instr) +{ + debug_assert(name < ctx->alloc_count); + /* defined on first write: */ + if (!ctx->def[name]) + ctx->def[name] = instr->ip; + ctx->use[name] = instr->ip; + BITSET_SET(bd->def, name); +} + +static void +__use(struct ir3_ra_ctx *ctx, struct ir3_ra_block_data *bd, unsigned name, + struct ir3_instruction *instr) +{ + debug_assert(name < ctx->alloc_count); + ctx->use[name] = MAX2(ctx->use[name], instr->ip); + if (!BITSET_TEST(bd->def, name)) + BITSET_SET(bd->use, name); +} + +static void ra_block_compute_live_ranges(struct ir3_ra_ctx *ctx, struct ir3_block *block) { struct ir3_ra_block_data *bd; unsigned bitset_words = BITSET_WORDS(ctx->alloc_count); -#define def(name, instr) \ - do { \ - /* defined on first write: */ \ - if (!ctx->def[name]) \ - ctx->def[name] = instr->ip; \ - ctx->use[name] = instr->ip; \ - BITSET_SET(bd->def, name); \ - } while(0); - -#define use(name, instr) \ - do { \ - ctx->use[name] = MAX2(ctx->use[name], instr->ip); \ - if (!BITSET_TEST(bd->def, name)) \ - BITSET_SET(bd->use, name); \ - } while(0); +#define def(name, instr) __def(ctx, bd, name, instr) +#define use(name, instr) __use(ctx, bd, name, instr) bd = rzalloc(ctx->g, struct ir3_ra_block_data); |