Refactor include of latest spir-v header versions

This commit is contained in:
Andrey Tuganov 2017-12-13 17:55:00 -05:00 committed by David Neto
parent 532b327d4d
commit af7d5799a5
32 changed files with 109 additions and 47 deletions

View File

@ -108,12 +108,12 @@ SPVTOOLS_OPT_SRC_FILES := \
SPV_CORE10_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.0/spirv.core.grammar.json
SPV_CORE11_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.1/spirv.core.grammar.json
SPV_CORE12_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.2/spirv.core.grammar.json
SPV_GLSL_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.0/extinst.glsl.std.450.grammar.json
SPV_OPENCL_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.0/extinst.opencl.std.100.grammar.json
SPV_GLSL_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.2/extinst.glsl.std.450.grammar.json
SPV_OPENCL_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.2/extinst.opencl.std.100.grammar.json
define gen_spvtools_grammar_tables
$(call generate-file-dir,$(1)/core.insts-1.0.inc)
$(1)/core.insts-1.0.inc $(1)/operand.kinds-1.0.inc $(1)/glsl.std.450.insts-1.0.inc $(1)/opencl.std.insts-1.0.inc: \
$(1)/core.insts-1.0.inc $(1)/operand.kinds-1.0.inc $(1)/glsl.std.450.insts.inc $(1)/opencl.std.insts.inc: \
$(LOCAL_PATH)/utils/generate_grammar_tables.py \
$(SPV_CORE10_GRAMMAR) \
$(SPV_GLSL_GRAMMAR) \
@ -123,8 +123,8 @@ $(1)/core.insts-1.0.inc $(1)/operand.kinds-1.0.inc $(1)/glsl.std.450.insts-1.0.i
--extinst-glsl-grammar=$(SPV_GLSL_GRAMMAR) \
--extinst-opencl-grammar=$(SPV_OPENCL_GRAMMAR) \
--core-insts-output=$(1)/core.insts-1.0.inc \
--glsl-insts-output=$(1)/glsl.std.450.insts-1.0.inc \
--opencl-insts-output=$(1)/opencl.std.insts-1.0.inc \
--glsl-insts-output=$(1)/glsl.std.450.insts.inc \
--opencl-insts-output=$(1)/opencl.std.insts.inc \
--operand-kinds-output=$(1)/operand.kinds-1.0.inc
@echo "[$(TARGET_ARCH_ABI)] Grammar v1.0 : instructions & operands <= grammar JSON files"
$(1)/core.insts-1.1.inc $(1)/operand.kinds-1.1.inc: \
@ -145,7 +145,7 @@ $(1)/core.insts-1.2.inc $(1)/operand.kinds-1.2.inc: \
@echo "[$(TARGET_ARCH_ABI)] Grammar v1.2 : instructions & operands <= grammar JSON files"
$(LOCAL_PATH)/source/opcode.cpp: $(1)/core.insts-1.0.inc $(1)/core.insts-1.1.inc $(1)/core.insts-1.2.inc
$(LOCAL_PATH)/source/operand.cpp: $(1)/operand.kinds-1.0.inc $(1)/operand.kinds-1.1.inc $(1)/operand.kinds-1.2.inc
$(LOCAL_PATH)/source/ext_inst.cpp: $(1)/glsl.std.450.insts-1.0.inc $(1)/opencl.std.insts-1.0.inc
$(LOCAL_PATH)/source/ext_inst.cpp: $(1)/glsl.std.450.insts.inc $(1)/opencl.std.insts.inc
endef
$(eval $(call gen_spvtools_grammar_tables,$(SPVTOOLS_OUT_PATH)))

View File

