summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLionel Landwerlin <[email protected]>2017-03-12 16:53:29 +0000
committerLionel Landwerlin <[email protected]>2017-03-13 17:23:49 +0000
commitbf47e5ba532d1bfd8780fa784e5a279ca5a96237 (patch)
treed2cef2ec39cb74a520fcd9e5df4fca72d68facd7
parent9df3f28a8bad8892edb114c49b5ed18e555488f9 (diff)
intel: genxml: prevent missing ; with address fields dwords
Before this change, the generator could print this kind of things : const uint32_t v0 = __gen_uint(values->ValidBit, 0, 0) | __gen_uint(values->FaultType, 1, 2) | __gen_uint(values->SRCIDofFault, 3, 10) | __gen_uint(values->GTTSEL, 11, 1) | dw[0] = __gen_combine_address(data, &dw[0], values->VirtualAddressofFault, v0); This change fix the trailing '|'. Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r--src/intel/genxml/gen_pack_header.py54
1 files changed, 26 insertions, 28 deletions
diff --git a/src/intel/genxml/gen_pack_header.py b/src/intel/genxml/gen_pack_header.py
index a1befaf45e9..2a709454af3 100644
--- a/src/intel/genxml/gen_pack_header.py
+++ b/src/intel/genxml/gen_pack_header.py
@@ -415,51 +415,49 @@ class Group(object):
v = "0"
field_index = 0
+ non_address_fields = []
for field in dw.fields:
if field.type != "mbo":
name = field.name + field.dim
if field.type == "mbo":
- s = "__gen_mbo(%d, %d)" % \
- (field.start - dword_start, field.end - dword_start)
+ non_address_fields.append("__gen_mbo(%d, %d)" % \
+ (field.start - dword_start, field.end - dword_start))
elif field.type == "address":
- s = None
+ pass
elif field.type == "uint":
- s = "__gen_uint(values->%s, %d, %d)" % \
- (name, field.start - dword_start, field.end - dword_start)
+ non_address_fields.append("__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)
+ non_address_fields.append("__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)
+ non_address_fields.append("__gen_sint(values->%s, %d, %d)" % \
+ (name, field.start - dword_start, field.end - dword_start))
elif field.type == "bool":
- s = "__gen_uint(values->%s, %d, %d)" % \
- (name, field.start - dword_start, field.end - dword_start)
+ non_address_fields.append("__gen_uint(values->%s, %d, %d)" % \
+ (name, field.start - dword_start, field.end - dword_start))
elif field.type == "float":
- s = "__gen_float(values->%s)" % name
+ non_address_fields.append("__gen_float(values->%s)" % name)
elif field.type == "offset":
- s = "__gen_offset(values->%s, %d, %d)" % \
- (name, field.start - dword_start, field.end - dword_start)
+ non_address_fields.append("__gen_offset(values->%s, %d, %d)" % \
+ (name, field.start - dword_start, field.end - dword_start))
elif field.type == 'ufixed':
- s = "__gen_ufixed(values->%s, %d, %d, %d)" % \
- (name, field.start - dword_start, field.end - dword_start, field.fractional_size)
+ non_address_fields.append("__gen_ufixed(values->%s, %d, %d, %d)" % \
+ (name, field.start - dword_start, field.end - dword_start, field.fractional_size))
elif field.type == 'sfixed':
- s = "__gen_sfixed(values->%s, %d, %d, %d)" % \
- (name, field.start - dword_start, field.end - dword_start, field.fractional_size)
+ non_address_fields.append("__gen_sfixed(values->%s, %d, %d, %d)" % \
+ (name, field.start - dword_start, field.end - dword_start, field.fractional_size))
elif field.type in self.parser.structs:
- s = "__gen_uint(v%d_%d, %d, %d)" % \
- (index, field_index, field.start - dword_start, field.end - dword_start)
+ non_address_fields.append("__gen_uint(v%d_%d, %d, %d)" % \
+ (index, field_index, field.start - dword_start, field.end - dword_start))
field_index = field_index + 1
else:
- print("/* unhandled field %s, type %s */\n" % (name, field.type))
- s = None
-
- if not s == None:
- if field == dw.fields[-1]:
- print(" %s;" % s)
- else:
- print(" %s |" % s)
+ non_address_fields.append("/* unhandled field %s, type %s */\n" % \
+ (name, field.type))
+
+ if len(non_address_fields) > 0:
+ print(" |\n".join(" " + f for f in non_address_fields) + ";")
if dw.size == 32:
if dw.address: