diff options
author | Francisco Jerez <[email protected]> | 2016-04-28 00:19:14 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2016-05-03 22:32:40 -0700 |
commit | 1530e27534831a8d1c82e0a82fe15cd9c70e61e6 (patch) | |
tree | 0cc9e88a5cf3e806452b58a27aaa682bcfcebc4a /src/mesa/drivers/dri/i965/brw_eu.c | |
parent | 1cc7573162a7f0e8346d7abab50890c58a0dce9a (diff) |
i965/disasm: Wrap opcode_desc look-up in a function.
The function takes a device info struct as argument in addition to the
opcode number in order to disambiguate between multiple opcode_desc
entries for different instructions with the same opcode number.
Reviewed-by: Iago Toral Quiroga <[email protected]> [v1]
[v2] mattst88: Put brw_opcode_desc() in brw_eu.c instead of moving it
there in a later patch.
Reviewed-by: Kenneth Graunke <[email protected]> [v2]
[v3] mattst88: Return NULL if opcode >= ARRAY_SIZE(opcode_descs)
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_eu.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_eu.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_eu.c b/src/mesa/drivers/dri/i965/brw_eu.c index 6961a88c6a8..279e9571e1a 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.c +++ b/src/mesa/drivers/dri/i965/brw_eu.c @@ -339,3 +339,19 @@ brw_disassemble(const struct brw_device_info *devinfo, brw_disassemble_inst(out, devinfo, insn, compacted); } } + +/* Return the matching opcode_desc for the specified opcode number and + * hardware generation, or NULL if the opcode is not supported by the device. + * XXX -- Actually check whether the opcode is supported. + */ +const struct opcode_desc * +brw_opcode_desc(const struct brw_device_info *devinfo, enum opcode opcode) +{ + if (opcode >= ARRAY_SIZE(opcode_descs)) + return NULL; + + if (opcode_descs[opcode].name) + return &opcode_descs[opcode]; + else + return NULL; +} |