From 27ce5eb0de9f792f3e433bcb239c07d79371cf45 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 10 Sep 2021 16:31:26 -0400 Subject: First Slang LLVM integration (#1934) * #include an absolute path didn't work - because paths were taken to always be relative. * First integration with 'slang-llvm'. * Fix project. * Fix test output. * First pass assert support. * Add inline impls for min and max. * Add abs inline abs impl for llvm. * Make abs not use ternary op * Fix typo in slang-llvm.h * Sundary fixes to make remaining tests using llvm backend pass. --- source/compiler-core/slang-llvm-compiler.cpp | 54 ++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 source/compiler-core/slang-llvm-compiler.cpp (limited to 'source/compiler-core/slang-llvm-compiler.cpp') diff --git a/source/compiler-core/slang-llvm-compiler.cpp b/source/compiler-core/slang-llvm-compiler.cpp new file mode 100644 index 000000000..9b301ffab --- /dev/null +++ b/source/compiler-core/slang-llvm-compiler.cpp @@ -0,0 +1,54 @@ +// slang-llvm-compiler.cpp +#include "slang-llvm-compiler.h" + +#include "../core/slang-common.h" +#include "../../slang-com-helper.h" + +#include "../core/slang-blob.h" + +#include "../core/slang-string-util.h" +#include "../core/slang-string-slice-pool.h" + +#include "../core/slang-io.h" +#include "../core/slang-shared-library.h" +#include "../core/slang-semantic-version.h" +#include "../core/slang-char-util.h" + +#include "slang-include-system.h" +#include "slang-source-loc.h" + +#include "../core/slang-shared-library.h" + +namespace Slang +{ + +/* static */SlangResult LLVMDownstreamCompilerUtil::locateCompilers(const String& path, ISlangSharedLibraryLoader* loader, DownstreamCompilerSet* set) +{ + ComPtr library; + + SLANG_RETURN_ON_FAIL(DownstreamCompilerUtil::loadSharedLibrary(path, loader, nullptr, "slang-llvm", library)); + + SLANG_ASSERT(library); + if (!library) + { + return SLANG_FAIL; + } + + typedef SlangResult(*CreateDownstreamCompilerFunc)(RefPtr& out); + + auto fn = (CreateDownstreamCompilerFunc)library->findFuncByName("createLLVMDownstreamCompiler"); + if (!fn) + { + return SLANG_FAIL; + } + + RefPtr downstreamCompiler; + + SLANG_RETURN_ON_FAIL(fn(downstreamCompiler)); + + set->addSharedLibrary(library); + set->addCompiler(downstreamCompiler); + return SLANG_OK; +} + +} -- cgit v1.2.3