diff options
author | Francisco Jerez <currojerez@riseup.net> | 2016-09-07 16:59:35 -0700 |
---|---|---|
committer | Francisco Jerez <currojerez@riseup.net> | 2016-09-14 14:50:53 -0700 |
commit | c458eeb94620fbce0a37474fc292545002d67f76 (patch) | |
tree | 06b73fa9a2c749190885aab742d0e3011dc050c2 /src/mesa/drivers/dri/i965/brw_ir_fs.h | |
parent | be095e11e41158f91bcb3f6fcbc2e2a91a5d9124 (diff) | |
download | external_mesa3d-c458eeb94620fbce0a37474fc292545002d67f76.zip external_mesa3d-c458eeb94620fbce0a37474fc292545002d67f76.tar.gz external_mesa3d-c458eeb94620fbce0a37474fc292545002d67f76.tar.bz2 |
i965/fs: Add wrapper functions for fs_inst::regs_read and ::regs_written.
This is in preparation for dropping fs_inst::regs_read and
::regs_written in favor of more accurate alternatives expressed in
byte units. The main reason these wrappers are useful is that a
number of optimization passes implement dataflow analysis with
register granularity, so these helpers will come in handy once we've
switched register offsets and sizes to the byte representation. The
wrapper functions will also make sure that GRF misalignment (currently
neglected by most of the back-end) is taken into account correctly in
the calculation of regs_read and regs_written.
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_ir_fs.h')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_ir_fs.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h index 19ef242..de08a69 100644 --- a/src/mesa/drivers/dri/i965/brw_ir_fs.h +++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h @@ -411,4 +411,30 @@ set_saturate(bool saturate, fs_inst *inst) return inst; } +/** + * Return the number of dataflow registers written by the instruction (either + * fully or partially) counted from 'floor(reg_offset(inst->dst) / + * register_size)'. The somewhat arbitrary register size unit is 4B for the + * UNIFORM and IMM files and 32B for all other files. + */ +inline unsigned +regs_written(const fs_inst *inst) +{ + /* XXX - Take into account register-misaligned offsets correctly. */ + return inst->regs_written; +} + +/** + * Return the number of dataflow registers read by the instruction (either + * fully or partially) counted from 'floor(reg_offset(inst->src[i]) / + * register_size)'. The somewhat arbitrary register size unit is 4B for the + * UNIFORM and IMM files and 32B for all other files. + */ +inline unsigned +regs_read(const fs_inst *inst, unsigned i) +{ + /* XXX - Take into account register-misaligned offsets correctly. */ + return inst->regs_read(i); +} + #endif |