From f97e251ab200802feb0784c795fa06153ae6861e Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 29 Mar 2017 20:40:49 -0700 Subject: [PATCH] intel/genxml/bits: Emit per-field _start helpers Reviewed-by: Topi Pohjolainen --- src/intel/genxml/gen_bits_header.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/intel/genxml/gen_bits_header.py b/src/intel/genxml/gen_bits_header.py index cfe2a8976bb..fc31baa1b88 100644 --- a/src/intel/genxml/gen_bits_header.py +++ b/src/intel/genxml/gen_bits_header.py @@ -113,6 +113,8 @@ extern "C" { ${emit_per_gen_prop_func(field, 'bits')} +${emit_per_gen_prop_func(field, 'start')} + % endfor % endfor @@ -205,11 +207,13 @@ class Field(object): self.name = name self.token_name = safe_name('_'.join([container.name, self.name])) self.bits_by_gen = {} + self.start_by_gen = {} def add_gen(self, gen, xml_attrs): assert isinstance(gen, Gen) start = int(xml_attrs['start']) end = int(xml_attrs['end']) + self.start_by_gen[gen] = start self.bits_by_gen[gen] = 1 + end - start def has_prop(self, prop): @@ -218,6 +222,8 @@ class Field(object): def iter_prop(self, prop): if prop == 'bits': return self.bits_by_gen.iteritems() + elif prop == 'start': + return self.start_by_gen.iteritems() else: raise ValueError('Invalid property: "{0}"'.format(prop)) @@ -227,6 +233,8 @@ class Field(object): if prop == 'bits': return self.bits_by_gen.get(gen, 0) + elif prop == 'start': + return self.start_by_gen.get(gen, 0) else: raise ValueError('Invalid property: "{0}"'.format(prop)) -- 2.30.2