diff options
author | Lionel Landwerlin <[email protected]> | 2017-09-23 21:32:10 +0100 |
---|---|---|
committer | Lionel Landwerlin <[email protected]> | 2017-11-01 13:49:12 +0000 |
commit | eb00b8b18c63f683ba6fd0f43848365dd84e5a96 (patch) | |
tree | 28a9c928fc35e78bf565a1f6cb4624b7a9be1270 /src/intel/common/gen_decoder.h | |
parent | de213b4af818e203680e2cf127bee0b0bf2482d6 (diff) |
intel: decoder: add destructor for gen_spec
This makes use of ralloc to simplify the destruction. We can also
store instructions in hash tables.
Signed-off-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Scott D Phillips <[email protected]>
Diffstat (limited to 'src/intel/common/gen_decoder.h')
-rw-r--r-- | src/intel/common/gen_decoder.h | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/intel/common/gen_decoder.h b/src/intel/common/gen_decoder.h index da12c01addc..12d0c063ee9 100644 --- a/src/intel/common/gen_decoder.h +++ b/src/intel/common/gen_decoder.h @@ -28,6 +28,7 @@ #include <stdbool.h> #include "common/gen_device_info.h" +#include "util/hash_table.h" struct gen_spec; struct gen_group; @@ -42,6 +43,7 @@ struct gen_group *gen_spec_find_struct(struct gen_spec *spec, const char *name); struct gen_spec *gen_spec_load(const struct gen_device_info *devinfo); struct gen_spec *gen_spec_load_from_path(const struct gen_device_info *devinfo, const char *path); +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_register(struct gen_spec *spec, uint32_t offset); @@ -72,14 +74,11 @@ struct gen_field_iterator { struct gen_spec { uint32_t gen; - uint32_t ncommands; - struct gen_group *commands[256]; - uint32_t nstructs; - struct gen_group *structs[256]; - uint32_t nregisters; - struct gen_group *registers[256]; - uint32_t nenums; - struct gen_enum *enums[256]; + struct hash_table *commands; + struct hash_table *structs; + struct hash_table *registers_by_name; + struct hash_table *registers_by_offset; + struct hash_table *enums; }; struct gen_group { |