From: Jason Ekstrand Date: Thu, 30 Mar 2017 03:40:49 +0000 (-0700) Subject: intel/genxml/bits: Emit per-field _start helpers X-Git-Tag: upstream/17.1.0~416 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f97e251ab200802feb0784c795fa06153ae6861e;p=platform%2Fupstream%2Fmesa.git intel/genxml/bits: Emit per-field _start helpers Reviewed-by: Topi Pohjolainen --- diff --git a/src/intel/genxml/gen_bits_header.py b/src/intel/genxml/gen_bits_header.py index cfe2a89..fc31baa 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))