Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ SPVTOOLS_SRC_FILES := \
source/diagnostic.cpp \
source/disassemble.cpp \
source/ext_inst.cpp \
source/enum_string_mapping.cpp \
source/extensions.cpp \
source/libspirv.cpp \
source/name_mapper.cpp \
Expand Down Expand Up @@ -289,26 +288,6 @@ $(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),spv-amd-shader-tri
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),nonsemantic.clspvreflection,""))
$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),nonsemantic.vkspreflection,""))

define gen_spvtools_enum_string_mapping
$(call generate-file-dir,$(1)/extension_enum.inc.inc)
$(1)/extension_enum.inc $(1)/enum_string_mapping.inc: \
$(LOCAL_PATH)/utils/generate_grammar_tables.py \
$(SPV_COREUNIFIED1_GRAMMAR)
@$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_grammar_tables.py \
--spirv-core-grammar=$(SPV_COREUNIFIED1_GRAMMAR) \
--extinst-debuginfo-grammar=$(SPV_DEBUGINFO_GRAMMAR) \
--extinst-cldebuginfo100-grammar=$(SPV_CLDEBUGINFO100_GRAMMAR) \
--extension-enum-output=$(1)/extension_enum.inc \
--enum-string-mapping-output=$(1)/enum_string_mapping.inc
@echo "[$(TARGET_ARCH_ABI)] Generate enum<->string mapping <= grammar JSON files"
# Generated header extension_enum.inc is transitively included by table.h, which is
# used pervasively. Capture the pervasive dependency.
$(foreach F,$(SPVTOOLS_SRC_FILES) $(SPVTOOLS_OPT_SRC_FILES),$(LOCAL_PATH)/$F ) \
: $(1)/extension_enum.inc
$(LOCAL_PATH)/source/enum_string_mapping.cpp: $(1)/enum_string_mapping.inc
endef
$(eval $(call gen_spvtools_enum_string_mapping,$(SPVTOOLS_OUT_PATH)))

define gen_spvtools_build_version_inc
$(call generate-file-dir,$(1)/dummy_filename)
$(1)/build-version.inc: \
Expand Down
4 changes: 0 additions & 4 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ load(
"SHDEBUGINFO100_GRAMMAR_JSON_FILE",
"TEST_COPTS",
"generate_compressed_tables",
"generate_enum_string_mapping",
"generate_extinst_lang_headers",
"generate_vendor_tables",
"incompatible_with",
Expand Down Expand Up @@ -57,8 +56,6 @@ py_binary(

generate_compressed_tables()

generate_enum_string_mapping(version = "unified1")

generate_vendor_tables(
extension = "glsl.std.450",
target = "spirv_glsl_grammar_unified1"
Expand Down Expand Up @@ -162,7 +159,6 @@ cc_library(
]) + [
":build_version_inc",
":gen_compressed_tables",
":gen_enum_string_mapping",
":gen_extinst_lang_headers_DebugInfo",
":gen_extinst_lang_headers_NonSemanticShaderDebugInfo100",
":gen_extinst_lang_headers_OpenCLDebugInfo100",
Expand Down
47 changes: 0 additions & 47 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -68,47 +68,6 @@ action("spvtools_core_tables") {
]
}

template("spvtools_core_enums") {
assert(defined(invoker.version), "Need version in $target_name generation.")

action("spvtools_core_enums_" + target_name) {
script = "utils/generate_grammar_tables.py"

version = invoker.version

core_json_file =
"${spirv_headers}/include/spirv/$version/spirv.core.grammar.json"
debuginfo_insts_file =
"${spirv_headers}/include/spirv/unified1/extinst.debuginfo.grammar.json"
cldebuginfo100_insts_file = "${spirv_headers}/include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json"

extension_enum_file = "${target_gen_dir}/extension_enum.inc"
extension_map_file = "${target_gen_dir}/enum_string_mapping.inc"

args = [
"--spirv-core-grammar",
rebase_path(core_json_file, root_build_dir),
"--extinst-debuginfo-grammar",
rebase_path(debuginfo_insts_file, root_build_dir),
"--extinst-cldebuginfo100-grammar",
rebase_path(cldebuginfo100_insts_file, root_build_dir),
"--extension-enum-output",
rebase_path(extension_enum_file, root_build_dir),
"--enum-string-mapping-output",
rebase_path(extension_map_file, root_build_dir)
]
inputs = [
core_json_file,
debuginfo_insts_file,
cldebuginfo100_insts_file,
]
outputs = [
extension_enum_file,
extension_map_file,
]
}
}

template("spvtools_language_header") {
assert(defined(invoker.name), "Need name in $target_name generation.")

Expand Down Expand Up @@ -183,9 +142,6 @@ action("spvtools_build_version") {
]
}

spvtools_core_enums("unified1") {
version = "unified1"
}
spvtools_language_header("debuginfo") {
name = "DebugInfo"
grammar_file =
Expand Down Expand Up @@ -340,8 +296,6 @@ static_library("spvtools") {
"source/disassemble.cpp",
"source/disassemble.h",
"source/enum_set.h",
"source/enum_string_mapping.cpp",
"source/enum_string_mapping.h",
"source/ext_inst.cpp",
"source/ext_inst.h",
"source/extensions.cpp",
Expand Down Expand Up @@ -404,7 +358,6 @@ static_library("spvtools") {
]

public_deps = [
":spvtools_core_enums_unified1",
":spvtools_headers",
"${spirv_headers}:spv_headers",
]
Expand Down
34 changes: 0 additions & 34 deletions build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -124,40 +124,6 @@ def generate_compressed_tables():
visibility = ["//visibility:private"],
)

def generate_enum_string_mapping(version):
if not version:
fail("Must specify version", "version")

grammars = dict(
core_grammar = "@spirv_headers//:spirv_core_grammar_{}".format(version),
debuginfo_grammar = DEBUGINFO_GRAMMAR_JSON_FILE,
cldebuginfo_grammar = CLDEBUGINFO100_GRAMMAR_JSON_FILE,
)

outs = dict(
extension_enum_ouput = "extension_enum.inc",
enum_string_mapping_output = "enum_string_mapping.inc",
)

cmd = (
"$(location :generate_grammar_tables)" +
" --spirv-core-grammar=$(location {core_grammar})" +
" --extinst-debuginfo-grammar=$(location {debuginfo_grammar})" +
" --extinst-cldebuginfo100-grammar=$(location {cldebuginfo_grammar})" +
" --extension-enum-output=$(location {extension_enum_ouput})" +
" --enum-string-mapping-output=$(location {enum_string_mapping_output})"
).format(**_merge_dicts([grammars, outs]))

native.genrule(
name = "gen_enum_string_mapping",
srcs = grammars.values(),
outs = outs.values(),
cmd = cmd,
cmd_bat = cmd,
tools = [":generate_grammar_tables"],
visibility = ["//visibility:private"],
)

def generate_vendor_tables(extension, target = "", operand_kind_prefix = ""):
if not extension:
fail("Must specify extension", "extension")
Expand Down
37 changes: 7 additions & 30 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,6 @@ add_custom_command(OUTPUT ${CORE_TABLES_BODY_INC_FILE} ${CORE_TABLES_HEADER_INC_
COMMENT "Generate core tables")
add_custom_target(spirv-tools-tables DEPENDS ${CORE_TABLES_BODY_INC_FILE} ${CORE_TABLES_HEADER_INC_FILE})

macro(spvtools_enum_string_mapping CONFIG_VERSION)
set(GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${CONFIG_VERSION}/spirv.core.grammar.json")
set(GRAMMAR_EXTENSION_ENUM_INC_FILE "${spirv-tools_BINARY_DIR}/extension_enum.inc")
set(GRAMMAR_ENUM_STRING_MAPPING_INC_FILE "${spirv-tools_BINARY_DIR}/enum_string_mapping.inc")
add_custom_command(OUTPUT ${GRAMMAR_EXTENSION_ENUM_INC_FILE}
${GRAMMAR_ENUM_STRING_MAPPING_INC_FILE}
COMMAND Python3::Interpreter ${GRAMMAR_PROCESSING_SCRIPT}
--spirv-core-grammar=${GRAMMAR_JSON_FILE}
--extinst-debuginfo-grammar=${DEBUGINFO_GRAMMAR_JSON_FILE}
--extinst-cldebuginfo100-grammar=${CLDEBUGINFO100_GRAMMAR_JSON_FILE}
--extension-enum-output=${GRAMMAR_EXTENSION_ENUM_INC_FILE}
--enum-string-mapping-output=${GRAMMAR_ENUM_STRING_MAPPING_INC_FILE}
DEPENDS ${GRAMMAR_PROCESSING_SCRIPT}
${GRAMMAR_JSON_FILE}
${DEBUGINFO_GRAMMAR_JSON_FILE}
${CLDEBUGINFO100_GRAMMAR_JSON_FILE}
COMMENT "Generate enum-string mapping for SPIR-V ${CONFIG_VERSION}.")
list(APPEND EXTENSION_H_DEPENDS ${GRAMMAR_EXTENSION_ENUM_INC_FILE})
list(APPEND ENUM_STRING_MAPPING_CPP_DEPENDS ${GRAMMAR_ENUM_STRING_MAPPING_INC_FILE})
endmacro(spvtools_enum_string_mapping)

macro(spvtools_vimsyntax CONFIG_VERSION CLVERSION)
set(GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${CONFIG_VERSION}/spirv.core.grammar.json")
set(GLSL_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${CONFIG_VERSION}/extinst.glsl.std.450.grammar.json")
Expand Down Expand Up @@ -109,7 +88,6 @@ macro(spvtools_extinst_lang_headers NAME GRAMMAR_FILE)
list(APPEND EXTINST_CPP_DEPENDS spirv-tools-header-${NAME})
endmacro(spvtools_extinst_lang_headers)

spvtools_enum_string_mapping("unified1")
spvtools_vendor_tables("glsl.std.450" "glsl" "")
spvtools_vendor_tables("opencl.std.100" "opencl" "")
spvtools_vendor_tables("spv-amd-shader-explicit-vertex-parameter" "spv-amd-sevp" "")
Expand Down Expand Up @@ -147,11 +125,8 @@ list(APPEND OPCODE_CPP_DEPENDS ${GENERATOR_INC_FILE})
# multiple targets depend on the same custom command.
add_custom_target(core_tables
DEPENDS ${OPCODE_CPP_DEPENDS}
${OPERAND_CPP_DEPENDS}
${CORE_TABLES_BODY_INC_FILE}
${CORE_TABLES_BODY_INC_FILE}
${CORE_TABLES_HEADER_INC_FILE})
add_custom_target(enum_string_mapping
DEPENDS ${EXTENSION_H_DEPENDS} ${ENUM_STRING_MAPPING_CPP_DEPENDS})
add_custom_target(extinst_tables
DEPENDS ${EXTINST_CPP_DEPENDS})

Expand All @@ -178,7 +153,11 @@ add_custom_target(spirv-tools-build-version
DEPENDS ${SPIRV_TOOLS_BUILD_VERSION_INC})
set_property(TARGET spirv-tools-build-version PROPERTY FOLDER "SPIRV-Tools build")

list(APPEND PCH_DEPENDS ${ENUM_STRING_MAPPING_CPP_DEPENDS} ${OPCODE_CPP_DEPENDS} ${OPERAND_CPP_DEPENDS} ${EXTENSION_H_DEPENDS} ${EXTINST_CPP_DEPENDS} ${SPIRV_TOOLS_BUILD_VERSION_INC})
list(APPEND PCH_DEPENDS
${CORE_TABLES_HEADER_INC_FILE}
${OPCODE_CPP_DEPENDS}
${EXTINST_CPP_DEPENDS}
${SPIRV_TOOLS_BUILD_VERSION_INC})
set_source_files_properties(
${CMAKE_CURRENT_SOURCE_DIR}/pch_source.cpp
PROPERTIES OBJECT_DEPENDS "${PCH_DEPENDS}")
Expand Down Expand Up @@ -209,7 +188,6 @@ set(SPIRV_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/diagnostic.h
${CMAKE_CURRENT_SOURCE_DIR}/disassemble.h
${CMAKE_CURRENT_SOURCE_DIR}/enum_set.h
${CMAKE_CURRENT_SOURCE_DIR}/enum_string_mapping.h
${CMAKE_CURRENT_SOURCE_DIR}/ext_inst.h
${CMAKE_CURRENT_SOURCE_DIR}/extensions.h
${CMAKE_CURRENT_SOURCE_DIR}/instruction.h
Expand Down Expand Up @@ -244,7 +222,6 @@ set(SPIRV_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/binary.cpp
${CMAKE_CURRENT_SOURCE_DIR}/diagnostic.cpp
${CMAKE_CURRENT_SOURCE_DIR}/disassemble.cpp
${CMAKE_CURRENT_SOURCE_DIR}/enum_string_mapping.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ext_inst.cpp
${CMAKE_CURRENT_SOURCE_DIR}/extensions.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libspirv.cpp
Expand Down Expand Up @@ -349,7 +326,7 @@ function(spirv_tools_default_target_options target)
)
set_property(TARGET ${target} PROPERTY FOLDER "SPIRV-Tools libraries")
spvtools_check_symbol_exports(${target})
add_dependencies(${target} spirv-tools-build-version core_tables enum_string_mapping extinst_tables)
add_dependencies(${target} spirv-tools-build-version core_tables extinst_tables)
endfunction()

# Always build ${SPIRV_TOOLS}-shared. This is expected distro packages, and
Expand Down
29 changes: 0 additions & 29 deletions source/enum_string_mapping.cpp

This file was deleted.

36 changes: 0 additions & 36 deletions source/enum_string_mapping.h

This file was deleted.

2 changes: 1 addition & 1 deletion source/extensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <string>

#include "source/binary.h"
#include "source/enum_string_mapping.h"
#include "source/table2.h"

namespace spvtools {

Expand Down
12 changes: 3 additions & 9 deletions source/extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,19 @@
#ifndef SOURCE_EXTENSIONS_H_
#define SOURCE_EXTENSIONS_H_

#include <cstdint>
#include <string>

#include "source/enum_set.h"
#include "spirv-tools/libspirv.h"
#include "source/table2.h"

namespace spvtools {

// The known SPIR-V extensions.
enum Extension : uint32_t {
#include "extension_enum.inc"
};

using ExtensionSet = EnumSet<Extension>;

// Returns literal string operand of OpExtension instruction.
// Returns the literal string operand of OpExtension instruction.
std::string GetExtensionString(const spv_parsed_instruction_t* inst);

// Returns text string listing |extensions| separated by whitespace.
// Returns a text string listing |extensions| separated by whitespace.
std::string ExtensionSetToString(const ExtensionSet& extensions);

} // namespace spvtools
Expand Down
1 change: 0 additions & 1 deletion source/opt/feature_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#include <string>

#include "source/enum_string_mapping.h"
#include "source/table2.h"

namespace spvtools {
Expand Down
2 changes: 1 addition & 1 deletion source/opt/invocation_interlock_placement_pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
#include <vector>

#include "source/enum_set.h"
#include "source/enum_string_mapping.h"
#include "source/opt/ir_context.h"
#include "source/opt/reflect.h"
#include "source/spirv_target_env.h"
#include "source/table2.h"
#include "source/util/string_utils.h"

namespace spvtools {
Expand Down
Loading