spirv/info: Add spirv_op_to_string
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 12 Dec 2017 06:04:04 +0000 (22:04 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 8 Jan 2018 22:57:44 +0000 (14:57 -0800)
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/compiler/spirv/spirv_info.h
src/compiler/spirv/spirv_info_c.py

index 81d43ec925a5adf293167bf464fa607962142db7..121ffd2febb04ead4f04685fd110c3a39cf7c716 100644 (file)
@@ -28,5 +28,6 @@
 
 const char *spirv_capability_to_string(SpvCapability cap);
 const char *spirv_decoration_to_string(SpvDecoration dec);
+const char *spirv_op_to_string(SpvOp op);
 
 #endif /* SPIRV_INFO_H */
index 4a6a81524b32b0d8eba98fd44a5bd08e13f5ffac..ff7942bcd3a8cf68799d189099e370d9ac4c5a69 100644 (file)
@@ -45,6 +45,15 @@ def collect_data(spirv, kind):
 
     return (kind, values)
 
+def collect_opcodes(spirv):
+    values = []
+    for x in spirv["instructions"]:
+        name = x["opname"]
+        assert name.startswith("Op")
+        values.append(name[2:])
+
+    return ("Op", values)
+
 def parse_args():
     p = argparse.ArgumentParser()
     p.add_argument("json")
@@ -81,6 +90,7 @@ if __name__ == "__main__":
     info = [
         collect_data(spirv_info, "Capability"),
         collect_data(spirv_info, "Decoration"),
+        collect_opcodes(spirv_info),
     ]
 
     with open(pargs.out, 'w') as f: