| 1 |
#!/usr/bin/env python3 |
| 2 |
"""Generate C headers for certain extended instruction sets""" |
| 3 |
|
| 4 |
import subprocess |
| 5 |
import os |
| 6 |
|
| 7 |
# Assume we are running from the tools/buildHeaders directory |
| 8 |
os.chdir('../../include/spirv/unified1') |
| 9 |
|
| 10 |
def mk_extinst(name, grammar_file): |
| 11 |
"""Generate one C header from a grammar""" |
| 12 |
script = '../../../tools/buildHeaders/bin/generate_language_headers.py' |
| 13 |
subprocess.check_call(['python3', |
| 14 |
script, |
| 15 |
'--extinst-name=' + name, |
| 16 |
'--extinst-grammar=' + grammar_file, |
| 17 |
'--extinst-output-base=' + name]) |
| 18 |
subprocess.check_call(['dos2unix', name + '.h']) |
| 19 |
|
| 20 |
|
| 21 |
mk_extinst('DebugInfo', 'extinst.debuginfo.grammar.json') |
| 22 |
mk_extinst('OpenCLDebugInfo100', 'extinst.opencl.debuginfo.100.grammar.json') |
| 23 |
mk_extinst('AMD_gcn_shader', 'extinst.spv-amd-gcn-shader.grammar.json') |
| 24 |
mk_extinst('AMD_shader_ballot', 'extinst.spv-amd-shader-ballot.grammar.json') |
| 25 |
mk_extinst('AMD_shader_explicit_vertex_parameter', 'extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json') |
| 26 |
mk_extinst('AMD_shader_trinary_minmax', 'extinst.spv-amd-shader-trinary-minmax.grammar.json') |
| 27 |
mk_extinst('NonSemanticDebugPrintf', 'extinst.nonsemantic.debugprintf.grammar.json') |
| 28 |
mk_extinst('NonSemanticClspvReflection', 'extinst.nonsemantic.clspvreflection.grammar.json') |