Splitting the flatcc runtime dependency into parsing and building. (#7064)
Even though LTO will strip what we don't use it still means we are
compiling more than we need and risking inclusion of things we don't want.
I still don't like how the compiler depends on the runtime flatcc files
but that's a task for another day.
diff --git a/build_tools/bazel/iree_flatcc.bzl b/build_tools/bazel/iree_flatcc.bzl
index fd9b744..7a18e74 100644
--- a/build_tools/bazel/iree_flatcc.bzl
+++ b/build_tools/bazel/iree_flatcc.bzl
@@ -13,7 +13,6 @@
testonly = False,
**kwargs):
flatcc = "@com_github_dvidelabs_flatcc//:flatcc"
- flatcc_rt = "@com_github_dvidelabs_flatcc//:runtime"
flags = [
"-o$(RULEDIR)",
@@ -44,9 +43,6 @@
native.cc_library(
name = name,
hdrs = outs,
- deps = [
- flatcc_rt,
- ],
testonly = testonly,
**kwargs
)
diff --git a/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py b/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py
index 8291e80..32dfb56 100644
--- a/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py
+++ b/build_tools/bazel_to_cmake/bazel_to_cmake_targets.py
@@ -59,6 +59,7 @@
# Misc single targets
"@com_google_benchmark//:benchmark": ["benchmark"],
"@com_github_dvidelabs_flatcc//:flatcc": ["flatcc"],
+ "@com_github_dvidelabs_flatcc//:parsing": ["flatcc::parsing"],
"@com_github_dvidelabs_flatcc//:runtime": ["flatcc::runtime"],
"@com_github_yaml_libyaml//:yaml": ["yaml"],
"@com_google_googletest//:gtest": ["gmock", "gtest"],
diff --git a/build_tools/cmake/flatbuffer_c_library.cmake b/build_tools/cmake/flatbuffer_c_library.cmake
index 22ddb8e..834aef1 100644
--- a/build_tools/cmake/flatbuffer_c_library.cmake
+++ b/build_tools/cmake/flatbuffer_c_library.cmake
@@ -123,7 +123,6 @@
)
target_link_libraries(${_NAME}
INTERFACE
- flatcc::runtime
${IREE_DEFAULT_LINKOPTS}
)
target_compile_options(${_NAME}
diff --git a/build_tools/third_party/flatcc/BUILD.overlay b/build_tools/third_party/flatcc/BUILD.overlay
index 071966d..9142b81 100644
--- a/build_tools/third_party/flatcc/BUILD.overlay
+++ b/build_tools/third_party/flatcc/BUILD.overlay
@@ -15,7 +15,6 @@
"src/runtime/json_parser.c",
"src/runtime/json_printer.c",
"src/runtime/refmap.c",
- "src/runtime/verifier.c",
],
hdrs = [
"include/flatcc/flatcc_accessors.h",
@@ -52,7 +51,48 @@
],
}),
includes = [
- "include/",
+ "include/",
+ ],
+ deps = [
+ ":parsing",
+ ],
+ strip_include_prefix = "include",
+)
+
+# A limited version of :runtime with only enough to parse and verify.
+cc_library(
+ name = "parsing",
+ srcs = [
+ "config/config.h",
+ "src/runtime/verifier.c",
+ ],
+ hdrs = [
+ "include/flatcc/flatcc_accessors.h",
+ "include/flatcc/flatcc_alloc.h",
+ "include/flatcc/flatcc_assert.h",
+ "include/flatcc/flatcc_endian.h",
+ "include/flatcc/flatcc_epilogue.h",
+ "include/flatcc/flatcc_flatbuffers.h",
+ "include/flatcc/flatcc_identifier.h",
+ "include/flatcc/flatcc_portable.h",
+ "include/flatcc/flatcc_prologue.h",
+ "include/flatcc/flatcc_rtconfig.h",
+ "include/flatcc/flatcc_types.h",
+ "include/flatcc/flatcc_unaligned.h",
+ "include/flatcc/flatcc_verifier.h",
+ "include/flatcc/reflection/flatbuffers_common_reader.h",
+ ] + glob(["include/flatcc/portable/**/*.h"]),
+ copts = [
+ "-Iexternal/com_github_dvidelabs_flatcc/config/",
+ "-Iexternal/com_github_dvidelabs_flatcc/include/",
+ ] + select({
+ "@bazel_tools//src/conditions:windows": [],
+ "//conditions:default": [
+ "-Wno-implicit-fallthrough",
+ ],
+ }),
+ includes = [
+ "include/",
],
strip_include_prefix = "include",
)
diff --git a/build_tools/third_party/flatcc/CMakeLists.txt b/build_tools/third_party/flatcc/CMakeLists.txt
index 4db8d69..f707b56 100644
--- a/build_tools/third_party/flatcc/CMakeLists.txt
+++ b/build_tools/third_party/flatcc/CMakeLists.txt
@@ -21,7 +21,6 @@
"src/runtime/json_parser.c"
"src/runtime/json_printer.c"
"src/runtime/refmap.c"
- "src/runtime/verifier.c"
HDRS
"include/flatcc/flatcc_accessors.h"
"include/flatcc/flatcc_alloc.h"
@@ -44,6 +43,39 @@
"include/flatcc/flatcc_verifier.h"
"include/flatcc/reflection/flatbuffers_common_builder.h"
"include/flatcc/reflection/flatbuffers_common_reader.h"
+ DEPS
+ flatcc::parsing
+ PUBLIC
+)
+
+# A limited version of :runtime with only enough to parse and verify.
+external_cc_library(
+ PACKAGE
+ flatcc
+ NAME
+ parsing
+ ROOT
+ ${FLATCC_ROOT}
+ INCLUDES
+ "${FLATCC_ROOT}/include"
+ SRCS
+ "config/config.h"
+ "src/runtime/verifier.c"
+ HDRS
+ "include/flatcc/flatcc_accessors.h"
+ "include/flatcc/flatcc_alloc.h"
+ "include/flatcc/flatcc_assert.h"
+ "include/flatcc/flatcc_endian.h"
+ "include/flatcc/flatcc_epilogue.h"
+ "include/flatcc/flatcc_flatbuffers.h"
+ "include/flatcc/flatcc_identifier.h"
+ "include/flatcc/flatcc_portable.h"
+ "include/flatcc/flatcc_prologue.h"
+ "include/flatcc/flatcc_rtconfig.h"
+ "include/flatcc/flatcc_types.h"
+ "include/flatcc/flatcc_unaligned.h"
+ "include/flatcc/flatcc_verifier.h"
+ "include/flatcc/reflection/flatbuffers_common_reader.h"
PUBLIC
)
diff --git a/experimental/rocm/CMakeLists.txt b/experimental/rocm/CMakeLists.txt
index 185bd5c..69943a7 100644
--- a/experimental/rocm/CMakeLists.txt
+++ b/experimental/rocm/CMakeLists.txt
@@ -49,7 +49,7 @@
iree::base
iree::base::core_headers
iree::base::internal
- iree::base::internal::flatcc
+ iree::base::internal::flatcc::parsing
iree::base::internal::synchronization
iree::base::tracing
iree::hal
diff --git a/experimental/rocm/native_executable.c b/experimental/rocm/native_executable.c
index 680f07f..22a98f6 100644
--- a/experimental/rocm/native_executable.c
+++ b/experimental/rocm/native_executable.c
@@ -14,7 +14,7 @@
#include "iree/base/tracing.h"
// flatcc schemas:
-#include "iree/base/internal/flatcc.h"
+#include "iree/base/internal/flatcc/parsing.h"
#include "iree/schemas/rocm_executable_def_reader.h"
#include "iree/schemas/rocm_executable_def_verifier.h"
diff --git a/iree/base/internal/BUILD b/iree/base/internal/BUILD
index 8c2b904..27db3b0 100644
--- a/iree/base/internal/BUILD
+++ b/iree/base/internal/BUILD
@@ -8,7 +8,6 @@
# These are not part of the IREE API. Though they may be used by external
# projects their API may change at any time.
-load("//build_tools/bazel:iree_flatcc.bzl", "iree_flatbuffer_c_library")
load("//build_tools/bazel:run_binary_test.bzl", "run_binary_test")
load("//iree:build_defs.oss.bzl", "iree_cmake_extra_content")
load("//iree:lit_test.bzl", "iree_lit_test_suite")
@@ -200,26 +199,6 @@
)
cc_library(
- name = "flatcc",
- hdrs = ["flatcc.h"],
- deps = [
- ":flatcc_dummy",
- "@com_github_dvidelabs_flatcc//:runtime",
- ],
-)
-
-iree_flatbuffer_c_library(
- name = "flatcc_dummy",
- srcs = ["flatcc.fbs"],
- flatcc_args = [
- "--reader",
- "--builder",
- "--verifier",
- "--json",
- ],
-)
-
-cc_library(
name = "fpu_state",
srcs = ["fpu_state.c"],
hdrs = ["fpu_state.h"],
diff --git a/iree/base/internal/CMakeLists.txt b/iree/base/internal/CMakeLists.txt
index cad27d1..97bc9fc 100644
--- a/iree/base/internal/CMakeLists.txt
+++ b/iree/base/internal/CMakeLists.txt
@@ -202,30 +202,6 @@
iree_cc_library(
NAME
- flatcc
- HDRS
- "flatcc.h"
- DEPS
- ::flatcc_dummy
- flatcc::runtime
- PUBLIC
-)
-
-flatbuffer_c_library(
- NAME
- flatcc_dummy
- SRCS
- "flatcc.fbs"
- FLATCC_ARGS
- "--reader"
- "--builder"
- "--verifier"
- "--json"
- PUBLIC
-)
-
-iree_cc_library(
- NAME
fpu_state
HDRS
"fpu_state.h"
diff --git a/iree/base/internal/flatcc.h b/iree/base/internal/flatcc.h
deleted file mode 100644
index 5759cac..0000000
--- a/iree/base/internal/flatcc.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#// Copyright 2020 The IREE Authors
-//
-#// Licensed under the Apache License v2.0 with LLVM Exceptions.
-#// See https://llvm.org/LICENSE.txt for license information.
-#// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-#ifndef IREE_BASE_INTERNAL_FLATCC_H_
-#define IREE_BASE_INTERNAL_FLATCC_H_
-
-//===----------------------------------------------------------------------===//
-// flatcc include order fixes
-//===----------------------------------------------------------------------===//
-//
-// This header merely wraps the flatcc headers that are generally useful to
-// include in various places that may not know the specific messages they are
-// working with.
-//
-// If using flatcc prefer to include this file over any hard-to-handle flatcc
-// file such as flatbuffers_common_reader.h or flatbuffers_common_builder.h.
-//
-// NOTE: order matters for these includes so stop clang from messing with it:
-// clang-format off
-
-#include "flatcc/reflection/flatbuffers_common_reader.h" // IWYU pragma: export
-#include "iree/base/internal/flatcc_reader.h" // IWYU pragma: export
-
-#include "flatcc/flatcc_verifier.h" // IWYU pragma: export
-#include "iree/base/internal/flatcc_verifier.h" // IWYU pragma: export
-
-#include "flatcc/flatcc_builder.h" // IWYU pragma: export
-#include "flatcc/reflection/flatbuffers_common_builder.h" // IWYU pragma: export
-#include "iree/base/internal/flatcc_builder.h" // IWYU pragma: export
-
-#include "flatcc/flatcc_json_parser.h" // IWYU pragma: export
-#include "iree/base/internal/flatcc_json_parser.h" // IWYU pragma: export
-
-#include "flatcc/flatcc_json_printer.h" // IWYU pragma: export
-#include "iree/base/internal/flatcc_json_printer.h" // IWYU pragma: export
-
-// clang-format on
-
-#endif // IREE_BASE_INTERNAL_FLATCC_H_
diff --git a/iree/base/internal/flatcc/BUILD b/iree/base/internal/flatcc/BUILD
new file mode 100644
index 0000000..6312489
--- /dev/null
+++ b/iree/base/internal/flatcc/BUILD
@@ -0,0 +1,52 @@
+# Copyright 2021 The IREE Authors
+#
+# Licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+load("//build_tools/bazel:iree_flatcc.bzl", "iree_flatbuffer_c_library")
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = ["layering_check"],
+ licenses = ["notice"], # Apache 2.0
+)
+
+cc_library(
+ name = "building",
+ hdrs = ["building.h"],
+ deps = [
+ ":dummy",
+ ":parsing",
+ "@com_github_dvidelabs_flatcc//:runtime",
+ ],
+)
+
+cc_library(
+ name = "debugging",
+ hdrs = ["debugging.h"],
+ deps = [
+ ":dummy",
+ "@com_github_dvidelabs_flatcc//:runtime",
+ ],
+)
+
+cc_library(
+ name = "parsing",
+ hdrs = ["parsing.h"],
+ deps = [
+ ":dummy",
+ "@com_github_dvidelabs_flatcc//:parsing",
+ ],
+)
+
+iree_flatbuffer_c_library(
+ name = "dummy",
+ srcs = ["dummy.fbs"],
+ flatcc_args = [
+ "--reader",
+ "--builder",
+ "--verifier",
+ "--json",
+ ],
+)
diff --git a/iree/base/internal/flatcc/CMakeLists.txt b/iree/base/internal/flatcc/CMakeLists.txt
new file mode 100644
index 0000000..affb08f
--- /dev/null
+++ b/iree/base/internal/flatcc/CMakeLists.txt
@@ -0,0 +1,60 @@
+################################################################################
+# Autogenerated by build_tools/bazel_to_cmake/bazel_to_cmake.py from #
+# iree/base/internal/flatcc/BUILD #
+# #
+# Use iree_cmake_extra_content from iree/build_defs.oss.bzl to add arbitrary #
+# CMake-only content. #
+# #
+# To disable autogeneration for this file entirely, delete this header. #
+################################################################################
+
+iree_add_all_subdirs()
+
+iree_cc_library(
+ NAME
+ building
+ HDRS
+ "building.h"
+ DEPS
+ ::dummy
+ ::parsing
+ flatcc::runtime
+ PUBLIC
+)
+
+iree_cc_library(
+ NAME
+ debugging
+ HDRS
+ "debugging.h"
+ DEPS
+ ::dummy
+ flatcc::runtime
+ PUBLIC
+)
+
+iree_cc_library(
+ NAME
+ parsing
+ HDRS
+ "parsing.h"
+ DEPS
+ ::dummy
+ flatcc::parsing
+ PUBLIC
+)
+
+flatbuffer_c_library(
+ NAME
+ dummy
+ SRCS
+ "dummy.fbs"
+ FLATCC_ARGS
+ "--reader"
+ "--builder"
+ "--verifier"
+ "--json"
+ PUBLIC
+)
+
+### BAZEL_TO_CMAKE_PRESERVES_ALL_CONTENT_BELOW_THIS_LINE ###
diff --git a/iree/base/internal/flatcc/building.h b/iree/base/internal/flatcc/building.h
new file mode 100644
index 0000000..14fa965
--- /dev/null
+++ b/iree/base/internal/flatcc/building.h
@@ -0,0 +1,32 @@
+// Copyright 2021 The IREE Authors
+//
+// Licensed under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+#ifndef IREE_BASE_INTERNAL_FLATCC_BUILDING_H_
+#define IREE_BASE_INTERNAL_FLATCC_BUILDING_H_
+
+//===----------------------------------------------------------------------===//
+// flatcc include order fixes
+//===----------------------------------------------------------------------===//
+//
+// This header merely wraps the flatcc headers that are generally useful to
+// include in various places that may not know the specific messages they are
+// working with.
+//
+// If using flatcc prefer to include this file over any hard-to-handle flatcc
+// file such as flatbuffers_common_reader.h or flatbuffers_common_builder.h.
+//
+// NOTE: order matters for these includes so stop clang from messing with it:
+// clang-format off
+
+#include "iree/base/internal/flatcc/parsing.h"
+
+#include "flatcc/flatcc_builder.h" // IWYU pragma: export
+#include "flatcc/reflection/flatbuffers_common_builder.h" // IWYU pragma: export
+#include "iree/base/internal/flatcc/dummy_builder.h" // IWYU pragma: export
+
+// clang-format on
+
+#endif // IREE_BASE_INTERNAL_FLATCC_BUILDING_H_
diff --git a/iree/base/internal/flatcc/debugging.h b/iree/base/internal/flatcc/debugging.h
new file mode 100644
index 0000000..fdbc7e5
--- /dev/null
+++ b/iree/base/internal/flatcc/debugging.h
@@ -0,0 +1,34 @@
+// Copyright 2021 The IREE Authors
+//
+// Licensed under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+#ifndef IREE_BASE_INTERNAL_FLATCC_DEBUGGING_H_
+#define IREE_BASE_INTERNAL_FLATCC_DEBUGGING_H_
+
+//===----------------------------------------------------------------------===//
+// flatcc include order fixes
+//===----------------------------------------------------------------------===//
+//
+// This header merely wraps the flatcc headers that are generally useful to
+// include in various places that may not know the specific messages they are
+// working with.
+//
+// If using flatcc prefer to include this file over any hard-to-handle flatcc
+// file such as flatbuffers_common_reader.h or flatbuffers_common_builder.h.
+//
+// NOTE: order matters for these includes so stop clang from messing with it:
+// clang-format off
+
+#include "iree/base/internal/flatcc/parsing.h"
+
+#include "flatcc/flatcc_json_parser.h" // IWYU pragma: export
+#include "iree/base/internal/flatcc/dummy_json_parser.h" // IWYU pragma: export
+
+#include "flatcc/flatcc_json_printer.h" // IWYU pragma: export
+#include "iree/base/internal/flatcc/dummy_json_printer.h" // IWYU pragma: export
+
+// clang-format on
+
+#endif // IREE_BASE_INTERNAL_FLATCC_DEBUGGING_H_
diff --git a/iree/base/internal/flatcc.fbs b/iree/base/internal/flatcc/dummy.fbs
similarity index 95%
rename from iree/base/internal/flatcc.fbs
rename to iree/base/internal/flatcc/dummy.fbs
index 02a90ac..626af1e 100644
--- a/iree/base/internal/flatcc.fbs
+++ b/iree/base/internal/flatcc/dummy.fbs
@@ -4,13 +4,13 @@
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-namespace iree;
+namespace iree_flatcc;
// HACK: flatcc public API headers are incomplete and some things only exist
// when pulled in via generated headers. So here we give ourselves something to
// include that's always available and cheap.
//
-// Instead of directly including this file use iree/base/internal/flatcc.h.
+// Instead of directly including this file use iree/base/internal/flatcc/*.h.
//
// Normally including any generated file will include the appropriate headers in
// the required order (as they are non-hermetic), but that requires that we have
diff --git a/iree/base/internal/flatcc/parsing.h b/iree/base/internal/flatcc/parsing.h
new file mode 100644
index 0000000..4e1c675
--- /dev/null
+++ b/iree/base/internal/flatcc/parsing.h
@@ -0,0 +1,32 @@
+// Copyright 2021 The IREE Authors
+//
+// Licensed under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+#ifndef IREE_BASE_INTERNAL_FLATCC_PARSING_H_
+#define IREE_BASE_INTERNAL_FLATCC_PARSING_H_
+
+//===----------------------------------------------------------------------===//
+// flatcc include order fixes
+//===----------------------------------------------------------------------===//
+//
+// This header merely wraps the flatcc headers that are generally useful to
+// include in various places that may not know the specific messages they are
+// working with.
+//
+// If using flatcc prefer to include this file over any hard-to-handle flatcc
+// file such as flatbuffers_common_reader.h or flatbuffers_common_builder.h.
+//
+// NOTE: order matters for these includes so stop clang from messing with it:
+// clang-format off
+
+#include "flatcc/reflection/flatbuffers_common_reader.h" // IWYU pragma: export
+#include "iree/base/internal/flatcc/dummy_reader.h" // IWYU pragma: export
+
+#include "flatcc/flatcc_verifier.h" // IWYU pragma: export
+#include "iree/base/internal/flatcc/dummy_verifier.h" // IWYU pragma: export
+
+// clang-format on
+
+#endif // IREE_BASE_INTERNAL_FLATCC_PARSING_H_
diff --git a/iree/compiler/Dialect/HAL/Target/CUDA/BUILD b/iree/compiler/Dialect/HAL/Target/CUDA/BUILD
index b68b448..34d492f 100644
--- a/iree/compiler/Dialect/HAL/Target/CUDA/BUILD
+++ b/iree/compiler/Dialect/HAL/Target/CUDA/BUILD
@@ -41,7 +41,6 @@
],
deps = [
":cuda_libdevice",
- "//iree/base/internal:flatcc",
"//iree/compiler/Codegen:PassHeaders",
"//iree/compiler/Codegen/LLVMGPU",
"//iree/compiler/Dialect/HAL/Target",
diff --git a/iree/compiler/Dialect/HAL/Target/CUDA/CMakeLists.txt b/iree/compiler/Dialect/HAL/Target/CUDA/CMakeLists.txt
index 41e5302..727a183 100644
--- a/iree/compiler/Dialect/HAL/Target/CUDA/CMakeLists.txt
+++ b/iree/compiler/Dialect/HAL/Target/CUDA/CMakeLists.txt
@@ -55,7 +55,7 @@
MLIRPass
MLIRSupport
MLIRTargetLLVMIRExport
- iree::base::internal::flatcc
+ iree::base::internal::flatcc::building
iree::compiler::Codegen::LLVMGPU
iree::compiler::Dialect::HAL::Target
iree::compiler::Utils
diff --git a/iree/compiler/Dialect/HAL/Target/LLVM/BUILD b/iree/compiler/Dialect/HAL/Target/LLVM/BUILD
index 3359b98..3efb83e 100644
--- a/iree/compiler/Dialect/HAL/Target/LLVM/BUILD
+++ b/iree/compiler/Dialect/HAL/Target/LLVM/BUILD
@@ -35,7 +35,6 @@
":LLVMTargetOptions",
":LinkerTool",
":StaticLibraryGenerator",
- "//iree/base/internal:flatcc",
"//iree/compiler/Codegen:PassHeaders",
"//iree/compiler/Codegen/Common",
"//iree/compiler/Codegen/LLVMCPU",
diff --git a/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt b/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt
index 29c9514..5e80982 100644
--- a/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt
+++ b/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt
@@ -45,7 +45,6 @@
MLIRLLVMIR
MLIRLLVMToLLVMIRTranslation
MLIRTargetLLVMIRExport
- iree::base::internal::flatcc
iree::compiler::Codegen::Common
iree::compiler::Codegen::LLVMCPU
iree::compiler::Codegen::PassHeaders
diff --git a/iree/compiler/Dialect/HAL/Target/ROCM/BUILD b/iree/compiler/Dialect/HAL/Target/ROCM/BUILD
index 244ef51..4c02645 100644
--- a/iree/compiler/Dialect/HAL/Target/ROCM/BUILD
+++ b/iree/compiler/Dialect/HAL/Target/ROCM/BUILD
@@ -30,7 +30,6 @@
"ROCMTarget.h",
],
deps = [
- "//iree/base/internal:flatcc",
"//iree/compiler/Codegen:PassHeaders",
"//iree/compiler/Codegen/LLVMGPU",
"//iree/compiler/Dialect/HAL/Target",
diff --git a/iree/compiler/Dialect/HAL/Target/ROCM/CMakeLists.txt b/iree/compiler/Dialect/HAL/Target/ROCM/CMakeLists.txt
index 27fd906..6308dbf 100644
--- a/iree/compiler/Dialect/HAL/Target/ROCM/CMakeLists.txt
+++ b/iree/compiler/Dialect/HAL/Target/ROCM/CMakeLists.txt
@@ -37,7 +37,6 @@
MLIRROCDLToLLVMIRTranslation
MLIRSupport
MLIRTargetLLVMIRExport
- iree::base::internal::flatcc
iree::compiler::Codegen::LLVMGPU
iree::compiler::Codegen::PassHeaders
iree::compiler::Dialect::HAL::Target
diff --git a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/BUILD b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/BUILD
index d896b64..0345228 100644
--- a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/BUILD
+++ b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/BUILD
@@ -29,7 +29,6 @@
"VulkanSPIRVTarget.h",
],
deps = [
- "//iree/base/internal:flatcc",
"//iree/compiler/Codegen:PassHeaders",
"//iree/compiler/Codegen/Common",
"//iree/compiler/Codegen/SPIRV",
diff --git a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/CMakeLists.txt b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/CMakeLists.txt
index 13c0474..d7f4590 100644
--- a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/CMakeLists.txt
+++ b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/CMakeLists.txt
@@ -33,7 +33,6 @@
MLIRSPIRVSerialization
MLIRSupport
MLIRVector
- iree::base::internal::flatcc
iree::compiler::Codegen::Common
iree::compiler::Codegen::PassHeaders
iree::compiler::Codegen::SPIRV
diff --git a/iree/compiler/Dialect/VM/Transforms/GlobalInitialization.cpp b/iree/compiler/Dialect/VM/Transforms/GlobalInitialization.cpp
index fb982e9..5f2f0e1 100644
--- a/iree/compiler/Dialect/VM/Transforms/GlobalInitialization.cpp
+++ b/iree/compiler/Dialect/VM/Transforms/GlobalInitialization.cpp
@@ -243,18 +243,12 @@
deadOps.push_back(globalOp);
continue;
}
- bool isIndirect = false;
- bool isLoaded = false;
bool isStored = false;
for (auto use : uses.getValue()) {
if (isa<IREE::VM::GlobalAddressOp>(use.getUser())) {
// Can't analyze indirect variables; assume mutated.
- isLoaded = true;
isStored = true;
- isIndirect = true;
break;
- } else if (isGlobalLoadOp(use.getUser())) {
- isLoaded = true;
} else if (isGlobalStoreOp(use.getUser())) {
isStored = true;
}
diff --git a/iree/compiler/Utils/BUILD b/iree/compiler/Utils/BUILD
index cbec018..c30cec8 100644
--- a/iree/compiler/Utils/BUILD
+++ b/iree/compiler/Utils/BUILD
@@ -27,7 +27,9 @@
],
deps = [
"//iree/base:tracing",
- "//iree/base/internal:flatcc",
+ "//iree/base/internal/flatcc:building",
+ "//iree/base/internal/flatcc:debugging",
+ "//iree/base/internal/flatcc:parsing",
"//iree/compiler/Dialect/Util/IR",
"@llvm-project//llvm:Support",
"@llvm-project//mlir:IR",
diff --git a/iree/compiler/Utils/CMakeLists.txt b/iree/compiler/Utils/CMakeLists.txt
index bf3c510..9894b96 100644
--- a/iree/compiler/Utils/CMakeLists.txt
+++ b/iree/compiler/Utils/CMakeLists.txt
@@ -30,7 +30,9 @@
MLIRSupport
MLIRTransformUtils
MLIRTransforms
- iree::base::internal::flatcc
+ iree::base::internal::flatcc::building
+ iree::base::internal::flatcc::debugging
+ iree::base::internal::flatcc::parsing
iree::base::tracing
iree::compiler::Dialect::Util::IR
PUBLIC
diff --git a/iree/compiler/Utils/FlatbufferUtils.h b/iree/compiler/Utils/FlatbufferUtils.h
index 9289631..f4b003c 100644
--- a/iree/compiler/Utils/FlatbufferUtils.h
+++ b/iree/compiler/Utils/FlatbufferUtils.h
@@ -24,7 +24,9 @@
#include "mlir/Support/LogicalResult.h"
// clang-format off: order matters here as some of the LLVM includes conflict:
-#include "iree/base/internal/flatcc.h"
+#include "iree/base/internal/flatcc/building.h"
+#include "iree/base/internal/flatcc/debugging.h"
+#include "iree/base/internal/flatcc/parsing.h"
// clang-format on
namespace mlir {
diff --git a/iree/hal/cuda/BUILD b/iree/hal/cuda/BUILD
index 6ebe4c9..c3d6f02 100644
--- a/iree/hal/cuda/BUILD
+++ b/iree/hal/cuda/BUILD
@@ -62,8 +62,8 @@
"//iree/base:tracing",
"//iree/base/internal",
"//iree/base/internal:arena",
- "//iree/base/internal:flatcc",
"//iree/base/internal:synchronization",
+ "//iree/base/internal/flatcc:parsing",
"//iree/hal",
"//iree/hal/utils:deferred_command_buffer",
"//iree/schemas:cuda_executable_def_c_fbs",
diff --git a/iree/hal/cuda/CMakeLists.txt b/iree/hal/cuda/CMakeLists.txt
index 829c381..d3bd43b 100644
--- a/iree/hal/cuda/CMakeLists.txt
+++ b/iree/hal/cuda/CMakeLists.txt
@@ -53,7 +53,7 @@
iree::base::core_headers
iree::base::internal
iree::base::internal::arena
- iree::base::internal::flatcc
+ iree::base::internal::flatcc::parsing
iree::base::internal::synchronization
iree::base::tracing
iree::hal
diff --git a/iree/hal/cuda/native_executable.c b/iree/hal/cuda/native_executable.c
index 34833c7..eeed4bb 100644
--- a/iree/hal/cuda/native_executable.c
+++ b/iree/hal/cuda/native_executable.c
@@ -14,7 +14,7 @@
#include "iree/hal/cuda/status_util.h"
// flatcc schemas:
-#include "iree/base/internal/flatcc.h"
+#include "iree/base/internal/flatcc/parsing.h"
#include "iree/schemas/cuda_executable_def_reader.h"
#include "iree/schemas/cuda_executable_def_verifier.h"
diff --git a/iree/hal/local/loaders/BUILD b/iree/hal/local/loaders/BUILD
index 3d54ae9..0f354e3 100644
--- a/iree/hal/local/loaders/BUILD
+++ b/iree/hal/local/loaders/BUILD
@@ -61,7 +61,7 @@
"//iree/base:core_headers",
"//iree/base:tracing",
"//iree/base/internal:dynamic_library",
- "//iree/base/internal:flatcc",
+ "//iree/base/internal/flatcc:parsing",
"//iree/hal",
"//iree/hal/local",
"//iree/hal/local:executable_library",
diff --git a/iree/hal/local/loaders/CMakeLists.txt b/iree/hal/local/loaders/CMakeLists.txt
index fe5dd54..62f5641 100644
--- a/iree/hal/local/loaders/CMakeLists.txt
+++ b/iree/hal/local/loaders/CMakeLists.txt
@@ -59,7 +59,7 @@
iree::base
iree::base::core_headers
iree::base::internal::dynamic_library
- iree::base::internal::flatcc
+ iree::base::internal::flatcc::parsing
iree::base::tracing
iree::hal
iree::hal::local
diff --git a/iree/hal/local/loaders/system_library_loader.c b/iree/hal/local/loaders/system_library_loader.c
index 49f7337..0536dfc 100644
--- a/iree/hal/local/loaders/system_library_loader.c
+++ b/iree/hal/local/loaders/system_library_loader.c
@@ -18,7 +18,7 @@
#include "iree/hal/local/local_executable_layout.h"
// flatcc schemas:
-#include "iree/base/internal/flatcc.h"
+#include "iree/base/internal/flatcc/parsing.h"
#include "iree/schemas/dylib_executable_def_reader.h"
#include "iree/schemas/dylib_executable_def_verifier.h"
diff --git a/iree/hal/vulkan/BUILD b/iree/hal/vulkan/BUILD
index 5c385ba..97e243a 100644
--- a/iree/hal/vulkan/BUILD
+++ b/iree/hal/vulkan/BUILD
@@ -89,8 +89,8 @@
"//iree/base:logging",
"//iree/base:tracing",
"//iree/base/internal",
- "//iree/base/internal:flatcc",
"//iree/base/internal:synchronization",
+ "//iree/base/internal/flatcc:parsing",
"//iree/hal",
"//iree/hal/vulkan/util:arena",
"//iree/hal/vulkan/util:intrusive_list",
diff --git a/iree/hal/vulkan/CMakeLists.txt b/iree/hal/vulkan/CMakeLists.txt
index 5a15638..8126033 100644
--- a/iree/hal/vulkan/CMakeLists.txt
+++ b/iree/hal/vulkan/CMakeLists.txt
@@ -77,7 +77,7 @@
iree::base::cc
iree::base::core_headers
iree::base::internal
- iree::base::internal::flatcc
+ iree::base::internal::flatcc::parsing
iree::base::internal::synchronization
iree::base::logging
iree::base::tracing
diff --git a/iree/hal/vulkan/native_executable.cc b/iree/hal/vulkan/native_executable.cc
index 9c38dfb..0121292 100644
--- a/iree/hal/vulkan/native_executable.cc
+++ b/iree/hal/vulkan/native_executable.cc
@@ -20,7 +20,7 @@
#include "iree/hal/vulkan/util/ref_ptr.h"
// flatcc schemas:
-#include "iree/base/internal/flatcc.h"
+#include "iree/base/internal/flatcc/parsing.h"
#include "iree/schemas/spirv_executable_def_reader.h"
#include "iree/schemas/spirv_executable_def_verifier.h"
diff --git a/iree/tools/BUILD b/iree/tools/BUILD
index c114b29..c633808 100644
--- a/iree/tools/BUILD
+++ b/iree/tools/BUILD
@@ -86,6 +86,7 @@
deps = [
"//iree/base",
"//iree/base/internal:file_io",
+ "//iree/base/internal/flatcc:debugging",
"//iree/schemas:bytecode_module_def_c_fbs",
"//iree/tools/utils:vm_util",
],
diff --git a/iree/tools/CMakeLists.txt b/iree/tools/CMakeLists.txt
index 8c08184..0bee09c 100644
--- a/iree/tools/CMakeLists.txt
+++ b/iree/tools/CMakeLists.txt
@@ -130,6 +130,7 @@
flatcc::runtime
iree::base
iree::base::internal::file_io
+ iree::base::internal::flatcc::debugging
iree::schemas::bytecode_module_def_c_fbs
iree::tools::utils::vm_util
)
diff --git a/iree/vm/BUILD b/iree/vm/BUILD
index 9c200dc..daac376 100644
--- a/iree/vm/BUILD
+++ b/iree/vm/BUILD
@@ -197,7 +197,7 @@
"//iree/base:core_headers",
"//iree/base:tracing",
"//iree/base/internal",
- "//iree/base/internal:flatcc",
+ "//iree/base/internal/flatcc:parsing",
"//iree/schemas:bytecode_module_def_c_fbs",
],
)
diff --git a/iree/vm/CMakeLists.txt b/iree/vm/CMakeLists.txt
index 32971cb..0a239e4 100644
--- a/iree/vm/CMakeLists.txt
+++ b/iree/vm/CMakeLists.txt
@@ -182,7 +182,7 @@
iree::base
iree::base::core_headers
iree::base::internal
- iree::base::internal::flatcc
+ iree::base::internal::flatcc::parsing
iree::base::tracing
iree::schemas::bytecode_module_def_c_fbs
PUBLIC
diff --git a/iree/vm/bytecode_module_impl.h b/iree/vm/bytecode_module_impl.h
index a63cbf8..01031b1 100644
--- a/iree/vm/bytecode_module_impl.h
+++ b/iree/vm/bytecode_module_impl.h
@@ -19,7 +19,7 @@
#include "iree/vm/api.h"
// NOTE: include order matters:
-#include "iree/base/internal/flatcc.h"
+#include "iree/base/internal/flatcc/parsing.h"
#include "iree/schemas/bytecode_module_def_reader.h"
#include "iree/schemas/bytecode_module_def_verifier.h"