aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2019-04-03 12:45:22 -0700
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-05-21 11:50:47 -0700
commit4b474e2e8a43bd53656754ea284db9c97e3bf948 (patch)
treed0ac9dbc58a23bfb8aa53188cc9b15ecd58be7ff /src/compiler
parent810b95e02c50eb991e22d0772cf283d25adf7dc4 (diff)
spirv: Handle instruction aliases in spirv_info_c.py
Choose the first we see in the grammar file as the main one. This is needed to parse SPIR-V 1.4 because it introduced opcode aliases. Reviewed-by: Karol Herbst <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/spirv/spirv_info_c.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/compiler/spirv/spirv_info_c.py b/src/compiler/spirv/spirv_info_c.py
index 22fd675720c..b9938aedb85 100644
--- a/src/compiler/spirv/spirv_info_c.py
+++ b/src/compiler/spirv/spirv_info_c.py
@@ -46,11 +46,18 @@ def collect_data(spirv, kind):
return (kind, values)
def collect_opcodes(spirv):
+ seen = set()
values = []
for x in spirv["instructions"]:
+ # Handle aliases by choosing the first one in the grammar.
+ # E.g. OpDecorateString and OpDecorateStringGOOGLE share same opcode.
+ if x["opcode"] in seen:
+ continue
+ opcode = x["opcode"]
name = x["opname"]
assert name.startswith("Op")
values.append(name[2:])
+ seen.add(opcode)
return ("Op", values)