diff options
author | Kristian H. Kristensen <[email protected]> | 2016-11-28 16:24:13 -0800 |
---|---|---|
committer | Kristian H. Kristensen <[email protected]> | 2016-11-29 22:02:49 -0800 |
commit | 5814fc1bb7357881c3e89323756743e6de3dc91f (patch) | |
tree | 092a002fc2468bd47040a64ad4dec8acf40218ab /src/intel/genxml/gen_pack_header.py | |
parent | 3b6b6f6463019f4c765d8e8a5b37a530f489bf5a (diff) |
intel/genxml: Allow referencing enums in type attributes
This lets us reference enums in the type attribute of a field.
Signed-off-by: Kristian H. Kristensen <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/intel/genxml/gen_pack_header.py')
-rw-r--r-- | src/intel/genxml/gen_pack_header.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/intel/genxml/gen_pack_header.py b/src/intel/genxml/gen_pack_header.py index 83e3fde2daa..f09667d3d8e 100644 --- a/src/intel/genxml/gen_pack_header.py +++ b/src/intel/genxml/gen_pack_header.py @@ -267,6 +267,8 @@ class Field(object): type = 'uint32_t' elif self.type in self.parser.structs: type = 'struct ' + self.parser.gen_prefix(safe_name(self.type)) + elif self.type in self.parser.enums: + type = 'uint32_t' elif self.type == 'mbo': return else: @@ -426,6 +428,9 @@ class Group(object): elif field.type == "uint": s = "__gen_uint(values->%s, %d, %d)" % \ (name, field.start - dword_start, field.end - dword_start) + elif field.type in self.parser.enums: + s = "__gen_uint(values->%s, %d, %d)" % \ + (name, field.start - dword_start, field.end - dword_start) elif field.type == "int": s = "__gen_sint(values->%s, %d, %d)" % \ (name, field.start - dword_start, field.end - dword_start) @@ -484,6 +489,7 @@ class Parser(object): self.instruction = None self.structs = {} + self.enums = {} self.registers = {} def gen_prefix(self, name): @@ -530,6 +536,7 @@ class Parser(object): elif name == "enum": self.values = [] self.enum = safe_name(attrs["name"]) + self.enums[attrs["name"]] = 1 if "prefix" in attrs: self.prefix = safe_name(attrs["prefix"]) else: |