[Mesa-dev] [PATCH v2 03/11] intel: decoder: enable search for instruction by name

Lionel Landwerlin lionel.g.landwerlin at intel.com
Wed Nov 1 18:12:10 UTC 2017


Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
---
 src/intel/common/gen_decoder.c | 8 ++++++++
 src/intel/common/gen_decoder.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
index d09b6ea32b6..736bfd6df16 100644
--- a/src/intel/common/gen_decoder.c
+++ b/src/intel/common/gen_decoder.c
@@ -73,6 +73,14 @@ gen_group_get_opcode(struct gen_group *group)
    return group->opcode;
 }
 
+struct gen_group *
+gen_spec_find_instruction_by_name(struct gen_spec *spec, const char *name)
+{
+   struct hash_entry *entry = _mesa_hash_table_search(spec->commands,
+                                                      name);
+   return entry ? entry->data : NULL;
+}
+
 struct gen_group *
 gen_spec_find_struct(struct gen_spec *spec, const char *name)
 {
diff --git a/src/intel/common/gen_decoder.h b/src/intel/common/gen_decoder.h
index 28bf94b099e..343d68b0eda 100644
--- a/src/intel/common/gen_decoder.h
+++ b/src/intel/common/gen_decoder.h
@@ -51,6 +51,7 @@ struct gen_spec *gen_spec_load_from_path(const struct gen_device_info *devinfo,
 void gen_spec_destroy(struct gen_spec *spec);
 uint32_t gen_spec_get_gen(struct gen_spec *spec);
 struct gen_group *gen_spec_find_instruction(struct gen_spec *spec, const uint32_t *p);
+struct gen_group *gen_spec_find_instruction_by_name(struct gen_spec *spec, const char *name);
 struct gen_group *gen_spec_find_register(struct gen_spec *spec, uint32_t offset);
 struct gen_group *gen_spec_find_register_by_name(struct gen_spec *spec, const char *name);
 struct gen_enum *gen_spec_find_enum(struct gen_spec *spec, const char *name);
-- 
2.15.0



More information about the mesa-dev mailing list