@ -70,7 +70,7 @@ endmacro(spvtools_vimsyntax)
macro(spvtools_glsl_tables VERSION)
set(CORE_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${VERSION}/spirv.core.grammar.json")
set(GLSL_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${VERSION}/extinst.glsl.std.450.grammar.json")
set(GRAMMAR_INC_FILE "${spirv-tools_BINARY_DIR}/glsl.std.450.insts-${VERSION}.inc")
set(GRAMMAR_INC_FILE "${spirv-tools_BINARY_DIR}/glsl.std.450.insts.inc")
add_custom_command(OUTPUT ${GRAMMAR_INC_FILE}
COMMAND ${PYTHON_EXECUTABLE} ${GRAMMAR_PROCESSING_SCRIPT}
--spirv-core-grammar=${CORE_GRAMMAR_JSON_FILE}
@ -84,7 +84,7 @@ endmacro(spvtools_glsl_tables)
macro(spvtools_opencl_tables VERSION)
set(CORE_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${VERSION}/spirv.core.grammar.json")
set(OPENCL_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${VERSION}/extinst.opencl.std.100.grammar.json")
set(GRAMMAR_INC_FILE "${spirv-tools_BINARY_DIR}/opencl.std.insts-${VERSION}.inc")
set(GRAMMAR_INC_FILE "${spirv-tools_BINARY_DIR}/opencl.std.insts.inc")
add_custom_command(OUTPUT ${GRAMMAR_INC_FILE}
COMMAND ${PYTHON_EXECUTABLE} ${GRAMMAR_PROCESSING_SCRIPT}
--spirv-core-grammar=${CORE_GRAMMAR_JSON_FILE}
@ -113,8 +113,8 @@ spvtools_core_tables("1.0")
spvtools_core_tables("1.1")
spvtools_core_tables("1.2")
spvtools_enum_string_mapping("1.2")
spvtools_opencl_tables("1.0")
spvtools_glsl_tables("1.0")
spvtools_opencl_tables("1.2")
spvtools_glsl_tables("1.2")
spvtools_vendor_tables("spv-amd-shader-explicit-vertex-parameter")
spvtools_vendor_tables("spv-amd-shader-trinary-minmax")
spvtools_vendor_tables("spv-amd-gcn-shader")
@ -210,6 +210,9 @@ set(SPIRV_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/extensions.h
${CMAKE_CURRENT_SOURCE_DIR}/id_descriptor.h
${CMAKE_CURRENT_SOURCE_DIR}/instruction.h
${CMAKE_CURRENT_SOURCE_DIR}/latest_version_glsl_std_450_header.h
${CMAKE_CURRENT_SOURCE_DIR}/latest_version_opencl_std_header.h
${CMAKE_CURRENT_SOURCE_DIR}/latest_version_spirv_header.h
${CMAKE_CURRENT_SOURCE_DIR}/macro.h
${CMAKE_CURRENT_SOURCE_DIR}/name_mapper.h
${CMAKE_CURRENT_SOURCE_DIR}/opcode.h

View File

@ -15,9 +15,9 @@
#ifndef LIBSPIRV_ASSEMBLY_GRAMMAR_H_
#define LIBSPIRV_ASSEMBLY_GRAMMAR_H_
#include "latest_version_spirv_header.h"
#include "operand.h"
#include "spirv-tools/libspirv.h"
#include "spirv/1.2/spirv.h"
#include "table.h"
namespace libspirv {

View File

@ -34,9 +34,9 @@
#include <unordered_set>
#include <vector>
#include "spirv/1.2/GLSL.std.450.h"
#include "spirv/1.2/OpenCL.std.h"
#include "spirv/1.2/spirv.h"
#include "latest_version_glsl_std_450_header.h"
#include "latest_version_opencl_std_header.h"
#include "latest_version_spirv_header.h"
#include "binary.h"
#include "diagnostic.h"

View File

@ -19,8 +19,8 @@
#include <unordered_set>
#include <vector>
#include "latest_version_spirv_header.h"
#include "spirv-tools/libspirv.h"
#include "spirv/1.2/spirv.h"
#include "util/huffman_codec.h"
namespace spvtools {

View File

@ -21,7 +21,7 @@
#include <set>
#include <utility>
#include "spirv/1.2/spirv.h"
#include "latest_version_spirv_header.h"
namespace libspirv {

View File

@ -17,14 +17,14 @@
#include <cassert>
#include <cstring>
#include "spirv/1.0/GLSL.std.450.h"
#include "spirv/1.0/OpenCL.std.h"
#include "latest_version_glsl_std_450_header.h"
#include "latest_version_opencl_std_header.h"
#include "spirv_definition.h"
#include "macro.h"
#include "glsl.std.450.insts-1.0.inc" // defines glsl_entries
#include "opencl.std.insts-1.0.inc" // defines opencl_entries
#include "glsl.std.450.insts.inc" // defines glsl_entries
#include "opencl.std.insts.inc" // defines opencl_entries
#include "spv-amd-gcn-shader.insts.inc"
#include "spv-amd-shader-ballot.insts.inc"

View File

@ -18,8 +18,8 @@
#include <cstdint>
#include <vector>
#include "latest_version_spirv_header.h"
#include "spirv-tools/libspirv.h"
#include "spirv/1.2/spirv.h"
// Describes an instruction.
struct spv_instruction_t {

View File

@ -0,0 +1,20 @@
// Copyright (c) 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef LIBSPIRV_LATEST_VERSION_GLSL_STD_450_HEADER_H_
#define LIBSPIRV_LATEST_VERSION_GLSL_STD_450_HEADER_H_
#include "spirv/1.2/GLSL.std.450.h"
#endif // LIBSPIRV_LATEST_VERSION_GLSL_STD_450_HEADER_H_

View File

@ -0,0 +1,20 @@
// Copyright (c) 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef LIBSPIRV_LATEST_VERSION_OPENCL_STD_HEADER_H_
#define LIBSPIRV_LATEST_VERSION_OPENCL_STD_HEADER_H_
#include "spirv/1.2/OpenCL.std.h"
#endif // LIBSPIRV_LATEST_VERSION_OPENCL_STD_HEADER_H_

View File

@ -0,0 +1,20 @@
// Copyright (c) 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef LIBSPIRV_LATEST_VERSION_SPIRV_HEADER_H_
#define LIBSPIRV_LATEST_VERSION_SPIRV_HEADER_H_
#include "spirv/1.2/spirv.h"
#endif // LIBSPIRV_LATEST_VERSION_SPIRV_HEADER_H_

View File

@ -16,8 +16,8 @@
#define LIBSPIRV_OPCODE_H_
#include "instruction.h"
#include "latest_version_spirv_header.h"
#include "spirv-tools/libspirv.h"
#include "spirv/1.2/spirv.h"
#include "table.h"
// Returns the name of a registered SPIR-V generator as a null-terminated

View File

@ -18,7 +18,7 @@
#include "cfa.h"
#include "iterator.h"
#include "spirv/1.0/GLSL.std.450.h"
#include "latest_version_glsl_std_450_header.h"
#include <stack>

View File

@ -24,8 +24,8 @@
#include "operand.h"
#include "util/ilist_node.h"
#include "latest_version_spirv_header.h"
#include "spirv-tools/libspirv.h"
#include "spirv/1.2/spirv.h"
namespace spvtools {
namespace ir {

View File

@ -25,8 +25,8 @@
#include "operand.h"
#include "util/ilist.h"
#include "latest_version_spirv_header.h"
#include "spirv-tools/libspirv.h"
#include "spirv/1.2/spirv.h"
namespace spvtools {
namespace ir {
@ -104,8 +104,7 @@ class InstructionList : public utils::IntrusiveList<Instruction> {
// Runs the given function |f| on the instructions in the list and optionally
// on the preceding debug line instructions.
inline void ForEachInst(
const std::function<void(Instruction*)>& f,
inline void ForEachInst(const std::function<void(Instruction*)>& f,
bool run_on_debug_line_insts) {
auto next = begin();
for (auto i = next; i != end(); i = next) {

View File

@ -13,9 +13,9 @@
// limitations under the License.
#include "ir_context.h"
#include "latest_version_glsl_std_450_header.h"
#include "log.h"
#include "mem_pass.h"
#include "spirv/1.0/GLSL.std.450.h"
#include <cstring>

View File

@ -18,7 +18,7 @@
#include "cfa.h"
#include "iterator.h"
#include "spirv/1.0/GLSL.std.450.h"
#include "latest_version_glsl_std_450_header.h"
namespace spvtools {
namespace opt {

View File

@ -15,7 +15,7 @@
#ifndef LIBSPIRV_OPT_REFLECT_H_
#define LIBSPIRV_OPT_REFLECT_H_
#include "spirv/1.2/spirv.h"
#include "latest_version_spirv_header.h"
namespace spvtools {
namespace ir {

View File

@ -21,8 +21,8 @@
#include <unordered_map>
#include <vector>
#include "latest_version_spirv_header.h"
#include "spirv-tools/libspirv.h"
#include "spirv/1.2/spirv.h"
namespace spvtools {
namespace opt {

View File

@ -15,8 +15,8 @@
#ifndef LIBSPIRV_SPIRV_CONSTANT_H_
#define LIBSPIRV_SPIRV_CONSTANT_H_
#include "latest_version_spirv_header.h"
#include "spirv-tools/libspirv.h"
#include "spirv/1.2/spirv.h"
// Version number macros.

View File

@ -17,7 +17,7 @@
#include <cstdint>
#include "spirv/1.2/spirv.h"
#include "latest_version_spirv_header.h"
#define spvIsInBitfield(value, bitfield) ((value) == ((value)&bitfield))

View File

@ -15,7 +15,7 @@
#ifndef LIBSPIRV_TABLE_H_
#define LIBSPIRV_TABLE_H_
#include "spirv/1.2/spirv.h"
#include "latest_version_spirv_header.h"
#include "extensions.h"
#include "message.h"

View File

@ -15,7 +15,7 @@
#ifndef LIBSPIRV_VAL_BASICBLOCK_H_
#define LIBSPIRV_VAL_BASICBLOCK_H_
#include "spirv/1.2/spirv.h"
#include "latest_version_spirv_header.h"
#include <cstdint>

View File

@ -19,7 +19,7 @@
#include <unordered_map>
#include <vector>
#include "spirv/1.2/spirv.h"
#include "latest_version_spirv_header.h"
namespace libspirv {

View File

@ -23,8 +23,8 @@
#include <unordered_set>
#include <vector>
#include "latest_version_spirv_header.h"
#include "spirv-tools/libspirv.h"
#include "spirv/1.2/spirv.h"
#include "val/basic_block.h"
#include "val/construct.h"

View File

@ -26,8 +26,8 @@
#include "decoration.h"
#include "diagnostic.h"
#include "enum_set.h"
#include "latest_version_spirv_header.h"
#include "spirv-tools/libspirv.h"
#include "spirv/1.2/spirv.h"
#include "spirv_definition.h"
#include "val/function.h"
#include "val/instruction.h"

View File

@ -17,9 +17,9 @@
#include <vector>
#include "gmock/gmock.h"
#include "latest_version_opencl_std_header.h"
#include "source/message.h"
#include "source/table.h"
#include "spirv/1.0/OpenCL.std.h"
#include "test_fixture.h"
#include "unit_spirv.h"

View File

@ -15,7 +15,7 @@
#include <algorithm>
#include <vector>
#include "spirv/1.0/GLSL.std.450.h"
#include "latest_version_glsl_std_450_header.h"
#include "unit_spirv.h"
namespace {

View File

@ -15,7 +15,7 @@
#include "unit_spirv.h"
#include <gmock/gmock.h>
#include "spirv/1.0/OpenCL.std.h"
#include "latest_version_opencl_std_header.h"
#include "test_fixture.h"
namespace {

View File

@ -17,7 +17,7 @@
#include <sstream>
#include <string>
#include "spirv/1.1/spirv.h"
#include "latest_version_spirv_header.h"
#include "test_fixture.h"
#include "tools/stats/stats_analyzer.h"

View File

@ -18,8 +18,8 @@
#include "unit_spirv.h"
#include "gmock/gmock.h"
#include "spirv/1.0/GLSL.std.450.h"
#include "spirv/1.0/OpenCL.std.h"
#include "latest_version_glsl_std_450_header.h"
#include "latest_version_opencl_std_header.h"
#include "test_fixture.h"
namespace {

View File

@ -18,7 +18,7 @@
#include <vector>
#include "gtest/gtest.h"
#include "spirv/1.1/spirv.h"
#include "latest_version_spirv_header.h"
#include "enum_set.h"
#include "extensions.h"