Skip to content

Commit feba06f

Browse files
authored
ggt.py: no need to precondition extension lists (KhronosGroup#6139)
1 parent 9d0f817 commit feba06f

1 file changed

Lines changed: 0 additions & 33 deletions

File tree

utils/ggt.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -867,36 +867,6 @@ def get_extension_list(instructions, operand_kinds):
867867
return sorted(set(extensions))
868868

869869

870-
def precondition_operand_kinds(operand_kinds):
871-
"""For operand kinds that have the same number, make sure they all have the
872-
same extension list."""
873-
874-
# Map operand kind and value to list of the union of extensions
875-
# for same-valued enumerants.
876-
exts = {}
877-
for kind_entry in operand_kinds:
878-
kind = kind_entry.get('kind')
879-
for enum_entry in kind_entry.get('enumerants', []):
880-
value = enum_entry.get('value')
881-
key = kind + '.' + str(value)
882-
if key in exts:
883-
exts[key].extend(enum_entry.get('extensions', []))
884-
else:
885-
exts[key] = enum_entry.get('extensions', [])
886-
exts[key] = sorted(set(exts[key]))
887-
888-
# Now make each entry the same list.
889-
for kind_entry in operand_kinds:
890-
kind = kind_entry.get('kind')
891-
for enum_entry in kind_entry.get('enumerants', []):
892-
value = enum_entry.get('value')
893-
key = kind + '.' + str(value)
894-
if len(exts[key]) > 0:
895-
enum_entry['extensions'] = exts[key]
896-
897-
return operand_kinds
898-
899-
900870
def prefix_operand_kind_names(prefix, json_dict):
901871
"""Modifies json_dict, by prefixing all the operand kind names
902872
with the given prefix. Also modifies their uses in the instructions
@@ -965,9 +935,6 @@ def main():
965935
operand_kinds.extend(e.grammar.get('operand_kinds',[]))
966936

967937
extensions = get_extension_list(instructions, operand_kinds)
968-
# TODO(dneto): I think preconditioning is no longer necessary now that
969-
# aliases are explicitly represented.
970-
operand_kinds = precondition_operand_kinds(operand_kinds)
971938

972939
g = Grammar(extensions, operand_kinds, printing_class)
973940
g.ComputeOperandTables()

0 commit comments

Comments
 (0)