summaryrefslogtreecommitdiffstats
path: root/source/compiler-core/slang-llvm-compiler.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2021-09-10 16:31:26 -0400
committerGitHub <noreply@github.com>2021-09-10 13:31:26 -0700
commit27ce5eb0de9f792f3e433bcb239c07d79371cf45 (patch)
treebb85155ceafd280a3931432141fc1cc1dae20959 /source/compiler-core/slang-llvm-compiler.cpp
parent28adf8917e53953dbfebd746410a427a55eed814 (diff)
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.
Diffstat (limited to 'source/compiler-core/slang-llvm-compiler.cpp')
-rw-r--r--source/compiler-core/slang-llvm-compiler.cpp54
1 files changed, 54 insertions, 0 deletions
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<ISlangSharedLibrary> 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<DownstreamCompiler>& out);
+
+ auto fn = (CreateDownstreamCompilerFunc)library->findFuncByName("createLLVMDownstreamCompiler");
+ if (!fn)
+ {
+ return SLANG_FAIL;
+ }
+
+ RefPtr<DownstreamCompiler> downstreamCompiler;
+
+ SLANG_RETURN_ON_FAIL(fn(downstreamCompiler));
+
+ set->addSharedLibrary(library);
+ set->addCompiler(downstreamCompiler);
+ return SLANG_OK;
+}
+
+}