diff options
author | Alexey Sotkin <alexey.sotkin@intel.com> | 2018-04-03 17:00:46 +0300 |
---|---|---|
committer | Alexey Sotkin <alexey.sotkin@intel.com> | 2018-04-03 17:17:38 +0300 |
commit | 0f1efec411c52d4757b025a69295cee066e356af (patch) | |
tree | 4b41e89b603cbc147f973d59dfa32d6d01927a8e | |
parent | d3f156ca58143ddb82c6c36d209ea2c2873d5996 (diff) |
Reorganizing the SPIR-V/LLVM Translator tree
Before this commit the SPIR-V/LLVM Translator was part of the LLVM tree.
The history has been rewritten before this commit, so everything not related to
SPIR-V was removed with git filter-branch. Some directories were moved around to
be in accordance with http://llvm.org/docs/Projects.html#source-tree-layout
Also adding CMakeLists.txt and LIT config files.
-rw-r--r-- | CMakeLists.txt | 15 | ||||
-rw-r--r-- | lib/SPIRV/CMakeLists.txt | 6 | ||||
-rw-r--r-- | test/CMakeLists.txt | 18 | ||||
-rw-r--r-- | test/lit.cfg.py | 41 | ||||
-rw-r--r-- | test/lit.site.cfg.py.in | 31 | ||||
-rw-r--r-- | tools/llvm-spirv/CMakeLists.txt | 7 |
6 files changed, 113 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..ec95845 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,15 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 3.3) + +# Name & Version +PROJECT(LLVM_SPIRV + VERSION 0.1.0.0 + LANGUAGES CXX) + +message(STATUS "LLVM-SPIRV found at ${CMAKE_CURRENT_SOURCE_DIR}") +set(LLVM_SPIRV_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include) +set(LLVM_SPIRV_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +SUBDIRS(lib/SPIRV tools/llvm-spirv test) diff --git a/lib/SPIRV/CMakeLists.txt b/lib/SPIRV/CMakeLists.txt index d313439..fc593b4 100644 --- a/lib/SPIRV/CMakeLists.txt +++ b/lib/SPIRV/CMakeLists.txt @@ -1,6 +1,8 @@ -include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/libSPIRV
+include_directories(
+ ${LLVM_SPIRV_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/Mangler
- ${CMAKE_CURRENT_SOURCE_DIR}/..)
+ ${CMAKE_CURRENT_SOURCE_DIR}/libSPIRV
+ ${CMAKE_CURRENT_SOURCE_DIR})
option(SPIRV_USE_LLVM_API "Enable usage of LLVM API for libSPIRV." ON)
if ( SPIRV_USE_LLVM_API )
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..54d4901 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,18 @@ +configure_lit_site_cfg( + ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in + ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py + MAIN_CONFIG + ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py + ) + +list(APPEND LLVM_SPIRV_TEST_DEPS + FileCheck count not + llvm-as + llvm-dis + llvm-spirv +) + +add_lit_testsuite(check-llvm-spirv "Running the LLVM-SPIRV regression tests" + ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${LLVM_SPIRV_TEST_DEPS} + ) diff --git a/test/lit.cfg.py b/test/lit.cfg.py new file mode 100644 index 0000000..ac60d2d --- /dev/null +++ b/test/lit.cfg.py @@ -0,0 +1,41 @@ +# -*- Python -*- + +import lit.formats +import lit.util + +from lit.llvm import llvm_config +from lit.llvm.subst import ToolSubst +from lit.llvm.subst import FindTool + +# Configuration file for the 'lit' test runner. + +# name: The name of this test suite. +config.name = 'LLVM_SPIRV' + +# testFormat: The test format to use to interpret tests. +config.test_format = lit.formats.ShTest(True) + +# suffixes: A list of file extensions to treat as test files. +config.suffixes = ['.ll', '.spt'] + +# excludes: A list of directories and fles to exclude from the testsuite. +config.excludes = ['CMakeLists.txt'] + +# test_source_root: The root path where tests are located. +config.test_source_root = os.path.dirname(__file__) + +# test_exec_root: The root path where tests should be run. +config.test_exec_root = os.path.join(config.llvm_obj_root, 'test') + +llvm_config.use_default_substitutions() + +#llvm_config.use_clang() + +config.substitutions.append(('%PATH%', config.environment['PATH'])) + +tool_dirs = [config.llvm_tools_dir] + +tools = ['llvm-as', 'llvm-dis', 'llvm-spirv'] + +llvm_config.add_tool_substitutions(tools, tool_dirs) + diff --git a/test/lit.site.cfg.py.in b/test/lit.site.cfg.py.in new file mode 100644 index 0000000..32af69f --- /dev/null +++ b/test/lit.site.cfg.py.in @@ -0,0 +1,31 @@ +@LIT_SITE_CFG_IN_HEADER@ + +import sys + +config.llvm_src_root = "@LLVM_SOURCE_DIR@" +config.llvm_obj_root = "@LLVM_BINARY_DIR@" +config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" +config.llvm_libs_dir = "@LLVM_LIBS_DIR@" +config.llvm_shlib_dir = "@SHLIBDIR@" +config.llvm_plugin_ext = "@LLVM_PLUGIN_EXT@" +config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" +config.host_triple = "@LLVM_HOST_TRIPLE@" +config.target_triple = "@TARGET_TRIPLE@" +config.host_arch = "@HOST_ARCH@" +config.python_executable = "@PYTHON_EXECUTABLE@" + +# Support substitution of the tools and libs dirs with user parameters. This is +# used when we can't determine the tool dir at configuration time. +try: + config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params + config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params + config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params +except KeyError: + e = sys.exc_info()[1] + key, = e.args + lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key)) + +@LIT_SITE_CFG_IN_FOOTER@ + +# Let the main config do the real work. +lit_config.load_config(config, "@LLVM_SPIRV_SOURCE_DIR@/test/lit.cfg.py") diff --git a/tools/llvm-spirv/CMakeLists.txt b/tools/llvm-spirv/CMakeLists.txt index d868689..f4d41a9 100644 --- a/tools/llvm-spirv/CMakeLists.txt +++ b/tools/llvm-spirv/CMakeLists.txt @@ -2,13 +2,14 @@ set(LLVM_LINK_COMPONENTS Analysis
BitReader
BitWriter
- IPO
- SPIRVLib
Core
+ SPIRVLib
Support
- TransformUtils + TransformUtils
)
+include_directories(${LLVM_SPIRV_INCLUDE_DIRS})
+
add_llvm_tool(llvm-spirv
llvm-spirv.cpp
)
|