summaryrefslogtreecommitdiffstats
path: root/src/intel/common
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-12-12 16:51:54 -0800
committerJason Ekstrand <[email protected]>2017-12-14 13:27:01 -0800
commitf2646406939557ee1f75d6ee044447e40f92b565 (patch)
tree78d2e59dc293810c1e48de90a285332d42443f88 /src/intel/common
parentada705b67138a35f71525b66c225d136b2a2bc01 (diff)
intel/decoder: Convert the iterator to work entirely in bits
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/common')
-rw-r--r--src/intel/common/gen_decoder.c17
-rw-r--r--src/intel/common/gen_decoder.h4
2 files changed, 9 insertions, 12 deletions
diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
index 9f4f5039394..de4c506ac7b 100644
--- a/src/intel/common/gen_decoder.c
+++ b/src/intel/common/gen_decoder.c
@@ -840,9 +840,7 @@ iter_advance_field(struct gen_field_iterator *iter)
int group_member_offset = iter_group_offset_bits(iter, iter->group_iter);
- iter->start = group_member_offset + iter->field->start;
- iter->end = group_member_offset + iter->field->end;
- iter->dword = iter->start / 32;
+ iter->bit = group_member_offset + iter->field->start;
iter->struct_desc = NULL;
return true;
@@ -890,7 +888,7 @@ iter_decode_field(struct gen_field_iterator *iter)
memset(&v, 0, sizeof(v));
v.qw = iter_decode_field_raw(iter->field,
- &iter->p[iter->dword], iter->p_end);
+ &iter->p[iter->bit / 32], iter->p_end);
const char *enum_name = NULL;
@@ -1020,17 +1018,18 @@ gen_print_group(FILE *outfile, struct gen_group *group,
gen_field_iterator_init(&iter, group, p, color);
do {
- if (last_dword != iter.dword) {
- for (int i = last_dword + 1; i <= iter.dword; i++)
+ int iter_dword = iter.bit / 32;
+ if (last_dword != iter_dword) {
+ for (int i = last_dword + 1; i <= iter_dword; i++)
print_dword_header(outfile, &iter, offset, i);
- last_dword = iter.dword;
+ last_dword = iter_dword;
}
if (!gen_field_is_header(iter.field)) {
fprintf(outfile, " %s: %s\n", iter.name, iter.value);
if (iter.struct_desc) {
- uint64_t struct_offset = offset + 4 * iter.dword;
+ uint64_t struct_offset = offset + 4 * iter_dword;
gen_print_group(outfile, iter.struct_desc, struct_offset,
- &p[iter.dword], color);
+ &p[iter_dword], color);
}
}
} while (gen_field_iterator_next(&iter));
diff --git a/src/intel/common/gen_decoder.h b/src/intel/common/gen_decoder.h
index bf7cb424fc6..a45e0a250d1 100644
--- a/src/intel/common/gen_decoder.h
+++ b/src/intel/common/gen_decoder.h
@@ -70,9 +70,7 @@ struct gen_field_iterator {
struct gen_group *struct_desc;
const uint32_t *p;
const uint32_t *p_end;
- int dword; /**< current field starts at &p[dword] */
- int start; /**< current field starts at this bit number */
- int end; /**< current field ends at this bit number */
+ int bit; /**< current field starts at this bit offset into p */
int group_iter;