Add grammars, C header, and header generator for vendor and KHR extended instruction...
authorDavid Neto <dneto@google.com>
Wed, 26 Feb 2020 18:58:17 +0000 (13:58 -0500)
committerGitHub <noreply@github.com>
Wed, 26 Feb 2020 18:58:17 +0000 (11:58 -0700)
* Add JSON grammars for extened instruction sets

Add AMD extended instruction sets
Add DebugInfo
Add OpenCL.DebugInfo.100

* Add script to generate C headers from extinst grammar

This is cloned then adapted from the same-named script in SPIRV-Tools
(contributed under same authorship but different copyright).

Invoke the script as part of the overall header generation script.

* Add generated C header for extended instruction sets

Add for DebugInfo and OpenCLDebugInfo
Add for AMD vendor extended instruction sets

* Update the README for extinst header generation

* Fix header include guard to match directory structure

* Ensure generated header ends in newline

* Fix typo in file reference

* Fix name of AMD_shader_explicit_vertex_parameter.h

* Avoid duplicate generation

* Split Revision and Version enum values by newlines

Per code review request

* Convert C header generator driver to Python3

* Fix README for Python3 for extinst header generation

* Use 4-space in generated headers, consistently

16 files changed:
README.md
include/spirv/unified1/AMD_gcn_shader.h [new file with mode: 0644]
include/spirv/unified1/AMD_shader_ballot.h [new file with mode: 0644]
include/spirv/unified1/AMD_shader_explicit_vertex_parameter.h [new file with mode: 0644]
include/spirv/unified1/AMD_shader_trinary_minmax.h [new file with mode: 0644]
include/spirv/unified1/DebugInfo.h [new file with mode: 0644]
include/spirv/unified1/OpenCLDebugInfo100.h [new file with mode: 0644]
include/spirv/unified1/extinst.debuginfo.grammar.json [new file with mode: 0644]
include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json [new file with mode: 0644]
include/spirv/unified1/extinst.spv-amd-gcn-shader.grammar.json [new file with mode: 0644]
include/spirv/unified1/extinst.spv-amd-shader-ballot.grammar.json [new file with mode: 0644]
include/spirv/unified1/extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json [new file with mode: 0644]
include/spirv/unified1/extinst.spv-amd-shader-trinary-minmax.grammar.json [new file with mode: 0644]
tools/buildHeaders/bin/generate_language_headers.py [new file with mode: 0755]
tools/buildHeaders/bin/makeExtinstHeaders.py [new file with mode: 0755]
tools/buildHeaders/bin/makeHeaders

