diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2023-03-27 22:52:48 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-27 19:52:48 -0700 |
| commit | d120fec7e81bbd5e8cf2c551b573feaf6678b43d (patch) | |
| tree | 2171333e6dd1132e310c1dd125e2e84c4add780d /source | |
| parent | 579870b714e76cc92300cef1fdf091993bb55954 (diff) | |
Upgrade `slang-llvm` (#2741)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Fix SlangCompileTarget to keep ordering.
* Add test.
Remove V2 version of interface to access IDownstreamCompiler
Update to slang-llvm which has _chkstk support.
* Update slang.h
Co-authored-by: Ellie Hermaszewska <github@sub.monoid.al>
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Co-authored-by: Ellie Hermaszewska <github@sub.monoid.al>
Diffstat (limited to 'source')
| -rw-r--r-- | source/compiler-core/slang-downstream-compiler.h | 3 | ||||
| -rw-r--r-- | source/compiler-core/slang-llvm-compiler.cpp | 49 |
2 files changed, 1 insertions, 51 deletions
diff --git a/source/compiler-core/slang-downstream-compiler.h b/source/compiler-core/slang-downstream-compiler.h index 3cd27138f..19f241ccf 100644 --- a/source/compiler-core/slang-downstream-compiler.h +++ b/source/compiler-core/slang-downstream-compiler.h @@ -264,9 +264,6 @@ struct name##_AliasDepreciated##id \ static const ptrdiff_t kEnd = SLANG_OFFSET_OF(name, lastField) + sizeof(name::lastField); \ }; -// Specifies via kStart/kEnd a slice of a type that is the previous version. -SLANG_ALIAS_DEPRECIATED_VERSION(DownstreamCompileOptions, 1, optimizationLevel, sourceManager) - /* Used to indicate what kind of products are expected to be produced for a compilation. */ typedef uint32_t DownstreamProductFlags; struct DownstreamProductFlag diff --git a/source/compiler-core/slang-llvm-compiler.cpp b/source/compiler-core/slang-llvm-compiler.cpp index b34c05d42..88446f605 100644 --- a/source/compiler-core/slang-llvm-compiler.cpp +++ b/source/compiler-core/slang-llvm-compiler.cpp @@ -6,42 +6,6 @@ namespace Slang { -class AliasDepreciatedDownstreamCompiler : public DownstreamCompilerBase -{ -public: - - virtual SLANG_NO_THROW SlangResult SLANG_MCALL compile(const CompileOptions& options, IArtifact** outArtifact) SLANG_OVERRIDE; - virtual SLANG_NO_THROW bool SLANG_MCALL canConvert(const ArtifactDesc& from, const ArtifactDesc& to) SLANG_OVERRIDE { return m_inner->canConvert(from, to); } - virtual SLANG_NO_THROW SlangResult SLANG_MCALL convert(IArtifact* from, const ArtifactDesc& to, IArtifact** outArtifact) SLANG_OVERRIDE { return m_inner->convert(from, to, outArtifact); } - virtual SLANG_NO_THROW SlangResult SLANG_MCALL getVersionString(slang::IBlob** outVersionString) { return m_inner->getVersionString(outVersionString); } - virtual SLANG_NO_THROW bool SLANG_MCALL isFileBased() { return m_inner->isFileBased(); } - - template <typename T> - void initCompileOptionsDepreciated() - { - m_compileOptionsOffset = T::kStart; - } - - AliasDepreciatedDownstreamCompiler(IDownstreamCompiler* inner) : - m_inner(inner) - { - m_desc = inner->getDesc(); - } - - ComPtr<IDownstreamCompiler> m_inner; - ptrdiff_t m_compileOptionsOffset = 0; -}; - -SlangResult AliasDepreciatedDownstreamCompiler::compile(const CompileOptions& options, IArtifact** outArtifact) -{ - if (m_compileOptionsOffset == 0) - { - return m_inner->compile(options, outArtifact); - } - const uint8_t* ptr = ((const uint8_t*)&options) + m_compileOptionsOffset; - return m_inner->compile(*(const CompileOptions*)ptr, outArtifact); -} - /* static */SlangResult LLVMDownstreamCompilerUtil::locateCompilers(const String& path, ISlangSharedLibraryLoader* loader, DownstreamCompilerSet* set) { ComPtr<ISlangSharedLibrary> library; @@ -58,18 +22,7 @@ SlangResult AliasDepreciatedDownstreamCompiler::compile(const CompileOptions& op ComPtr<IDownstreamCompiler> downstreamCompiler; - if (auto fnV2 = (CreateDownstreamCompilerFunc)library->findFuncByName("createLLVMDownstreamCompiler_V2")) - { - ComPtr<IDownstreamCompiler> innerDownstreamCompiler; - - SLANG_RETURN_ON_FAIL(fnV2(IDownstreamCompiler::getTypeGuid(), innerDownstreamCompiler.writeRef())); - - // We then need to wrap - AliasDepreciatedDownstreamCompiler* fix = new AliasDepreciatedDownstreamCompiler(innerDownstreamCompiler); - downstreamCompiler = fix; - fix->initCompileOptionsDepreciated<DownstreamCompileOptions_AliasDepreciated1>(); - } - else if (auto fnV3 = (CreateDownstreamCompilerFunc)library->findFuncByName("createLLVMDownstreamCompiler_V3")) + if (auto fnV3 = (CreateDownstreamCompilerFunc)library->findFuncByName("createLLVMDownstreamCompiler_V3")) { SLANG_RETURN_ON_FAIL(fnV3(IDownstreamCompiler::getTypeGuid(), downstreamCompiler.writeRef())); } |
