@@ -199,44 +199,49 @@ SPVTOOLS_OPT_SRC_FILES := \
199199 source/opt/wrap_opkill.cpp
200200
201201# Locations of grammar files.
202- #
203- SPV_COREUNIFIED1_GRAMMAR =$(SPVHEADERS_LOCAL_PATH ) /include/spirv/unified1/spirv.core.grammar.json
204- SPV_DEBUGINFO_GRAMMAR =$(SPVHEADERS_LOCAL_PATH ) /include/spirv/unified1/extinst.debuginfo.grammar.json
205- SPV_CLDEBUGINFO100_GRAMMAR =$(SPVHEADERS_LOCAL_PATH ) /include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json
206- SPV_VKDEBUGINFO100_GRAMMAR =$(SPVHEADERS_LOCAL_PATH ) /include/spirv/unified1/extinst.nonsemantic.shader.debuginfo.100.grammar.json
202+ GRAMMAR_DIR =$(SPVHEADERS_LOCAL_PATH ) /include/spirv/unified1
207203
208204define gen_spvtools_grammar_tables
205+ # $1 is the output directory, which is unique per ABI.
206+ # Rules for creating grammar tables. They are statically compiled
207+ # into the SPIRV-Tools code.
209208$(call generate-file-dir,$(1 ) /core_tables_body.inc)
210209$(1 ) /core_tables_body.inc \
211210$(1 ) /core_tables_header.inc \
212211: \
213- $(LOCAL_PATH ) /utils/generate_grammar_tables.py \
214- $(SPV_COREUNIFIED1_GRAMMAR ) \
215- $(SPV_DEBUGINFO_GRAMMAR ) \
216- $(SPV_CLDEBUGINFO100_GRAMMAR )
217- @$(HOST_PYTHON ) $(LOCAL_PATH ) /utils/ggt.py \
218- --spirv-core-grammar=$(SPV_COREUNIFIED1_GRAMMAR ) \
219- --extinst-debuginfo-grammar=$(SPV_DEBUGINFO_GRAMMAR ) \
220- --extinst-cldebuginfo100-grammar=$(SPV_CLDEBUGINFO100_GRAMMAR ) \
221- --core-tables-body-output=$(1 ) /core_tables_body.inc \
222- --core-tables-header-output=$(1 ) /core_tables_header.inc
223- @echo "[$(TARGET_ARCH_ABI ) ] Grammar from unified1) : instructions & operands <= grammar JSON files"
212+ $(LOCAL_PATH ) /utils/ggt.py \
213+ $(GRAMMAR_DIR ) /extinst.debuginfo.grammar.json \
214+ $(GRAMMAR_DIR ) /extinst.glsl.std.450.grammar.json \
215+ $(GRAMMAR_DIR ) /extinst.nonsemantic.clspvreflection.grammar.json \
216+ $(GRAMMAR_DIR ) /extinst.nonsemantic.shader.debuginfo.100.grammar.json \
217+ $(GRAMMAR_DIR ) /extinst.nonsemantic.vkspreflection.grammar.json \
218+ $(GRAMMAR_DIR ) /extinst.opencl.debuginfo.100.grammar.json \
219+ $(GRAMMAR_DIR ) /extinst.opencl.std.100.grammar.json \
220+ $(GRAMMAR_DIR ) /extinst.spv-amd-gcn-shader.grammar.json \
221+ $(GRAMMAR_DIR ) /extinst.spv-amd-shader-ballot.grammar.json \
222+ $(GRAMMAR_DIR ) /extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json \
223+ $(GRAMMAR_DIR ) /extinst.spv-amd-shader-trinary-minmax.grammar.json \
224+ $(GRAMMAR_DIR ) /spirv.core.grammar.json
225+ @$(HOST_PYTHON ) $(LOCAL_PATH ) /utils/ggt.py \
226+ --core-tables-body-output=$(1 ) /core_tables_body.inc \
227+ --core-tables-header-output=$(1 ) /core_tables_header.inc \
228+ --spirv-core-grammar=$(GRAMMAR_DIR ) /spirv.core.grammar.json \
229+ --extinst=,$(GRAMMAR_DIR ) /extinst.debuginfo.grammar.json \
230+ --extinst=,$(GRAMMAR_DIR ) /extinst.glsl.std.450.grammar.json \
231+ --extinst=,$(GRAMMAR_DIR ) /extinst.nonsemantic.clspvreflection.grammar.json \
232+ --extinst=SHDEBUG100_,$(GRAMMAR_DIR ) /extinst.nonsemantic.shader.debuginfo.100.grammar.json \
233+ --extinst=,$(GRAMMAR_DIR ) /extinst.nonsemantic.vkspreflection.grammar.json \
234+ --extinst=CLDEBUG100_,$(GRAMMAR_DIR ) /extinst.opencl.debuginfo.100.grammar.json \
235+ --extinst=,$(GRAMMAR_DIR ) /extinst.opencl.std.100.grammar.json \
236+ --extinst=,$(GRAMMAR_DIR ) /extinst.spv-amd-gcn-shader.grammar.json \
237+ --extinst=,$(GRAMMAR_DIR ) /extinst.spv-amd-shader-ballot.grammar.json \
238+ --extinst=,$(GRAMMAR_DIR ) /extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json \
239+ --extinst=,$(GRAMMAR_DIR ) /extinst.spv-amd-shader-trinary-minmax.grammar.json
240+ @echo "[$(TARGET_ARCH_ABI ) ] Grammar tables <= grammar JSON files"
224241# Make all source files depend on the generated core tables
225242$(foreach F,$(SPVTOOLS_SRC_FILES ) $(SPVTOOLS_OPT_SRC_FILES ) ,$(LOCAL_PATH ) /$F ) \
226243 : $(1 ) /core_tables_body.inc \
227244 $(1 ) /core_tables_header.inc
228- $(LOCAL_PATH ) /source/ext_inst.cpp: \
229- $(1 ) /glsl.std.450.insts.inc \
230- $(1 ) /opencl.std.100.insts.inc \
231- $(1 ) /debuginfo.insts.inc \
232- $(1 ) /opencl.debuginfo.100.insts.inc \
233- $(1 ) /nonsemantic.shader.debuginfo.100.insts.inc \
234- $(1 ) /spv-amd-gcn-shader.insts.inc \
235- $(1 ) /spv-amd-shader-ballot.insts.inc \
236- $(1 ) /spv-amd-shader-explicit-vertex-parameter.insts.inc \
237- $(1 ) /spv-amd-shader-trinary-minmax.insts.inc
238- $(LOCAL_PATH ) /source/opt/amd_ext_to_khr.cpp: \
239- $(1 ) /spv-amd-shader-ballot.insts.inc
240245endef
241246$(eval $(call gen_spvtools_grammar_tables,$(SPVTOOLS_OUT_PATH)))
242247
@@ -257,36 +262,13 @@ $(1)/$(2).h : \
257262$(foreach F,$(SPVTOOLS_SRC_FILES ) $(SPVTOOLS_OPT_SRC_FILES ) ,$(LOCAL_PATH ) /$F ) \
258263 : $(1 ) /$(2 ) .h
259264endef
260- # We generate language-specific headers for DebugInfo and OpenCL.DebugInfo.100
261- $(eval $(call gen_spvtools_lang_headers,$(SPVTOOLS_OUT_PATH),DebugInfo,$(SPV_DEBUGINFO_GRAMMAR)))
262- $(eval $(call gen_spvtools_lang_headers,$(SPVTOOLS_OUT_PATH),OpenCLDebugInfo100,$(SPV_CLDEBUGINFO100_GRAMMAR)))
263- $(eval $(call gen_spvtools_lang_headers,$(SPVTOOLS_OUT_PATH),NonSemanticShaderDebugInfo100,$(SPV_VKDEBUGINFO100_GRAMMAR)))
264265
265266
266- define gen_spvtools_vendor_tables
267- $(call generate-file-dir,$(1 ) /$(2 ) .insts.inc)
268- $(1 ) /$(2 ) .insts.inc : \
269- $(LOCAL_PATH ) /utils/generate_grammar_tables.py \
270- $(SPVHEADERS_LOCAL_PATH ) /include/spirv/unified1/extinst.$(2 ) .grammar.json
271- @$(HOST_PYTHON ) $(LOCAL_PATH ) /utils/generate_grammar_tables.py \
272- --extinst-vendor-grammar=$(SPVHEADERS_LOCAL_PATH ) /include/spirv/unified1/extinst.$(2 ) .grammar.json \
273- --vendor-insts-output=$(1 ) /$(2 ) .insts.inc \
274- --vendor-operand-kind-prefix=$(3 )
275- @echo "[$(TARGET_ARCH_ABI ) ] Extended instruction set: $(2 ) tables <= grammar"
276- $(LOCAL_PATH ) /source/ext_inst.cpp: $(1 ) /$(2 ) .insts.inc
277- endef
278- # Vendor and debug extended instruction sets, with grammars from SPIRV-Headers source tree.
279- $(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),glsl.std.450,""))
280- $(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),opencl.std.100,""))
281- $(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),debuginfo,""))
282- $(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),opencl.debuginfo.100,"CLDEBUG100_"))
283- $(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),nonsemantic.shader.debuginfo.100,"SHDEBUG100_"))
284- $(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),spv-amd-gcn-shader,""))
285- $(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),spv-amd-shader-ballot,""))
286- $(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),spv-amd-shader-explicit-vertex-parameter,""))
287- $(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),spv-amd-shader-trinary-minmax,""))
288- $(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),nonsemantic.clspvreflection,""))
289- $(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),nonsemantic.vkspreflection,""))
267+ # Generate C++ headers for some extended instruction sets.
268+ $(eval $(call gen_spvtools_lang_headers,$(SPVTOOLS_OUT_PATH),DebugInfo,$(GRAMMAR_DIR)/extinst.debuginfo.grammar.json))
269+ $(eval $(call gen_spvtools_lang_headers,$(SPVTOOLS_OUT_PATH),OpenCLDebugInfo100,$(GRAMMAR_DIR)/extinst.opencl.debuginfo.100.grammar.json))
270+ $(eval $(call gen_spvtools_lang_headers,$(SPVTOOLS_OUT_PATH),NonSemanticShaderDebugInfo100,$(GRAMMAR_DIR)/extinst.nonsemantic.shader.debuginfo.100.grammar.json))
271+
290272
291273define gen_spvtools_build_version_inc
292274$(call generate-file-dir,$(1 ) /dummy_filename)
0 commit comments