index 53c476f..2ea3dc5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -119,7 +119,7 @@ cc_library(
 #include "spirv/unified1/spirv.hpp"
 ```
 
-## Generating the headers from the JSON grammar
+## Generating headers from the JSON grammar for the SPIR-V core instruction set
 
 This will generally be done by Khronos, for a change to the JSON grammar.
 However, the project for the tool to do this is included in this repository,
@@ -137,6 +137,26 @@ Notes:
   and that influences the languages used, for legacy reasons
 - the C++ structures built may similarly include more than strictly necessary, for the same reason
 
+## Generating C headers for extended instruction sets
+
+The [GLSL.std.450.h](include/spirv/unified1/GLSL.std.450.h)
+and [OpenCL.std.h](include/spirv/unified1/OpenCL.std.h) extended instruction set headers
+are maintained manually.
+
+The C/C++ header for each of the other extended instruction sets
+is generated from the corresponding JSON grammar file.  For example, the
+[OpenCLDebugInfo100.h](include/spirv/unified1/OpenCLDebugInfo100.h) header
+is generated from the
+[extinst.opencl.debuginfo.100.grammar.json](include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json)
+grammar file.
+
+To generate these C/C++ headers, first make sure `python3` is in your PATH, then
+invoke the build script as follows:
+```
+cd tools/buildHeaders
+python3 bin/makeExtinstHeaders.py
+```
+
 ## FAQ
 
 * *How are different versions published?*
diff --git a/include/spirv/unified1/AMD_gcn_shader.h b/include/spirv/unified1/AMD_gcn_shader.h
new file mode 100644 (file)
index 0000000..0d311a1
--- /dev/null
@@ -0,0 +1,52 @@
+// Copyright (c) 2020 The Khronos Group Inc.
+// 
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and/or associated documentation files (the
+// "Materials"), to deal in the Materials without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Materials, and to
+// permit persons to whom the Materials are furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Materials.
+// 
+// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
+// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
+// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
+//    https://www.khronos.org/registry/
+// 
+// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+// 
+
+#ifndef SPIRV_UNIFIED1_AMD_gcn_shader_H_
+#define SPIRV_UNIFIED1_AMD_gcn_shader_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+    AMD_gcn_shaderRevision = 2,
+    AMD_gcn_shaderRevision_BitWidthPadding = 0x7fffffff
+};
+
+enum AMD_gcn_shaderInstructions {
+    AMD_gcn_shaderCubeFaceIndexAMD = 1,
+    AMD_gcn_shaderCubeFaceCoordAMD = 2,
+    AMD_gcn_shaderTimeAMD = 3,
+    AMD_gcn_shaderInstructionsMax = 0x7ffffff
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // SPIRV_UNIFIED1_AMD_gcn_shader_H_
diff --git a/include/spirv/unified1/AMD_shader_ballot.h b/include/spirv/unified1/AMD_shader_ballot.h
new file mode 100644 (file)
index 0000000..59b2aaf
--- /dev/null
@@ -0,0 +1,53 @@
+// Copyright (c) 2020 The Khronos Group Inc.
+// 
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and/or associated documentation files (the
+// "Materials"), to deal in the Materials without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Materials, and to
+// permit persons to whom the Materials are furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Materials.
+// 
+// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
+// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
+// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
+//    https://www.khronos.org/registry/
+// 
+// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+// 
+
+#ifndef SPIRV_UNIFIED1_AMD_shader_ballot_H_
+#define SPIRV_UNIFIED1_AMD_shader_ballot_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+    AMD_shader_ballotRevision = 5,
+    AMD_shader_ballotRevision_BitWidthPadding = 0x7fffffff
+};
+
+enum AMD_shader_ballotInstructions {
+    AMD_shader_ballotSwizzleInvocationsAMD = 1,
+    AMD_shader_ballotSwizzleInvocationsMaskedAMD = 2,
+    AMD_shader_ballotWriteInvocationAMD = 3,
+    AMD_shader_ballotMbcntAMD = 4,
+    AMD_shader_ballotInstructionsMax = 0x7ffffff
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // SPIRV_UNIFIED1_AMD_shader_ballot_H_
diff --git a/include/spirv/unified1/AMD_shader_explicit_vertex_parameter.h b/include/spirv/unified1/AMD_shader_explicit_vertex_parameter.h
new file mode 100644 (file)
index 0000000..aa3d52b
--- /dev/null
@@ -0,0 +1,50 @@
+// Copyright (c) 2020 The Khronos Group Inc.
+// 
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and/or associated documentation files (the
+// "Materials"), to deal in the Materials without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Materials, and to
+// permit persons to whom the Materials are furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Materials.
+// 
+// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
+// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
+// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
+//    https://www.khronos.org/registry/
+// 
+// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+// 
+
+#ifndef SPIRV_UNIFIED1_AMD_shader_explicit_vertex_parameter_H_
+#define SPIRV_UNIFIED1_AMD_shader_explicit_vertex_parameter_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+    AMD_shader_explicit_vertex_parameterRevision = 4,
+    AMD_shader_explicit_vertex_parameterRevision_BitWidthPadding = 0x7fffffff
+};
+
+enum AMD_shader_explicit_vertex_parameterInstructions {
+    AMD_shader_explicit_vertex_parameterInterpolateAtVertexAMD = 1,
+    AMD_shader_explicit_vertex_parameterInstructionsMax = 0x7ffffff
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // SPIRV_UNIFIED1_AMD_shader_explicit_vertex_parameter_H_
diff --git a/include/spirv/unified1/AMD_shader_trinary_minmax.h b/include/spirv/unified1/AMD_shader_trinary_minmax.h
new file mode 100644 (file)
index 0000000..8b49280
--- /dev/null
@@ -0,0 +1,58 @@
+// Copyright (c) 2020 The Khronos Group Inc.
+// 
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and/or associated documentation files (the
+// "Materials"), to deal in the Materials without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Materials, and to
+// permit persons to whom the Materials are furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Materials.
+// 
+// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
+// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
+// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
+//    https://www.khronos.org/registry/
+// 
+// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+// 
+
+#ifndef SPIRV_UNIFIED1_AMD_shader_trinary_minmax_H_
+#define SPIRV_UNIFIED1_AMD_shader_trinary_minmax_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+    AMD_shader_trinary_minmaxRevision = 4,
+    AMD_shader_trinary_minmaxRevision_BitWidthPadding = 0x7fffffff
+};
+
+enum AMD_shader_trinary_minmaxInstructions {
+    AMD_shader_trinary_minmaxFMin3AMD = 1,
+    AMD_shader_trinary_minmaxUMin3AMD = 2,
+    AMD_shader_trinary_minmaxSMin3AMD = 3,
+    AMD_shader_trinary_minmaxFMax3AMD = 4,
+    AMD_shader_trinary_minmaxUMax3AMD = 5,
+    AMD_shader_trinary_minmaxSMax3AMD = 6,
+    AMD_shader_trinary_minmaxFMid3AMD = 7,
+    AMD_shader_trinary_minmaxUMid3AMD = 8,
+    AMD_shader_trinary_minmaxSMid3AMD = 9,
+    AMD_shader_trinary_minmaxInstructionsMax = 0x7ffffff
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // SPIRV_UNIFIED1_AMD_shader_trinary_minmax_H_
diff --git a/include/spirv/unified1/DebugInfo.h b/include/spirv/unified1/DebugInfo.h
new file mode 100644 (file)
index 0000000..c8e26f1
--- /dev/null
@@ -0,0 +1,143 @@
+// Copyright (c) 2017 The Khronos Group Inc.
+// 
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and/or associated documentation files (the "Materials"),
+// to deal in the Materials without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Materials, and to permit persons to whom the
+// Materials are furnished to do so, subject to the following conditions:
+// 
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Materials.
+// 
+// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
+// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
+// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ 
+// 
+// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
+// IN THE MATERIALS.
+
+#ifndef SPIRV_UNIFIED1_DebugInfo_H_
+#define SPIRV_UNIFIED1_DebugInfo_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+    DebugInfoVersion = 100,
+    DebugInfoVersion_BitWidthPadding = 0x7fffffff
+};
+enum {
+    DebugInfoRevision = 1,
+    DebugInfoRevision_BitWidthPadding = 0x7fffffff
+};
+
+enum DebugInfoInstructions {
+    DebugInfoDebugInfoNone = 0,
+    DebugInfoDebugCompilationUnit = 1,
+    DebugInfoDebugTypeBasic = 2,
+    DebugInfoDebugTypePointer = 3,
+    DebugInfoDebugTypeQualifier = 4,
+    DebugInfoDebugTypeArray = 5,
+    DebugInfoDebugTypeVector = 6,
+    DebugInfoDebugTypedef = 7,
+    DebugInfoDebugTypeFunction = 8,
+    DebugInfoDebugTypeEnum = 9,
+    DebugInfoDebugTypeComposite = 10,
+    DebugInfoDebugTypeMember = 11,
+    DebugInfoDebugTypeInheritance = 12,
+    DebugInfoDebugTypePtrToMember = 13,
+    DebugInfoDebugTypeTemplate = 14,
+    DebugInfoDebugTypeTemplateParameter = 15,
+    DebugInfoDebugTypeTemplateTemplateParameter = 16,
+    DebugInfoDebugTypeTemplateParameterPack = 17,
+    DebugInfoDebugGlobalVariable = 18,
+    DebugInfoDebugFunctionDeclaration = 19,
+    DebugInfoDebugFunction = 20,
+    DebugInfoDebugLexicalBlock = 21,
+    DebugInfoDebugLexicalBlockDiscriminator = 22,
+    DebugInfoDebugScope = 23,
+    DebugInfoDebugNoScope = 24,
+    DebugInfoDebugInlinedAt = 25,
+    DebugInfoDebugLocalVariable = 26,
+    DebugInfoDebugInlinedVariable = 27,
+    DebugInfoDebugDeclare = 28,
+    DebugInfoDebugValue = 29,
+    DebugInfoDebugOperation = 30,
+    DebugInfoDebugExpression = 31,
+    DebugInfoDebugMacroDef = 32,
+    DebugInfoDebugMacroUndef = 33,
+    DebugInfoInstructionsMax = 0x7ffffff
+};
+
+
+enum DebugInfoDebugInfoFlags {
+    DebugInfoFlagIsProtected = 0x01,
+    DebugInfoFlagIsPrivate = 0x02,
+    DebugInfoFlagIsPublic = 0x03,
+    DebugInfoFlagIsLocal = 0x04,
+    DebugInfoFlagIsDefinition = 0x08,
+    DebugInfoFlagFwdDecl = 0x10,
+    DebugInfoFlagArtificial = 0x20,
+    DebugInfoFlagExplicit = 0x40,
+    DebugInfoFlagPrototyped = 0x80,
+    DebugInfoFlagObjectPointer = 0x100,
+    DebugInfoFlagStaticMember = 0x200,
+    DebugInfoFlagIndirectVariable = 0x400,
+    DebugInfoFlagLValueReference = 0x800,
+    DebugInfoFlagRValueReference = 0x1000,
+    DebugInfoFlagIsOptimized = 0x2000,
+    DebugInfoDebugInfoFlagsMax = 0x7ffffff
+};
+
+enum DebugInfoDebugBaseTypeAttributeEncoding {
+    DebugInfoUnspecified = 0,
+    DebugInfoAddress = 1,
+    DebugInfoBoolean = 2,
+    DebugInfoFloat = 4,
+    DebugInfoSigned = 5,
+    DebugInfoSignedChar = 6,
+    DebugInfoUnsigned = 7,
+    DebugInfoUnsignedChar = 8,
+    DebugInfoDebugBaseTypeAttributeEncodingMax = 0x7ffffff
+};
+
+enum DebugInfoDebugCompositeType {
+    DebugInfoClass = 0,
+    DebugInfoStructure = 1,
+    DebugInfoUnion = 2,
+    DebugInfoDebugCompositeTypeMax = 0x7ffffff
+};
+
+enum DebugInfoDebugTypeQualifier {
+    DebugInfoConstType = 0,
+    DebugInfoVolatileType = 1,
+    DebugInfoRestrictType = 2,
+    DebugInfoDebugTypeQualifierMax = 0x7ffffff
+};
+
+enum DebugInfoDebugOperation {
+    DebugInfoDeref = 0,
+    DebugInfoPlus = 1,
+    DebugInfoMinus = 2,
+    DebugInfoPlusUconst = 3,
+    DebugInfoBitPiece = 4,
+    DebugInfoSwap = 5,
+    DebugInfoXderef = 6,
+    DebugInfoStackValue = 7,
+    DebugInfoConstu = 8,
+    DebugInfoDebugOperationMax = 0x7ffffff
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // SPIRV_UNIFIED1_DebugInfo_H_
diff --git a/include/spirv/unified1/OpenCLDebugInfo100.h b/include/spirv/unified1/OpenCLDebugInfo100.h
new file mode 100644 (file)
index 0000000..057580e
--- /dev/null
@@ -0,0 +1,156 @@
+// Copyright (c) 2018 The Khronos Group Inc.
+// 
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and/or associated documentation files (the "Materials"),
+// to deal in the Materials without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Materials, and to permit persons to whom the
+// Materials are furnished to do so, subject to the following conditions:
+// 
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Materials.
+// 
+// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
+// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
+// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ 
+// 
+// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
+// IN THE MATERIALS.
+
+#ifndef SPIRV_UNIFIED1_OpenCLDebugInfo100_H_
+#define SPIRV_UNIFIED1_OpenCLDebugInfo100_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+    OpenCLDebugInfo100Version = 200,
+    OpenCLDebugInfo100Version_BitWidthPadding = 0x7fffffff
+};
+enum {
+    OpenCLDebugInfo100Revision = 2,
+    OpenCLDebugInfo100Revision_BitWidthPadding = 0x7fffffff
+};
+
+enum OpenCLDebugInfo100Instructions {
+    OpenCLDebugInfo100DebugInfoNone = 0,
+    OpenCLDebugInfo100DebugCompilationUnit = 1,
+    OpenCLDebugInfo100DebugTypeBasic = 2,
+    OpenCLDebugInfo100DebugTypePointer = 3,
+    OpenCLDebugInfo100DebugTypeQualifier = 4,
+    OpenCLDebugInfo100DebugTypeArray = 5,
+    OpenCLDebugInfo100DebugTypeVector = 6,
+    OpenCLDebugInfo100DebugTypedef = 7,
+    OpenCLDebugInfo100DebugTypeFunction = 8,
+    OpenCLDebugInfo100DebugTypeEnum = 9,
+    OpenCLDebugInfo100DebugTypeComposite = 10,
+    OpenCLDebugInfo100DebugTypeMember = 11,
+    OpenCLDebugInfo100DebugTypeInheritance = 12,
+    OpenCLDebugInfo100DebugTypePtrToMember = 13,
+    OpenCLDebugInfo100DebugTypeTemplate = 14,
+    OpenCLDebugInfo100DebugTypeTemplateParameter = 15,
+    OpenCLDebugInfo100DebugTypeTemplateTemplateParameter = 16,
+    OpenCLDebugInfo100DebugTypeTemplateParameterPack = 17,
+    OpenCLDebugInfo100DebugGlobalVariable = 18,
+    OpenCLDebugInfo100DebugFunctionDeclaration = 19,
+    OpenCLDebugInfo100DebugFunction = 20,
+    OpenCLDebugInfo100DebugLexicalBlock = 21,
+    OpenCLDebugInfo100DebugLexicalBlockDiscriminator = 22,
+    OpenCLDebugInfo100DebugScope = 23,
+    OpenCLDebugInfo100DebugNoScope = 24,
+    OpenCLDebugInfo100DebugInlinedAt = 25,
+    OpenCLDebugInfo100DebugLocalVariable = 26,
+    OpenCLDebugInfo100DebugInlinedVariable = 27,
+    OpenCLDebugInfo100DebugDeclare = 28,
+    OpenCLDebugInfo100DebugValue = 29,
+    OpenCLDebugInfo100DebugOperation = 30,
+    OpenCLDebugInfo100DebugExpression = 31,
+    OpenCLDebugInfo100DebugMacroDef = 32,
+    OpenCLDebugInfo100DebugMacroUndef = 33,
+    OpenCLDebugInfo100DebugImportedEntity = 34,
+    OpenCLDebugInfo100DebugSource = 35,
+    OpenCLDebugInfo100InstructionsMax = 0x7ffffff
+};
+
+
+enum OpenCLDebugInfo100DebugInfoFlags {
+    OpenCLDebugInfo100FlagIsProtected = 0x01,
+    OpenCLDebugInfo100FlagIsPrivate = 0x02,
+    OpenCLDebugInfo100FlagIsPublic = 0x03,
+    OpenCLDebugInfo100FlagIsLocal = 0x04,
+    OpenCLDebugInfo100FlagIsDefinition = 0x08,
+    OpenCLDebugInfo100FlagFwdDecl = 0x10,
+    OpenCLDebugInfo100FlagArtificial = 0x20,
+    OpenCLDebugInfo100FlagExplicit = 0x40,
+    OpenCLDebugInfo100FlagPrototyped = 0x80,
+    OpenCLDebugInfo100FlagObjectPointer = 0x100,
+    OpenCLDebugInfo100FlagStaticMember = 0x200,
+    OpenCLDebugInfo100FlagIndirectVariable = 0x400,
+    OpenCLDebugInfo100FlagLValueReference = 0x800,
+    OpenCLDebugInfo100FlagRValueReference = 0x1000,
+    OpenCLDebugInfo100FlagIsOptimized = 0x2000,
+    OpenCLDebugInfo100FlagIsEnumClass = 0x4000,
+    OpenCLDebugInfo100FlagTypePassByValue = 0x8000,
+    OpenCLDebugInfo100FlagTypePassByReference = 0x10000,
+    OpenCLDebugInfo100DebugInfoFlagsMax = 0x7ffffff
+};
+
+enum OpenCLDebugInfo100DebugBaseTypeAttributeEncoding {
+    OpenCLDebugInfo100Unspecified = 0,
+    OpenCLDebugInfo100Address = 1,
+    OpenCLDebugInfo100Boolean = 2,
+    OpenCLDebugInfo100Float = 3,
+    OpenCLDebugInfo100Signed = 4,
+    OpenCLDebugInfo100SignedChar = 5,
+    OpenCLDebugInfo100Unsigned = 6,
+    OpenCLDebugInfo100UnsignedChar = 7,
+    OpenCLDebugInfo100DebugBaseTypeAttributeEncodingMax = 0x7ffffff
+};
+
+enum OpenCLDebugInfo100DebugCompositeType {
+    OpenCLDebugInfo100Class = 0,
+    OpenCLDebugInfo100Structure = 1,
+    OpenCLDebugInfo100Union = 2,
+    OpenCLDebugInfo100DebugCompositeTypeMax = 0x7ffffff
+};
+
+enum OpenCLDebugInfo100DebugTypeQualifier {
+    OpenCLDebugInfo100ConstType = 0,
+    OpenCLDebugInfo100VolatileType = 1,
+    OpenCLDebugInfo100RestrictType = 2,
+    OpenCLDebugInfo100AtomicType = 3,
+    OpenCLDebugInfo100DebugTypeQualifierMax = 0x7ffffff
+};
+
+enum OpenCLDebugInfo100DebugOperation {
+    OpenCLDebugInfo100Deref = 0,
+    OpenCLDebugInfo100Plus = 1,
+    OpenCLDebugInfo100Minus = 2,
+    OpenCLDebugInfo100PlusUconst = 3,
+    OpenCLDebugInfo100BitPiece = 4,
+    OpenCLDebugInfo100Swap = 5,
+    OpenCLDebugInfo100Xderef = 6,
+    OpenCLDebugInfo100StackValue = 7,
+    OpenCLDebugInfo100Constu = 8,
+    OpenCLDebugInfo100Fragment = 9,
+    OpenCLDebugInfo100DebugOperationMax = 0x7ffffff
+};
+
+enum OpenCLDebugInfo100DebugImportedEntity {
+    OpenCLDebugInfo100ImportedModule = 0,
+    OpenCLDebugInfo100ImportedDeclaration = 1,
+    OpenCLDebugInfo100DebugImportedEntityMax = 0x7ffffff
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // SPIRV_UNIFIED1_OpenCLDebugInfo100_H_
diff --git a/include/spirv/unified1/extinst.debuginfo.grammar.json b/include/spirv/unified1/extinst.debuginfo.grammar.json
new file mode 100644 (file)
index 0000000..9212f6f
--- /dev/null
@@ -0,0 +1,568 @@
+{
+  "copyright" : [
+    "Copyright (c) 2017 The Khronos Group Inc.",
+    "",
+    "Permission is hereby granted, free of charge, to any person obtaining a copy",
+    "of this software and/or associated documentation files (the \"Materials\"),",
+    "to deal in the Materials without restriction, including without limitation",
+    "the rights to use, copy, modify, merge, publish, distribute, sublicense,",
+    "and/or sell copies of the Materials, and to permit persons to whom the",
+    "Materials are furnished to do so, subject to the following conditions:",
+    "",
+    "The above copyright notice and this permission notice shall be included in",
+    "all copies or substantial portions of the Materials.",
+    "",
+    "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS",
+    "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND",
+    "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ",
+    "",
+    "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS",
+    "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,",
+    "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL",
+    "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER",
+    "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING",
+    "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS",
+    "IN THE MATERIALS."
+  ],
+  "version" : 100,
+  "revision" : 1,
+  "instructions" : [
+    {
+      "opname" : "DebugInfoNone",
+      "opcode" : 0
+    },
+    {
+      "opname" : "DebugCompilationUnit",
+      "opcode" : 1,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Version'" },
+        { "kind" : "LiteralInteger", "name" : "'DWARF Version'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeBasic",
+      "opcode" : 2,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Size'" },
+        { "kind" : "DebugBaseTypeAttributeEncoding", "name" : "'Encoding'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypePointer",
+      "opcode" : 3,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Base Type'" },
+        { "kind" : "StorageClass", "name" : "'Storage Class'" },
+        { "kind" : "DebugInfoFlags", "name" : "'Literal Flags'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeQualifier",
+      "opcode" : 4,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Base Type'" },
+        { "kind" : "DebugTypeQualifier", "name" : "'Type Qualifier'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeArray",
+      "opcode" : 5,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Base Type'" },
+        { "kind" : "IdRef", "name" : "'Component Counts'", "quantifier" : "*" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeVector",
+      "opcode" : 6,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Base Type'" },
+        { "kind" : "LiteralInteger", "name" : "'Component Count'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypedef",
+      "opcode" : 7,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Base Type'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeFunction",
+      "opcode" : 8,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Return Type'" },
+        { "kind" : "IdRef", "name" : "'Paramter Types'", "quantifier" : "*" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeEnum",
+      "opcode" : 9,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Underlying Type'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" },
+        { "kind" : "IdRef", "name" : "'Size'" },
+        { "kind" : "DebugInfoFlags", "name" : "'Flags'" },
+        { "kind" : "PairIdRefIdRef", "name" : "'Value, Name, Value, Name, ...'", "quantifier" : "*" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeComposite",
+      "opcode" : 10,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "DebugCompositeType", "name" : "'Tag'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" },
+        { "kind" : "IdRef", "name" : "'Size'" },
+        { "kind" : "DebugInfoFlags", "name" : "'Flags'" },
+        { "kind" : "IdRef", "name" : "'Members'", "quantifier" : "*" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeMember",
+      "opcode" : 11,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Type'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" },
+        { "kind" : "IdRef", "name" : "'Offset'" },
+        { "kind" : "IdRef", "name" : "'Size'" },
+        { "kind" : "DebugInfoFlags", "name" : "'Flags'" },
+        { "kind" : "IdRef", "name" : "'Value'", "quantifier" : "?" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeInheritance",
+      "opcode" : 12,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Child'" },
+        { "kind" : "IdRef", "name" : "'Parent'" },
+        { "kind" : "IdRef", "name" : "'Offset'" },
+        { "kind" : "IdRef", "name" : "'Size'" },
+        { "kind" : "DebugInfoFlags", "name" : "'Flags'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypePtrToMember",
+      "opcode" : 13,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Member Type'" },
+        { "kind" : "IdRef", "name" : "'Parent'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeTemplate",
+      "opcode" : 14,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Target'" },
+        { "kind" : "IdRef", "name" : "'Parameters'", "quantifier" : "*" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeTemplateParameter",
+      "opcode" : 15,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Actual Type'" },
+        { "kind" : "IdRef", "name" : "'Value'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeTemplateTemplateParameter",
+      "opcode" : 16,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Template Name'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeTemplateParameterPack",
+      "opcode" : 17,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Template Parameters'", "quantifier" : "*" }
+      ]
+    },
+    {
+      "opname" : "DebugGlobalVariable",
+      "opcode" : 18,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Type'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" },
+        { "kind" : "IdRef", "name" : "'Linkage Name'" },
+        { "kind" : "IdRef", "name" : "'Variable'" },
+        { "kind" : "DebugInfoFlags", "name" : "'Flags'" },
+        { "kind" : "IdRef", "name" : "'Static Member Declaration'", "quantifier" : "?" }
+      ]
+    },
+    {
+      "opname" : "DebugFunctionDeclaration",
+      "opcode" : 19,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Type'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" },
+        { "kind" : "IdRef", "name" : "'Linkage Name'" },
+        { "kind" : "DebugInfoFlags", "name" : "'Flags'" }
+      ]
+    },
+    {
+      "opname" : "DebugFunction",
+      "opcode" : 20,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Type'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" },
+        { "kind" : "IdRef", "name" : "'Linkage Name'" },
+        { "kind" : "DebugInfoFlags", "name" : "'Flags'" },
+        { "kind" : "LiteralInteger", "name" : "'Scope Line'" },
+        { "kind" : "IdRef", "name" : "'Function'" },
+        { "kind" : "IdRef", "name" : "'Declaration'", "quantifier" : "?" }
+      ]
+    },
+    {
+      "opname" : "DebugLexicalBlock",
+      "opcode" : 21,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" },
+        { "kind" : "IdRef", "name" : "'Name'", "quantifier" : "?" }
+      ]
+    },
+    {
+      "opname" : "DebugLexicalBlockDiscriminator",
+      "opcode" : 22,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Scope'" },
+        { "kind" : "LiteralInteger", "name" : "'Discriminator'" },
+        { "kind" : "IdRef", "name" : "'Parent'" }
+      ]
+    },
+    {
+      "opname" : "DebugScope",
+      "opcode" : 23,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Scope'" },
+        { "kind" : "IdRef", "name" : "'Inlined At'", "quantifier" : "?" }
+      ]
+    },
+    {
+      "opname" : "DebugNoScope",
+      "opcode" : 24
+    },
+    {
+      "opname" : "DebugInlinedAt",
+      "opcode" : 25,
+      "operands" : [
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "IdRef", "name" : "'Scope'" },
+        { "kind" : "IdRef", "name" : "'Inlined'", "quantifier" : "?" }
+      ]
+    },
+    {
+      "opname" : "DebugLocalVariable",
+      "opcode" : 26,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Type'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" },
+        { "kind" : "LiteralInteger", "name" : "'Arg Number'", "quantifier" : "?" }
+      ]
+    },
+    {
+      "opname" : "DebugInlinedVariable",
+      "opcode" : 27,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Variable'" },
+        { "kind" : "IdRef", "name" : "'Inlined'" }
+      ]
+    },
+    {
+      "opname" : "DebugDeclare",
+      "opcode" : 28,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Local Variable'" },
+        { "kind" : "IdRef", "name" : "'Variable'" },
+        { "kind" : "IdRef", "name" : "'Expression'" }
+      ]
+    },
+    {
+      "opname" : "DebugValue",
+      "opcode" : 29,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Value'" },
+        { "kind" : "IdRef", "name" : "'Expression'" },
+        { "kind" : "IdRef", "name" : "'Indexes'", "quantifier" : "*" }
+      ]
+    },
+    {
+      "opname" : "DebugOperation",
+      "opcode" : 30,
+      "operands" : [
+        { "kind" : "DebugOperation", "name" : "'OpCode'" },
+        { "kind" : "LiteralInteger", "name" : "'Operands ...'", "quantifier" : "*" }
+      ]
+    },
+    {
+      "opname" : "DebugExpression",
+      "opcode" : 31,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Operands ...'", "quantifier" : "*" }
+      ]
+    },
+    {
+      "opname" : "DebugMacroDef",
+      "opcode" : 32,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Value'", "quantifier" : "?" }
+      ]
+    },
+    {
+      "opname" : "DebugMacroUndef",
+      "opcode" : 33,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "IdRef", "name" : "'Macro'" }
+      ]
+    }
+  ],
+  "operand_kinds" : [
+    {
+      "category" : "BitEnum",
+      "kind" : "DebugInfoFlags",
+      "enumerants" : [
+        {
+          "enumerant" : "FlagIsProtected",
+          "value" : "0x01"
+        },
+        {
+          "enumerant" : "FlagIsPrivate",
+          "value" : "0x02"
+        },
+        {
+          "enumerant" : "FlagIsPublic",
+          "value" : "0x03"
+        },
+        {
+          "enumerant" : "FlagIsLocal",
+          "value" : "0x04"
+        },
+        {
+          "enumerant" : "FlagIsDefinition",
+          "value" : "0x08"
+        },
+        {
+          "enumerant" : "FlagFwdDecl",
+          "value" : "0x10"
+        },
+        {
+          "enumerant" : "FlagArtificial",
+          "value" : "0x20"
+        },
+        {
+          "enumerant" : "FlagExplicit",
+          "value" : "0x40"
+        },
+        {
+          "enumerant" : "FlagPrototyped",
+          "value" : "0x80"
+        },
+        {
+          "enumerant" : "FlagObjectPointer",
+          "value" : "0x100"
+        },
+        {
+          "enumerant" : "FlagStaticMember",
+          "value" : "0x200"
+        },
+        {
+          "enumerant" : "FlagIndirectVariable",
+          "value" : "0x400"
+        },
+        {
+          "enumerant" : "FlagLValueReference",
+          "value" : "0x800"
+        },
+        {
+          "enumerant" : "FlagRValueReference",
+          "value" : "0x1000"
+        },
+        {
+          "enumerant" : "FlagIsOptimized",
+          "value" : "0x2000"
+        }
+      ]
+    },
+    {
+      "category" : "ValueEnum",
+      "kind" : "DebugBaseTypeAttributeEncoding",
+      "enumerants" : [
+        {
+          "enumerant" : "Unspecified",
+          "value" : "0"
+        },
+        {
+          "enumerant" : "Address",
+          "value" : "1"
+        },
+        {
+          "enumerant" : "Boolean",
+          "value" : "2"
+        },
+        {
+          "enumerant" : "Float",
+          "value" : "4"
+        },
+        {
+          "enumerant" : "Signed",
+          "value" : "5"
+        },
+        {
+          "enumerant" : "SignedChar",
+          "value" : "6"
+        },
+        {
+          "enumerant" : "Unsigned",
+          "value" : "7"
+        },
+        {
+          "enumerant" : "UnsignedChar",
+          "value" : "8"
+        }
+      ]
+    },
+    {
+      "category" : "ValueEnum",
+      "kind" : "DebugCompositeType",
+      "enumerants" : [
+        {
+          "enumerant" : "Class",
+          "value" : "0"
+        },
+        {
+          "enumerant" : "Structure",
+          "value" : "1"
+        },
+        {
+          "enumerant" : "Union",
+          "value" : "2"
+        }
+      ]
+    },
+    {
+      "category" : "ValueEnum",
+      "kind" : "DebugTypeQualifier",
+      "enumerants" : [
+        {
+          "enumerant" : "ConstType",
+          "value" : "0"
+        },
+        {
+          "enumerant" : "VolatileType",
+          "value" : "1"
+        },
+        {
+          "enumerant" : "RestrictType",
+          "value" : "2"
+        }
+      ]
+    },
+    {
+      "category" : "ValueEnum",
+      "kind" : "DebugOperation",
+      "enumerants" : [
+        {
+          "enumerant" : "Deref",
+          "value" : "0"
+        },
+        {
+          "enumerant" : "Plus",
+          "value" : "1"
+        },
+        {
+          "enumerant" : "Minus",
+          "value" : "2"
+        },
+        {
+          "enumerant" : "PlusUconst",
+          "value" : "3",
+          "parameters" : [
+             { "kind" : "LiteralInteger" }
+          ]
+        },
+        {
+          "enumerant" : "BitPiece",
+          "value" : "4",
+          "parameters" : [
+             { "kind" : "LiteralInteger" },
+             { "kind" : "LiteralInteger" }
+          ]
+        },
+        {
+          "enumerant" : "Swap",
+          "value" : "5"
+        },
+        {
+          "enumerant" : "Xderef",
+          "value" : "6"
+        },
+        {
+          "enumerant" : "StackValue",
+          "value" : "7"
+        },
+        {
+          "enumerant" : "Constu",
+          "value" : "8",
+          "parameters" : [
+             { "kind" : "LiteralInteger" }
+          ]
+        }
+      ]
+    }
+  ]
+}
diff --git a/include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json b/include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json
new file mode 100644 (file)
index 0000000..08062be
--- /dev/null
@@ -0,0 +1,632 @@
+{
+  "copyright" : [
+    "Copyright (c) 2018 The Khronos Group Inc.",
+    "",
+    "Permission is hereby granted, free of charge, to any person obtaining a copy",
+    "of this software and/or associated documentation files (the \"Materials\"),",
+    "to deal in the Materials without restriction, including without limitation",
+    "the rights to use, copy, modify, merge, publish, distribute, sublicense,",
+    "and/or sell copies of the Materials, and to permit persons to whom the",
+    "Materials are furnished to do so, subject to the following conditions:",
+    "",
+    "The above copyright notice and this permission notice shall be included in",
+    "all copies or substantial portions of the Materials.",
+    "",
+    "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS",
+    "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND",
+    "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ",
+    "",
+    "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS",
+    "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,",
+    "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL",
+    "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER",
+    "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING",
+    "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS",
+    "IN THE MATERIALS."
+  ],
+  "version" : 200,
+  "revision" : 2,
+  "instructions" : [
+    {
+      "opname" : "DebugInfoNone",
+      "opcode" : 0
+    },
+    {
+      "opname" : "DebugCompilationUnit",
+      "opcode" : 1,
+      "operands" : [
+        { "kind" : "LiteralInteger", "name" : "'Version'" },
+        { "kind" : "LiteralInteger", "name" : "'DWARF Version'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "SourceLanguage", "name" : "'Language'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeBasic",
+      "opcode" : 2,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Size'" },
+        { "kind" : "DebugBaseTypeAttributeEncoding", "name" : "'Encoding'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypePointer",
+      "opcode" : 3,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Base Type'" },
+        { "kind" : "StorageClass", "name" : "'Storage Class'" },
+        { "kind" : "DebugInfoFlags", "name" : "'Flags'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeQualifier",
+      "opcode" : 4,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Base Type'" },
+        { "kind" : "DebugTypeQualifier", "name" : "'Type Qualifier'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeArray",
+      "opcode" : 5,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Base Type'" },
+        { "kind" : "IdRef", "name" : "'Component Counts'", "quantifier" : "*" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeVector",
+      "opcode" : 6,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Base Type'" },
+        { "kind" : "LiteralInteger", "name" : "'Component Count'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypedef",
+      "opcode" : 7,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Base Type'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeFunction",
+      "opcode" : 8,
+      "operands" : [
+        { "kind" : "DebugInfoFlags", "name" : "'Flags'" },
+        { "kind" : "IdRef", "name" : "'Return Type'" },
+        { "kind" : "IdRef", "name" : "'Parameter Types'", "quantifier" : "*" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeEnum",
+      "opcode" : 9,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Underlying Type'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" },
+        { "kind" : "IdRef", "name" : "'Size'" },
+        { "kind" : "DebugInfoFlags", "name" : "'Flags'" },
+        { "kind" : "PairIdRefIdRef", "name" : "'Value, Name, Value, Name, ...'", "quantifier" : "*" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeComposite",
+      "opcode" : 10,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "DebugCompositeType", "name" : "'Tag'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" },
+        { "kind" : "IdRef", "name" : "'Linkage Name'" },
+        { "kind" : "IdRef", "name" : "'Size'" },
+        { "kind" : "DebugInfoFlags", "name" : "'Flags'" },
+        { "kind" : "IdRef", "name" : "'Members'", "quantifier" : "*" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeMember",
+      "opcode" : 11,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Type'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" },
+        { "kind" : "IdRef", "name" : "'Offset'" },
+        { "kind" : "IdRef", "name" : "'Size'" },
+        { "kind" : "DebugInfoFlags", "name" : "'Flags'" },
+        { "kind" : "IdRef", "name" : "'Value'", "quantifier" : "?" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeInheritance",
+      "opcode" : 12,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Child'" },
+        { "kind" : "IdRef", "name" : "'Parent'" },
+        { "kind" : "IdRef", "name" : "'Offset'" },
+        { "kind" : "IdRef", "name" : "'Size'" },
+        { "kind" : "DebugInfoFlags", "name" : "'Flags'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypePtrToMember",
+      "opcode" : 13,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Member Type'" },
+        { "kind" : "IdRef", "name" : "'Parent'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeTemplate",
+      "opcode" : 14,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Target'" },
+        { "kind" : "IdRef", "name" : "'Parameters'", "quantifier" : "*" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeTemplateParameter",
+      "opcode" : 15,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Actual Type'" },
+        { "kind" : "IdRef", "name" : "'Value'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeTemplateTemplateParameter",
+      "opcode" : 16,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Template Name'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" }
+      ]
+    },
+    {
+      "opname" : "DebugTypeTemplateParameterPack",
+      "opcode" : 17,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Template Parameters'", "quantifier" : "*" }
+      ]
+    },
+    {
+      "opname" : "DebugGlobalVariable",
+      "opcode" : 18,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Type'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" },
+        { "kind" : "IdRef", "name" : "'Linkage Name'" },
+        { "kind" : "IdRef", "name" : "'Variable'" },
+        { "kind" : "DebugInfoFlags", "name" : "'Flags'" },
+        { "kind" : "IdRef", "name" : "'Static Member Declaration'", "quantifier" : "?" }
+      ]
+    },
+    {
+      "opname" : "DebugFunctionDeclaration",
+      "opcode" : 19,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Type'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" },
+        { "kind" : "IdRef", "name" : "'Linkage Name'" },
+        { "kind" : "DebugInfoFlags", "name" : "'Flags'" }
+      ]
+    },
+    {
+      "opname" : "DebugFunction",
+      "opcode" : 20,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Type'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" },
+        { "kind" : "IdRef", "name" : "'Linkage Name'" },
+        { "kind" : "DebugInfoFlags", "name" : "'Flags'" },
+        { "kind" : "LiteralInteger", "name" : "'Scope Line'" },
+        { "kind" : "IdRef", "name" : "'Function'" },
+        { "kind" : "IdRef", "name" : "'Declaration'", "quantifier" : "?" }
+      ]
+    },
+    {
+      "opname" : "DebugLexicalBlock",
+      "opcode" : 21,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" },
+        { "kind" : "IdRef", "name" : "'Name'", "quantifier" : "?" }
+      ]
+    },
+    {
+      "opname" : "DebugLexicalBlockDiscriminator",
+      "opcode" : 22,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Discriminator'" },
+        { "kind" : "IdRef", "name" : "'Parent'" }
+      ]
+    },
+    {
+      "opname" : "DebugScope",
+      "opcode" : 23,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Scope'" },
+        { "kind" : "IdRef", "name" : "'Inlined At'", "quantifier" : "?" }
+      ]
+    },
+    {
+      "opname" : "DebugNoScope",
+      "opcode" : 24
+    },
+    {
+      "opname" : "DebugInlinedAt",
+      "opcode" : 25,
+      "operands" : [
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "IdRef", "name" : "'Scope'" },
+        { "kind" : "IdRef", "name" : "'Inlined'", "quantifier" : "?" }
+      ]
+    },
+    {
+      "opname" : "DebugLocalVariable",
+      "opcode" : 26,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Type'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" },
+        { "kind" : "DebugInfoFlags", "name" : "'Flags'" },
+        { "kind" : "LiteralInteger", "name" : "'Arg Number'", "quantifier" : "?" }
+      ]
+    },
+    {
+      "opname" : "DebugInlinedVariable",
+      "opcode" : 27,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Variable'" },
+        { "kind" : "IdRef", "name" : "'Inlined'" }
+      ]
+    },
+    {
+      "opname" : "DebugDeclare",
+      "opcode" : 28,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Local Variable'" },
+        { "kind" : "IdRef", "name" : "'Variable'" },
+        { "kind" : "IdRef", "name" : "'Expression'" }
+      ]
+    },
+    {
+      "opname" : "DebugValue",
+      "opcode" : 29,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Local Variable'" },
+        { "kind" : "IdRef", "name" : "'Value'" },
+        { "kind" : "IdRef", "name" : "'Expression'" },
+        { "kind" : "IdRef", "name" : "'Indexes'", "quantifier" : "*" }
+      ]
+    },
+    {
+      "opname" : "DebugOperation",
+      "opcode" : 30,
+      "operands" : [
+        { "kind" : "DebugOperation", "name" : "'OpCode'" },
+        { "kind" : "LiteralInteger", "name" : "'Operands ...'", "quantifier" : "*" }
+      ]
+    },
+    {
+      "opname" : "DebugExpression",
+      "opcode" : 31,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Operands ...'", "quantifier" : "*" }
+      ]
+    },
+    {
+      "opname" : "DebugMacroDef",
+      "opcode" : 32,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "IdRef", "name" : "'Value'", "quantifier" : "?" }
+      ]
+    },
+    {
+      "opname" : "DebugMacroUndef",
+      "opcode" : 33,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "IdRef", "name" : "'Macro'" }
+      ]
+    },
+    {
+      "opname" : "DebugImportedEntity",
+      "opcode" : 34,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'Name'" },
+        { "kind" : "DebugImportedEntity", "name" : "'Tag'" },
+        { "kind" : "IdRef", "name" : "'Source'" },
+        { "kind" : "IdRef", "name" : "'Entity'" },
+        { "kind" : "LiteralInteger", "name" : "'Line'" },
+        { "kind" : "LiteralInteger", "name" : "'Column'" },
+        { "kind" : "IdRef", "name" : "'Parent'" }
+      ]
+    },
+    {
+      "opname" : "DebugSource",
+      "opcode" : 35,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'File'" },
+        { "kind" : "IdRef", "name" : "'Text'", "quantifier" : "?" }
+      ]
+    }
+  ],
+  "operand_kinds" : [
+    {
+      "category" : "BitEnum",
+      "kind" : "DebugInfoFlags",
+      "enumerants" : [
+        {
+          "enumerant" : "FlagIsProtected",
+          "value" : "0x01"
+        },
+        {
+          "enumerant" : "FlagIsPrivate",
+          "value" : "0x02"
+        },
+        {
+          "enumerant" : "FlagIsPublic",
+          "value" : "0x03"
+        },
+        {
+          "enumerant" : "FlagIsLocal",
+          "value" : "0x04"
+        },
+        {
+          "enumerant" : "FlagIsDefinition",
+          "value" : "0x08"
+        },
+        {
+          "enumerant" : "FlagFwdDecl",
+          "value" : "0x10"
+        },
+        {
+          "enumerant" : "FlagArtificial",
+          "value" : "0x20"
+        },
+        {
+          "enumerant" : "FlagExplicit",
+          "value" : "0x40"
+        },
+        {
+          "enumerant" : "FlagPrototyped",
+          "value" : "0x80"
+        },
+        {
+          "enumerant" : "FlagObjectPointer",
+          "value" : "0x100"
+        },
+        {
+          "enumerant" : "FlagStaticMember",
+          "value" : "0x200"
+        },
+        {
+          "enumerant" : "FlagIndirectVariable",
+          "value" : "0x400"
+        },
+        {
+          "enumerant" : "FlagLValueReference",
+          "value" : "0x800"
+        },
+        {
+          "enumerant" : "FlagRValueReference",
+          "value" : "0x1000"
+        },
+        {
+          "enumerant" : "FlagIsOptimized",
+          "value" : "0x2000"
+        },
+        {
+          "enumerant" : "FlagIsEnumClass",
+          "value" : "0x4000"
+        },
+        {
+          "enumerant" : "FlagTypePassByValue",
+          "value" : "0x8000"
+        },
+        {
+          "enumerant" : "FlagTypePassByReference",
+          "value" : "0x10000"
+        }
+      ]
+    },
+    {
+      "category" : "ValueEnum",
+      "kind" : "DebugBaseTypeAttributeEncoding",
+      "enumerants" : [
+        {
+          "enumerant" : "Unspecified",
+          "value" : "0"
+        },
+        {
+          "enumerant" : "Address",
+          "value" : "1"
+        },
+        {
+          "enumerant" : "Boolean",
+          "value" : "2"
+        },
+        {
+          "enumerant" : "Float",
+          "value" : "3"
+        },
+        {
+          "enumerant" : "Signed",
+          "value" : "4"
+        },
+        {
+          "enumerant" : "SignedChar",
+          "value" : "5"
+        },
+        {
+          "enumerant" : "Unsigned",
+          "value" : "6"
+        },
+        {
+          "enumerant" : "UnsignedChar",
+          "value" : "7"
+        }
+      ]
+    },
+    {
+      "category" : "ValueEnum",
+      "kind" : "DebugCompositeType",
+      "enumerants" : [
+        {
+          "enumerant" : "Class",
+          "value" : "0"
+        },
+        {
+          "enumerant" : "Structure",
+          "value" : "1"
+        },
+        {
+          "enumerant" : "Union",
+          "value" : "2"
+        }
+      ]
+    },
+    {
+      "category" : "ValueEnum",
+      "kind" : "DebugTypeQualifier",
+      "enumerants" : [
+        {
+          "enumerant" : "ConstType",
+          "value" : "0"
+        },
+        {
+          "enumerant" : "VolatileType",
+          "value" : "1"
+        },
+        {
+          "enumerant" : "RestrictType",
+          "value" : "2"
+        },
+        {
+          "enumerant" : "AtomicType",
+          "value" : "3"
+        }
+      ]
+    },
+    {
+      "category" : "ValueEnum",
+      "kind" : "DebugOperation",
+      "enumerants" : [
+        {
+          "enumerant" : "Deref",
+          "value" : "0"
+        },
+        {
+          "enumerant" : "Plus",
+          "value" : "1"
+        },
+        {
+          "enumerant" : "Minus",
+          "value" : "2"
+        },
+        {
+          "enumerant" : "PlusUconst",
+          "value" : "3",
+          "parameters" : [
+             { "kind" : "LiteralInteger" }
+          ]
+        },
+        {
+          "enumerant" : "BitPiece",
+          "value" : "4",
+          "parameters" : [
+             { "kind" : "LiteralInteger" },
+             { "kind" : "LiteralInteger" }
+          ]
+        },
+        {
+          "enumerant" : "Swap",
+          "value" : "5"
+        },
+        {
+          "enumerant" : "Xderef",
+          "value" : "6"
+        },
+        {
+          "enumerant" : "StackValue",
+          "value" : "7"
+        },
+        {
+          "enumerant" : "Constu",
+          "value" : "8",
+          "parameters" : [
+             { "kind" : "LiteralInteger" }
+          ]
+        },
+        {
+          "enumerant" : "Fragment",
+          "value" : "9",
+          "parameters" : [
+             { "kind" : "LiteralInteger" },
+             { "kind" : "LiteralInteger" }
+          ]
+        }
+      ]
+    },
+    {
+      "category" : "ValueEnum",
+      "kind" : "DebugImportedEntity",
+      "enumerants" : [
+        {
+          "enumerant" : "ImportedModule",
+          "value" : "0"
+        },
+        {
+          "enumerant" : "ImportedDeclaration",
+          "value" : "1"
+       }
+      ]
+    }
+  ]
+}
diff --git a/include/spirv/unified1/extinst.spv-amd-gcn-shader.grammar.json b/include/spirv/unified1/extinst.spv-amd-gcn-shader.grammar.json
new file mode 100644 (file)
index 0000000..e18251b
--- /dev/null
@@ -0,0 +1,26 @@
+{
+  "revision" : 2,
+  "instructions" : [
+    {
+      "opname" : "CubeFaceIndexAMD",
+      "opcode" : 1,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'P'" }
+      ],
+      "extensions" : [ "SPV_AMD_gcn_shader" ]
+    },
+    {
+      "opname" : "CubeFaceCoordAMD",
+      "opcode" : 2,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'P'" }
+      ],
+      "extensions" : [ "SPV_AMD_gcn_shader" ]
+    },
+    {
+      "opname" : "TimeAMD",
+      "opcode" : 3,
+      "extensions" : [ "SPV_AMD_gcn_shader" ]
+    }
+  ]
+}
diff --git a/include/spirv/unified1/extinst.spv-amd-shader-ballot.grammar.json b/include/spirv/unified1/extinst.spv-amd-shader-ballot.grammar.json
new file mode 100644 (file)
index 0000000..62a470e
--- /dev/null
@@ -0,0 +1,41 @@
+{
+  "revision" : 5,
+  "instructions" : [
+    {
+      "opname" : "SwizzleInvocationsAMD",
+      "opcode" : 1,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'data'" },
+        { "kind" : "IdRef", "name" : "'offset'" }
+      ],
+      "extensions" : [ "SPV_AMD_shader_ballot" ]
+    },
+    {
+      "opname" : "SwizzleInvocationsMaskedAMD",
+      "opcode" : 2,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'data'" },
+        { "kind" : "IdRef", "name" : "'mask'" }
+      ],
+      "extensions" : [ "SPV_AMD_shader_ballot" ]
+    },
+    {
+      "opname" : "WriteInvocationAMD",
+      "opcode" : 3,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'inputValue'" },
+        { "kind" : "IdRef", "name" : "'writeValue'" },
+        { "kind" : "IdRef", "name" : "'invocationIndex'" }
+      ],
+      "extensions" : [ "SPV_AMD_shader_ballot" ]
+    },
+    {
+      "opname" : "MbcntAMD",
+      "opcode" : 4,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'mask'" }
+      ],
+      "extensions" : [ "SPV_AMD_shader_ballot" ]
+    }
+  ]
+}
diff --git a/include/spirv/unified1/extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json b/include/spirv/unified1/extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json
new file mode 100644 (file)
index 0000000..e156b1b
--- /dev/null
@@ -0,0 +1,14 @@
+{
+  "revision" : 4,
+  "instructions" : [
+    {
+      "opname" : "InterpolateAtVertexAMD",
+      "opcode" : 1,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'interpolant'" },
+        { "kind" : "IdRef", "name" : "'vertexIdx'" }
+      ],
+      "extensions" : [ "SPV_AMD_shader_explicit_vertex_parameter" ]
+    }
+  ]
+}
diff --git a/include/spirv/unified1/extinst.spv-amd-shader-trinary-minmax.grammar.json b/include/spirv/unified1/extinst.spv-amd-shader-trinary-minmax.grammar.json
new file mode 100644 (file)
index 0000000..c681976
--- /dev/null
@@ -0,0 +1,95 @@
+{
+  "revision" : 4,
+  "instructions" : [
+    {
+      "opname" : "FMin3AMD",
+      "opcode" : 1,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'x'" },
+        { "kind" : "IdRef", "name" : "'y'" },
+        { "kind" : "IdRef", "name" : "'z'" }
+      ],
+      "extensions" : [ "SPV_AMD_shader_trinary_minmax" ]
+    },
+    {
+      "opname" : "UMin3AMD",
+      "opcode" : 2,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'x'" },
+        { "kind" : "IdRef", "name" : "'y'" },
+        { "kind" : "IdRef", "name" : "'z'" }
+      ],
+      "extensions" : [ "SPV_AMD_shader_trinary_minmax" ]
+    },
+    {
+      "opname" : "SMin3AMD",
+      "opcode" : 3,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'x'" },
+        { "kind" : "IdRef", "name" : "'y'" },
+        { "kind" : "IdRef", "name" : "'z'" }
+      ],
+      "extensions" : [ "SPV_AMD_shader_trinary_minmax" ]
+    },
+    {
+      "opname" : "FMax3AMD",
+      "opcode" : 4,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'x'" },
+        { "kind" : "IdRef", "name" : "'y'" },
+        { "kind" : "IdRef", "name" : "'z'" }
+      ],
+      "extensions" : [ "SPV_AMD_shader_trinary_minmax" ]
+    },
+    {
+      "opname" : "UMax3AMD",
+      "opcode" : 5,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'x'" },
+        { "kind" : "IdRef", "name" : "'y'" },
+        { "kind" : "IdRef", "name" : "'z'" }
+      ],
+      "extensions" : [ "SPV_AMD_shader_trinary_minmax" ]
+    },
+    {
+      "opname" : "SMax3AMD",
+      "opcode" : 6,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'x'" },
+        { "kind" : "IdRef", "name" : "'y'" },
+        { "kind" : "IdRef", "name" : "'z'" }
+      ],
+      "extensions" : [ "SPV_AMD_shader_trinary_minmax" ]
+    },
+    {
+      "opname" : "FMid3AMD",
+      "opcode" : 7,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'x'" },
+        { "kind" : "IdRef", "name" : "'y'" },
+        { "kind" : "IdRef", "name" : "'z'" }
+      ],
+      "extensions" : [ "SPV_AMD_shader_trinary_minmax" ]
+    },
+    {
+      "opname" : "UMid3AMD",
+      "opcode" : 8,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'x'" },
+        { "kind" : "IdRef", "name" : "'y'" },
+        { "kind" : "IdRef", "name" : "'z'" }
+      ],
+      "extensions" : [ "SPV_AMD_shader_trinary_minmax" ]
+    },
+    {
+      "opname" : "SMid3AMD",
+      "opcode" : 9,
+      "operands" : [
+        { "kind" : "IdRef", "name" : "'x'" },
+        { "kind" : "IdRef", "name" : "'y'" },
+        { "kind" : "IdRef", "name" : "'z'" }
+      ],
+      "extensions" : [ "SPV_AMD_shader_trinary_minmax" ]
+    }
+  ]
+}
diff --git a/tools/buildHeaders/bin/generate_language_headers.py b/tools/buildHeaders/bin/generate_language_headers.py
new file mode 100755 (executable)
index 0000000..f43e52d
--- /dev/null
@@ -0,0 +1,242 @@
+#!/usr/bin/env python3
+# Copyright (c) 2017-2020 Google LLC
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and/or associated documentation files (the
+# "Materials"), to deal in the Materials without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Materials, and to
+# permit persons to whom the Materials are furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Materials.
+#
+# MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
+# KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
+# SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
+#    https://www.khronos.org/registry/
+#
+# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+
+"""Generates a C language headers from a SPIR-V JSON grammar file"""
+
+import errno
+import json
+import os.path
+import re
+
+DEFAULT_COPYRIGHT="""Copyright (c) 2020 The Khronos Group Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and/or associated documentation files (the
+"Materials"), to deal in the Materials without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Materials, and to
+permit persons to whom the Materials are furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Materials.
+
+MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
+KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
+SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
+   https://www.khronos.org/registry/
+
+THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+""".split('\n')
+
+def make_path_to_file(f):
+    """Makes all ancestor directories to the given file, if they
+    don't yet exist.
+
+    Arguments:
+        f: The file whose ancestor directories are to be created.
+    """
+    dir = os.path.dirname(os.path.abspath(f))
+    try:
+        os.makedirs(dir)
+    except OSError as e:
+        if e.errno == errno.EEXIST and os.path.isdir(dir):
+            pass
+        else:
+            raise
+
+class ExtInstGrammar:
+    """The grammar for an extended instruction set"""
+
+    def __init__(self, name, copyright, instructions, operand_kinds, version = None, revision = None):
+       self.name = name
+       self.copyright = copyright
+       self.instructions = instructions
+       self.operand_kinds = operand_kinds
+       self.version = version
+       self.revision = revision
+
+
+class LangGenerator:
+    """A language-specific generator"""
+
+    def __init__(self):
+        self.upper_case_initial = re.compile('^[A-Z]')
+        pass
+
+    def comment_prefix(self):
+        return ""
+
+    def namespace_prefix(self):
+        return ""
+
+    def uses_guards(self):
+        return False
+
+    def cpp_guard_preamble(self):
+        return ""
+
+    def cpp_guard_postamble(self):
+        return ""
+
+    def enum_value(self, prefix, name, value):
+        if self.upper_case_initial.match(name):
+            use_name = name
+        else:
+            use_name = '_' + name
+
+        return "    {}{} = {},".format(prefix, use_name, value)
+
+    def generate(self, grammar):
+        """Returns a string that is the language-specific header for the given grammar"""
+
+        parts = []
+        if grammar.copyright:
+            parts.extend(["{}{}".format(self.comment_prefix(), f) for f in grammar.copyright])
+        parts.append('')
+
+        guard = 'SPIRV_UNIFIED1_{}_H_'.format(grammar.name)
+        if self.uses_guards:
+            parts.append('#ifndef {}'.format(guard))
+            parts.append('#define {}'.format(guard))
+        parts.append('')
+
+        parts.append(self.cpp_guard_preamble())
+
+        if grammar.version:
+            parts.append(self.const_definition(grammar.name, 'Version', grammar.version))
+
+        if grammar.revision is not None:
+            parts.append(self.const_definition(grammar.name, 'Revision', grammar.revision))
+
+        parts.append('')
+
+        if grammar.instructions:
+            parts.append(self.enum_prefix(grammar.name, 'Instructions'))
+            for inst in grammar.instructions:
+                parts.append(self.enum_value(grammar.name, inst['opname'], inst['opcode']))
+            parts.append(self.enum_end(grammar.name, 'Instructions'))
+            parts.append('')
+
+        if grammar.operand_kinds:
+            for kind in grammar.operand_kinds:
+                parts.append(self.enum_prefix(grammar.name, kind['kind']))
+                for e in kind['enumerants']:
+                    parts.append(self.enum_value(grammar.name, e['enumerant'], e['value']))
+                parts.append(self.enum_end(grammar.name, kind['kind']))
+            parts.append('')
+
+        parts.append(self.cpp_guard_postamble())
+
+        if self.uses_guards:
+            parts.append('#endif // {}'.format(guard))
+
+        # Ensre the file ends in an end of line
+        parts.append('')
+
+        return '\n'.join(parts)
+
+
+class CLikeGenerator(LangGenerator):
+    def uses_guards(self):
+        return True
+
+    def comment_prefix(self):
+        return "// "
+
+    def const_definition(self, prefix, var, value):
+        # Use an anonymous enum.  Don't use a static const int variable because
+        # that can bloat binary size.
+        return 'enum {0}{1}{2}{3} = {4},{1}{2}{3}_BitWidthPadding = 0x7fffffff{5};'.format(
+               '{', '\n    ', prefix, var, value, '\n}')
+
+    def enum_prefix(self, prefix, name):
+        return 'enum {}{} {}'.format(prefix, name, '{')
+
+    def enum_end(self, prefix, enum):
+        return '    {}{}Max = 0x7ffffff\n{};\n'.format(prefix, enum, '}')
+
+    def cpp_guard_preamble(self):
+        return '#ifdef __cplusplus\nextern "C" {\n#endif\n'
+
+    def cpp_guard_postamble(self):
+        return '#ifdef __cplusplus\n}\n#endif\n'
+
+
+class CGenerator(CLikeGenerator):
+    pass
+
+
+def main():
+    import argparse
+    parser = argparse.ArgumentParser(description='Generate language headers from a JSON grammar')
+
+    parser.add_argument('--extinst-name',
+                        type=str, required=True,
+                        help='The name to use in tokens')
+    parser.add_argument('--extinst-grammar', metavar='<path>',
+                        type=str, required=True,
+                        help='input JSON grammar file for extended instruction set')
+    parser.add_argument('--extinst-output-base', metavar='<path>',
+                        type=str, required=True,
+                        help='Basename of the language-specific output file.')
+    args = parser.parse_args()
+
+    with open(args.extinst_grammar) as json_file:
+        grammar_json = json.loads(json_file.read())
+        if 'copyright' in grammar_json:
+          copyright = grammar_json['copyright']
+        else:
+          copyright = DEFAULT_COPYRIGHT
+        if 'version' in grammar_json:
+          version = grammar_json['version']
+        else:
+          version = 0
+        if 'operand_kinds' in grammar_json:
+          operand_kinds = grammar_json['operand_kinds']
+        else:
+          operand_kinds = []
+
+        grammar = ExtInstGrammar(name = args.extinst_name,
+                                 copyright = copyright,
+                                 instructions = grammar_json['instructions'],
+                                 operand_kinds = operand_kinds,
+                                 version = version,
+                                 revision = grammar_json['revision'])
+        make_path_to_file(args.extinst_output_base)
+        with open(args.extinst_output_base + '.h', 'w') as f:
+            f.write(CGenerator().generate(grammar))
+
+
+if __name__ == '__main__':
+    main()
diff --git a/tools/buildHeaders/bin/makeExtinstHeaders.py b/tools/buildHeaders/bin/makeExtinstHeaders.py
new file mode 100755 (executable)
index 0000000..3c2ebd9
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+"""Generate C headers for certain extended instruction sets"""
+
+import subprocess
+import os
+
+# Assume we are running from the tools/buildHeaders directory
+os.chdir('../../include/spirv/unified1')
+
+def mk_extinst(name, grammar_file):
+  """Generate one C header from a grammar"""
+  script = '../../../tools/buildHeaders/bin/generate_language_headers.py'
+  subprocess.check_call(['python3',
+                         script,
+                         '--extinst-name=' + name,
+                         '--extinst-grammar=' + grammar_file,
+                         '--extinst-output-base=' + name])
+  subprocess.check_call(['dos2unix', name + '.h'])
+
+
+mk_extinst('DebugInfo', 'extinst.debuginfo.grammar.json')
+mk_extinst('OpenCLDebugInfo100', 'extinst.opencl.debuginfo.100.grammar.json')
+mk_extinst('AMD_gcn_shader', 'extinst.spv-amd-gcn-shader.grammar.json')
+mk_extinst('AMD_shader_ballot', 'extinst.spv-amd-shader-ballot.grammar.json')
+mk_extinst('AMD_shader_explicit_vertex_parameter', 'extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json')
+mk_extinst('AMD_shader_trinary_minmax', 'extinst.spv-amd-shader-trinary-minmax.grammar.json')
index 47d2218..0ca0b2f 100755 (executable)
@@ -1,5 +1,7 @@
 #!/usr/bin/env bash
 
+python3 bin/makeExtinstHeaders.py
+
 cd ../../include/spirv/unified1
 ../../../tools/buildHeaders/build/install/bin/buildSpvHeaders -H spirv.core.grammar.json
 dos2unix spirv.* SpirV.* spv.*