diff options
author | Kenneth Graunke <[email protected]> | 2017-03-19 21:22:20 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2017-03-20 11:20:51 -0700 |
commit | b2c0c1d9a5c6b1dd55d4e06f504e1ce9fe823c32 (patch) | |
tree | 2f32275c7dad0f46fffdb93f91dab569b1cad170 /src/intel/tools/aubinator.c | |
parent | a1aa78cb45cee5ba6fa9ecf1266760cdbb51f5f3 (diff) |
aubinator: Make the iterator store a pointer to structure descriptions.
When the iterator encounters a structure field, it now looks up the
gen_group for that structure definition and saves a pointer to it.
This lets us drop a lot of ridiculous code in the caller, which looked
at item->value (<struct NAME dword>), strtok'd the structure name back
out, and looked it up itself.
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/tools/aubinator.c')
-rw-r--r-- | src/intel/tools/aubinator.c | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c index fc2efd3e46e..0c941322d68 100644 --- a/src/intel/tools/aubinator.c +++ b/src/intel/tools/aubinator.c @@ -102,30 +102,11 @@ print_dword_header(struct gen_field_iterator *iter, uint64_t offset) offset + 4 * iter->dword, iter->p[iter->dword], iter->dword); } -static char * -print_iterator_values(struct gen_field_iterator *iter) -{ - char *token = NULL; - if (strstr(iter->value, "struct") == NULL) { - fprintf(outfile, " %s: %s\n", iter->name, iter->value); - } else { - token = strtok(iter->value, " "); - if (token != NULL) { - token = strtok(NULL, " "); - } else { - token = NULL; - } - fprintf(outfile, " %s:<struct %s>\n", iter->name, token); - } - return token; -} - static void decode_group(struct gen_spec *spec, struct gen_group *strct, const uint32_t *p, int starting_dword) { struct gen_field_iterator iter; - char *token = NULL; int last_dword = 0; uint64_t offset = 0; @@ -141,13 +122,12 @@ decode_group(struct gen_spec *spec, struct gen_group *strct, print_dword_header(&iter, offset); last_dword = iter.dword; } - if (iter.dword >= starting_dword) - token = print_iterator_values(&iter); - if (token != NULL) { - print_dword_header(&iter, offset); - struct gen_group *struct_val = gen_spec_find_struct(spec, token); - decode_group(spec, struct_val, &p[iter.dword], 0); - token = NULL; + if (iter.dword >= starting_dword) { + fprintf(outfile, " %s: %s\n", iter.name, iter.value); + if (iter.struct_desc) { + print_dword_header(&iter, offset + 4 * iter.dword); + decode_group(spec, iter.struct_desc, &p[iter.dword], 0); + } } } } |