diff options
author | Matt Turner <[email protected]> | 2015-10-07 21:04:48 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2015-11-12 11:00:10 -0800 |
commit | a280e83d71bb046098ed5380cb053318f9e8cf8e (patch) | |
tree | 22c15d473c0272e6d94a9e20044b7009e4b59db7 /src/mesa/drivers | |
parent | 93e371c140cb1aa438ce3c1a9946811d92032897 (diff) |
i965: Combine assembly annotations if possible.
Often annotations are identical between sets of consecutive
instructions. We can perhaps avoid some memory allocations by reusing
the previous annotation.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_asm_annotation.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_asm_annotation.c b/src/mesa/drivers/dri/i965/intel_asm_annotation.c index f87a9bbe967..fe9d80a5e67 100644 --- a/src/mesa/drivers/dri/i965/intel_asm_annotation.c +++ b/src/mesa/drivers/dri/i965/intel_asm_annotation.c @@ -112,6 +112,24 @@ void annotate(const struct brw_device_info *devinfo, ann->block_start = cfg->blocks[annotation->cur_block]; } + if (bblock_end(cfg->blocks[annotation->cur_block]) == inst) { + ann->block_end = cfg->blocks[annotation->cur_block]; + annotation->cur_block++; + } + + /* Merge this annotation with the previous if possible. */ + struct annotation *prev = annotation->ann_count > 1 ? + &annotation->ann[annotation->ann_count - 2] : NULL; + if (prev != NULL && + ann->ir == prev->ir && + ann->annotation == prev->annotation && + ann->block_start == NULL && + prev->block_end == NULL) { + if (ann->block_end == NULL) + annotation->ann_count--; + return; + } + /* There is no hardware DO instruction on Gen6+, so since DO always * starts a basic block, we need to set the .block_start of the next * instruction's annotation with a pointer to the bblock started by @@ -123,11 +141,6 @@ void annotate(const struct brw_device_info *devinfo, if (devinfo->gen >= 6 && inst->opcode == BRW_OPCODE_DO) { annotation->ann_count--; } - - if (bblock_end(cfg->blocks[annotation->cur_block]) == inst) { - ann->block_end = cfg->blocks[annotation->cur_block]; - annotation->cur_block++; - } } void |