summaryrefslogtreecommitdiff
path: root/source/compiler-core/slang-downstream-compiler.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2022-08-16 18:19:56 -0400
committerGitHub <noreply@github.com>2022-08-16 18:19:56 -0400
commite68fab2bda5d979f8d991fc41122bb9aa71849a6 (patch)
tree0d07c5d3b957a23065fc61d8a4ad6c2c1726652d /source/compiler-core/slang-downstream-compiler.h
parenta10a94dcb86e51d74d7c545d99d98110f88e3081 (diff)
IDownstreamCompiler interface (#2361)
* WIP with hierarchical enums. * Some small fixes and improvements around artifact desc related types. * Improvements around hierarchical enum. * Fixes to get Artifact types refactor to be able to execute tests. * Attempt to better categorize PTX. * Work around for potentially unused function warning. * Typo fix. * Simplify Artifact header. * Small improvements around Artifact kind/payload/style. * Added IDestroyable/ICastable * Add IArtifactList. * First impl of IArtifactUtil. * Use the ICastable interface for IArtifactRepresentation. * Added IArtifactRepresentation & IArtifactAssociated. * Add SLANG_OVERRIDE to avoid gcc/clang warning. * Fix calling convention issue on win32. * Fix missing SLANG_OVERRIDE. * First attempt at file abstraction around Artifact. * Added creation of lock file. * Move functionality for determining file paths to the IArtifactUtil. Add casting to ICastable. * Added some casting/finding mechanisms. * Simplify IArtifact interface, and use Items for file reps. * Fix problem with libraries on DXIL. * Split out ArtifactRepresentation. * Move ArtifactDesc functionality to ArtifactDescUtil. ArtifactInfoUtil becomes ArtifactDescUtil. * Split implementations from the interfaces for Artifact. * Use TypeTextUtil for target name outputting. * Add artifact impls. * Add ICastableList * Added UnknownCastableAdapter * Make ISlangSharedLibrary derive from ICastable, and remain backwards compatible with slang-llvm. * Refactor Representation on Artifact. * Make our ISlangBlobs also derive from ICastable. Make ISlangBlob atomic ref counted. * Split out CastableList and related types, and placed in core. * Small fixes around IArtifact. Improve IArtifact docs. First impl of getChildren for IArtifact. * Documentation improvements for Artifact related types. * Fix typo. * Special case adding a ICastableList to a LazyCastableList. * Small simplification of LazyCastableList, by adding State member. * Removed the ILockFile interface because IFileArtifactRepresentation can be used. * Implement DiagnosticsArtifactRepresentation. * Added PostEmitMetadataArtifactRepresentation * Add searching by predicate. Added handling of accessing Artifact as ISharedLibrary * Fix typo. * Add find to IArtifacgtList. Fix some missing SLANG_NO_THROW. * Small improvements around ArtifactDesc types. * Another small change around ArtifactKind. * Some more shuffling of ArtifactDesc. * Make IArtifact castable Remove IArtifactList Made IArtifactContainer derive from IArtifact Made ModuleLibrary atomic ref counted/given IModuleLibrary interface. * Must call _requireChildren before any children access. * Fix missing SLANG_MCALL on castAs. * Fix missing SLANG_OVERRIDE. * Added IArtifactHandler * Use ICastable for basis of scope/lookup. * WIP first attempt to remove CompileResult. * Fix support for for downstream compiler shared library adapter. * Fix issues found when replacing CompileResult. * Fix typo. * Fix getting items form 'significant' member of an Artifact. * Split out ArtifactUtil & ArtifactHandler. * Work around for problem on Visual studio. * Improve searching. * Add missing files. * Split out Artifact associated types. Don't produce a container by default - use associated for 'metadata'. * Remove no longer used ArtifactPayload type. * Generalized converting representations. Small improvements to artifacts. * Fix intermediate dumping issue. * Removed #if 0 out CompileResult. Remove DownstreamCompileResult maybeDumpIntermediate. * Pull out functionality for dumping artifact output into ArtifactOutputUtil Fixed a bug in naming files based on ArtifactDesc. * std::atomic issue. * Pull out types from DownstreamCompile to simplify moving to an interface. * Fix typo. * Use IDownstreamCompiler interface. Split out DownstreamCompilerUtil and DownstreamCompilerSet. * Update projects. * Fix missing SLANG_MCALL. * Fix calling convention of IDownstreamCompiler impls. * Split out binary work arounds into a dep1.cpp/h * Small reorganising around DownstreamCompilerInfo. * Remove Desc library functionality to DownstreamCompilerUtil. * Expand IDiagnostics interface. Rename associated impls with Impl suffix. * Fix outputting as text bug. Some small improvements. * Add fix around prefix for dumping. Improved how handling for extensions work form ArtifactDesc. * Dump assembly if available. * Simplify some of Dep1 definitions.
Diffstat (limited to 'source/compiler-core/slang-downstream-compiler.h')
-rw-r--r--source/compiler-core/slang-downstream-compiler.h401
1 files changed, 133 insertions, 268 deletions
diff --git a/source/compiler-core/slang-downstream-compiler.h b/source/compiler-core/slang-downstream-compiler.h
index 666ca5568..ece6c1c51 100644
--- a/source/compiler-core/slang-downstream-compiler.h
+++ b/source/compiler-core/slang-downstream-compiler.h
@@ -155,88 +155,48 @@ protected:
ComPtr<ISlangBlob> m_blob;
};
-// Combination of a downstream compiler type (pass through) and
-// a match version.
-struct DownstreamCompilerMatchVersion
+// Compiler description
+struct DownstreamCompilerDesc
{
- DownstreamCompilerMatchVersion(SlangPassThrough inType, MatchSemanticVersion inMatchVersion):
- type(inType),
- matchVersion(inMatchVersion)
- {}
+ typedef DownstreamCompilerDesc ThisType;
- DownstreamCompilerMatchVersion():type(SLANG_PASS_THROUGH_NONE) {}
+ HashCode getHashCode() const { return combineHash(HashCode(type), combineHash(HashCode(majorVersion), HashCode(minorVersion))); }
+ bool operator==(const ThisType& rhs) const { return type == rhs.type && majorVersion == rhs.majorVersion && minorVersion == rhs.minorVersion; }
+ bool operator!=(const ThisType& rhs) const { return !(*this == rhs); }
- SlangPassThrough type; ///< The type of the compiler
- MatchSemanticVersion matchVersion; ///< The match version
-};
+ /// Get the version as a value
+ Int getVersionValue() const { return majorVersion * 100 + minorVersion; }
-class DownstreamCompiler: public RefObject
-{
-public:
- typedef RefObject Super;
+ /// true if has a version set
+ bool hasVersion() const { return majorVersion || minorVersion; }
- typedef DownstreamCompileResult CompileResult;
+ /// Ctor
+ explicit DownstreamCompilerDesc(SlangPassThrough inType = SLANG_PASS_THROUGH_NONE, Int inMajorVersion = 0, Int inMinorVersion = 0) :type(inType), majorVersion(inMajorVersion), minorVersion(inMinorVersion) {}
- typedef uint32_t SourceLanguageFlags;
- struct SourceLanguageFlag
- {
- enum Enum : SourceLanguageFlags
- {
- Unknown = SourceLanguageFlags(1) << SLANG_SOURCE_LANGUAGE_UNKNOWN,
- Slang = SourceLanguageFlags(1) << SLANG_SOURCE_LANGUAGE_SLANG,
- HLSL = SourceLanguageFlags(1) << SLANG_SOURCE_LANGUAGE_HLSL,
- GLSL = SourceLanguageFlags(1) << SLANG_SOURCE_LANGUAGE_GLSL,
- C = SourceLanguageFlags(1) << SLANG_SOURCE_LANGUAGE_C,
- CPP = SourceLanguageFlags(1) << SLANG_SOURCE_LANGUAGE_CPP,
- CUDA = SourceLanguageFlags(1) << SLANG_SOURCE_LANGUAGE_CUDA,
- };
- };
+ explicit DownstreamCompilerDesc(SlangPassThrough inType, const SemanticVersion& version) :type(inType), majorVersion(version.m_major), minorVersion(version.m_minor) {}
- struct Info
- {
- Info():sourceLanguageFlags(0) {}
+ SlangPassThrough type; ///< The type of the compiler
- Info(SourceLanguageFlags inSourceLanguageFlags):
- sourceLanguageFlags(inSourceLanguageFlags)
- {}
- SourceLanguageFlags sourceLanguageFlags;
- };
- struct Infos
- {
- Info infos[int(SLANG_PASS_THROUGH_COUNT_OF)];
- };
+ /// TODO(JS): Would probably be better if changed to SemanticVersion, but not trivial to change
+ // because this type is part of the DownstreamCompiler interface, which is used with `slang-llvm`.
+ Int majorVersion; ///< Major version (interpretation is type specific)
+ Int minorVersion; ///< Minor version (interpretation is type specific)
+};
-
- // Compiler description
- struct Desc
+struct DownstreamCompileOptions
+{
+ typedef uint32_t Flags;
+ struct Flag
{
- typedef Desc ThisType;
-
- HashCode getHashCode() const { return combineHash(HashCode(type), combineHash(HashCode(majorVersion), HashCode(minorVersion))); }
- bool operator==(const ThisType& rhs) const { return type == rhs.type && majorVersion == rhs.majorVersion && minorVersion == rhs.minorVersion; }
- bool operator!=(const ThisType& rhs) const { return !(*this == rhs); }
-
- /// Get the version as a value
- Int getVersionValue() const { return majorVersion * 100 + minorVersion; }
-
- void appendAsText(StringBuilder& out) const;
- /// true if has a version set
- bool hasVersion() const { return majorVersion || minorVersion; }
-
- /// Ctor
- explicit Desc(SlangPassThrough inType = SLANG_PASS_THROUGH_NONE, Int inMajorVersion = 0, Int inMinorVersion = 0):type(inType), majorVersion(inMajorVersion), minorVersion(inMinorVersion) {}
-
- explicit Desc(SlangPassThrough inType, const SemanticVersion& version):type(inType), majorVersion(version.m_major), minorVersion(version.m_minor) {}
-
- SlangPassThrough type; ///< The type of the compiler
-
- /// TODO(JS): Would probably be better if changed to SemanticVersion, but not trivial to change
- // because this type is part of the DownstreamCompiler interface, which is used with `slang-llvm`.
- Int majorVersion; ///< Major version (interpretation is type specific)
- Int minorVersion; ///< Minor version (interpretation is type specific)
+ enum Enum : Flags
+ {
+ EnableExceptionHandling = 0x01, ///< Enables exception handling support (say as optionally supported by C++)
+ Verbose = 0x02, ///< Give more verbose diagnostics
+ EnableSecurityChecks = 0x04, ///< Enable runtime security checks (such as for buffer overruns) - enabling typically decreases performance
+ EnableFloat16 = 0x08, ///< If set compiles with support for float16/half
+ };
};
-
enum class OptimizationLevel
{
None, ///< Don't optimize at all.
@@ -254,7 +214,7 @@ public:
};
enum class FloatingPointMode
{
- Default,
+ Default,
Fast,
Precise,
};
@@ -284,119 +244,122 @@ public:
SemanticVersion version;
};
- struct CompileOptions
- {
- typedef uint32_t Flags;
- struct Flag
- {
- enum Enum : Flags
- {
- EnableExceptionHandling = 0x01, ///< Enables exception handling support (say as optionally supported by C++)
- Verbose = 0x02, ///< Give more verbose diagnostics
- EnableSecurityChecks = 0x04, ///< Enable runtime security checks (such as for buffer overruns) - enabling typically decreases performance
- EnableFloat16 = 0x08, ///< If set compiles with support for float16/half
- };
- };
-
- OptimizationLevel optimizationLevel = OptimizationLevel::Default;
- DebugInfoType debugInfoType = DebugInfoType::Standard;
- SlangCompileTarget targetType = SLANG_HOST_EXECUTABLE;
- SlangSourceLanguage sourceLanguage = SLANG_SOURCE_LANGUAGE_CPP;
- FloatingPointMode floatingPointMode = FloatingPointMode::Default;
- PipelineType pipelineType = PipelineType::Unknown;
- SlangMatrixLayoutMode matrixLayout = SLANG_MATRIX_LAYOUT_MODE_UNKNOWN;
+ OptimizationLevel optimizationLevel = OptimizationLevel::Default;
+ DebugInfoType debugInfoType = DebugInfoType::Standard;
+ SlangCompileTarget targetType = SLANG_HOST_EXECUTABLE;
+ SlangSourceLanguage sourceLanguage = SLANG_SOURCE_LANGUAGE_CPP;
+ FloatingPointMode floatingPointMode = FloatingPointMode::Default;
+ PipelineType pipelineType = PipelineType::Unknown;
+ SlangMatrixLayoutMode matrixLayout = SLANG_MATRIX_LAYOUT_MODE_UNKNOWN;
- Flags flags = Flag::EnableExceptionHandling;
+ Flags flags = Flag::EnableExceptionHandling;
- PlatformKind platform = PlatformKind::Unknown;
+ PlatformKind platform = PlatformKind::Unknown;
- /// The path/name of the output module. Should not have the extension, as that will be added for each of the target types.
- /// If not set a module path will be internally generated internally on a command line based compiler
- String modulePath;
+ /// The path/name of the output module. Should not have the extension, as that will be added for each of the target types.
+ /// If not set a module path will be internally generated internally on a command line based compiler
+ String modulePath;
- List<Define> defines;
+ List<Define> defines;
- /// The contents of the source to compile. This can be empty is sourceFiles is set.
- /// If the compiler is a commandLine file this source will be written to a temporary file.
- String sourceContents;
- /// 'Path' that the contents originated from. NOTE! This is for reporting only and doesn't have to exist on file system
- String sourceContentsPath;
+ /// The contents of the source to compile. This can be empty is sourceFiles is set.
+ /// If the compiler is a commandLine file this source will be written to a temporary file.
+ String sourceContents;
+ /// 'Path' that the contents originated from. NOTE! This is for reporting only and doesn't have to exist on file system
+ String sourceContentsPath;
- /// The names/paths of source to compile. This can be empty if sourceContents is set.
- List<String> sourceFiles;
+ /// The names/paths of source to compile. This can be empty if sourceContents is set.
+ List<String> sourceFiles;
- List<String> includePaths;
- List<String> libraryPaths;
+ List<String> includePaths;
+ List<String> libraryPaths;
- /// Libraries to link against.
- List<ComPtr<IArtifact>> libraries;
+ /// Libraries to link against.
+ List<ComPtr<IArtifact>> libraries;
- List<CapabilityVersion> requiredCapabilityVersions;
+ List<CapabilityVersion> requiredCapabilityVersions;
- /// For compilers/compiles that require an entry point name, else can be empty
- String entryPointName;
- /// Profile name to use, only required for compiles that need to compile against a a specific profiles.
- /// Profile names are tied to compilers and targets.
- String profileName;
+ /// For compilers/compiles that require an entry point name, else can be empty
+ String entryPointName;
+ /// Profile name to use, only required for compiles that need to compile against a a specific profiles.
+ /// Profile names are tied to compilers and targets.
+ String profileName;
- /// The stage being compiled for
- SlangStage stage = SLANG_STAGE_NONE;
+ /// The stage being compiled for
+ SlangStage stage = SLANG_STAGE_NONE;
- /// Arguments that are specific to a particular compiler implementation.
- List<String> compilerSpecificArguments;
+ /// Arguments that are specific to a particular compiler implementation.
+ List<String> compilerSpecificArguments;
- /// NOTE! Not all downstream compilers can use the fileSystemExt/sourceManager. This option will be ignored in those scenarios.
- ISlangFileSystemExt* fileSystemExt = nullptr;
- SourceManager* sourceManager = nullptr;
- };
+ /// NOTE! Not all downstream compilers can use the fileSystemExt/sourceManager. This option will be ignored in those scenarios.
+ ISlangFileSystemExt* fileSystemExt = nullptr;
+ SourceManager* sourceManager = nullptr;
+};
- typedef uint32_t ProductFlags;
- struct ProductFlag
+/* Used to indicate what kind of products are expected to be produced for a compilation. */
+typedef uint32_t DownstreamProductFlags;
+struct DownstreamProductFlag
+{
+ enum Enum : DownstreamProductFlags
{
- enum Enum : ProductFlags
- {
- Debug = 0x1, ///< Used by debugger during execution
- Execution = 0x2, ///< Required for execution
- Compile = 0x4, ///< A product *required* for compilation
- Miscellaneous = 0x8, ///< Anything else
- };
- enum Mask : ProductFlags
- {
- All = 0xf, ///< All the flags
- };
+ Debug = 0x1, ///< Used by debugger during execution
+ Execution = 0x2, ///< Required for execution
+ Compile = 0x4, ///< A product *required* for compilation
+ Miscellaneous = 0x8, ///< Anything else
};
-
- enum class Product
+ enum Mask : DownstreamProductFlags
{
- DebugRun,
- Run,
- CompileTemporary,
- All,
+ All = 0xf, ///< All the flags
};
+};
+
+class IDownstreamCompiler : public ICastable
+{
+public:
+ SLANG_COM_INTERFACE(0x167b8ba7, 0xbd41, 0x469a, { 0x92, 0x28, 0xb8, 0x53, 0xc8, 0xea, 0x56, 0x6d })
+
+ typedef DownstreamCompilerDesc Desc;
+ typedef DownstreamCompileOptions CompileOptions;
+ typedef DownstreamCompileResult CompileResult;
+
+ typedef CompileOptions::OptimizationLevel OptimizationLevel;
+ typedef CompileOptions::DebugInfoType DebugInfoType;
+ typedef CompileOptions::FloatingPointMode FloatingPointMode;
+ typedef CompileOptions::PipelineType PipelineType;
+ typedef CompileOptions::Define Define;
+ typedef CompileOptions::CapabilityVersion CapabilityVersion;
/// Get the desc of this compiler
- const Desc& getDesc() const { return m_desc; }
+ virtual SLANG_NO_THROW const Desc& SLANG_MCALL getDesc() = 0;
/// Compile using the specified options. The result is in resOut
- virtual SlangResult compile(const CompileOptions& options, RefPtr<DownstreamCompileResult>& outResult) = 0;
+ virtual SLANG_NO_THROW SlangResult SLANG_MCALL compile(const CompileOptions& options, RefPtr<DownstreamCompileResult>& outResult) = 0;
/// Some compilers have support converting a binary blob into disassembly. Output disassembly is held in the output blob
- virtual SlangResult disassemble(SlangCompileTarget sourceBlobTarget, const void* blob, size_t blobSize, ISlangBlob** out);
+ virtual SLANG_NO_THROW SlangResult SLANG_MCALL disassemble(SlangCompileTarget sourceBlobTarget, const void* blob, size_t blobSize, ISlangBlob** out) = 0;
/// True if underlying compiler uses file system to communicate source
- virtual bool isFileBased() = 0;
+ virtual SLANG_NO_THROW bool SLANG_MCALL isFileBased() = 0;
+};
- /// Get info for a compiler type
- static const Info& getInfo(SlangPassThrough compiler) { return s_infos.infos[int(compiler)]; }
- /// True if this compiler can compile the specified language
- static bool canCompile(SlangPassThrough compiler, SlangSourceLanguage sourceLanguage);
+class DownstreamCompilerBase : public ComBaseObject, public IDownstreamCompiler
+{
+public:
+ SLANG_COM_BASE_IUNKNOWN_ALL
-
-protected:
- static Infos s_infos;
+ // ICastable
+ virtual SLANG_NO_THROW void* SLANG_MCALL castAs(const Guid& guid) SLANG_OVERRIDE;
+
+ // IDownstreamCompiler
+ virtual SLANG_NO_THROW const Desc& SLANG_MCALL getDesc() SLANG_OVERRIDE { return m_desc; }
+ virtual SLANG_NO_THROW SlangResult SLANG_MCALL disassemble(SlangCompileTarget sourceBlobTarget, const void* blob, size_t blobSize, ISlangBlob** out) SLANG_OVERRIDE;
- DownstreamCompiler(const Desc& desc) :
+ DownstreamCompilerBase(const Desc& desc):
m_desc(desc)
- {}
- DownstreamCompiler() {}
+ {
+ }
+ DownstreamCompilerBase() {}
+
+ void* getInterface(const Guid& guid);
+ void* getObject(const Guid& guid);
Desc m_desc;
};
@@ -421,20 +384,20 @@ public:
protected:
String m_moduleFilePath;
- DownstreamCompiler::CompileOptions m_options;
+ DownstreamCompileOptions m_options;
ComPtr<ISlangBlob> m_binaryBlob;
/// Cache of the shared library if appropriate
ComPtr<ISlangSharedLibrary> m_hostCallableSharedLibrary;
};
-class CommandLineDownstreamCompiler : public DownstreamCompiler
+class CommandLineDownstreamCompiler : public DownstreamCompilerBase
{
public:
- typedef DownstreamCompiler Super;
+ typedef DownstreamCompilerBase Super;
- // DownstreamCompiler
- virtual SlangResult compile(const CompileOptions& options, RefPtr<DownstreamCompileResult>& outResult) SLANG_OVERRIDE;
- virtual bool isFileBased() SLANG_OVERRIDE { return true; }
+ // IDownstreamCompiler
+ virtual SLANG_NO_THROW SlangResult SLANG_MCALL compile(const CompileOptions& options, RefPtr<DownstreamCompileResult>& outResult) SLANG_OVERRIDE;
+ virtual SLANG_NO_THROW bool SLANG_MCALL isFileBased() SLANG_OVERRIDE { return true; }
// Functions to be implemented for a specific CommandLine
@@ -443,7 +406,7 @@ public:
/// Given options determines the paths to products produced (including the 'moduleFilePath').
/// Note that does *not* guarentee all products were or should be produced. Just aims to include all that could
/// be produced, such that can be removed on completion.
- virtual SlangResult calcCompileProducts(const CompileOptions& options, ProductFlags flags, List<String>& outPaths) = 0;
+ virtual SlangResult calcCompileProducts(const CompileOptions& options, DownstreamProductFlags flags, List<String>& outPaths) = 0;
virtual SlangResult calcArgs(const CompileOptions& options, CommandLine& cmdLine) = 0;
virtual SlangResult parseOutput(const ExecuteResult& exeResult, DownstreamDiagnostics& output) = 0;
@@ -464,118 +427,20 @@ public:
CommandLine m_cmdLine;
};
-class DownstreamCompilerSet : public RefObject
-{
-public:
- typedef RefObject Super;
-
- /// Find all the available compilers
- void getCompilerDescs(List<DownstreamCompiler::Desc>& outCompilerDescs) const;
- /// Returns list of all compilers
- void getCompilers(List<DownstreamCompiler*>& outCompilers) const;
-
- /// Get a compiler
- DownstreamCompiler* getCompiler(const DownstreamCompiler::Desc& compilerDesc) const;
-
- /// Will replace if there is one with same desc
- void addCompiler(DownstreamCompiler* compiler);
-
- /// Get a default compiler
- DownstreamCompiler* getDefaultCompiler(SlangSourceLanguage sourceLanguage) const { return m_defaultCompilers[int(sourceLanguage)]; }
- /// Set the default compiler
- void setDefaultCompiler(SlangSourceLanguage sourceLanguage, DownstreamCompiler* compiler) { m_defaultCompilers[int(sourceLanguage)] = compiler; }
-
- /// True if has a compiler of the specified type
- bool hasCompiler(SlangPassThrough compilerType) const;
-
- void remove(SlangPassThrough compilerType);
-
- void clear() { m_compilers.clear(); }
-
- bool hasSharedLibrary(ISlangSharedLibrary* lib);
- void addSharedLibrary(ISlangSharedLibrary* lib);
-
- ~DownstreamCompilerSet()
- {
- // A compiler may be implemented in a shared library, so release all first.
- m_compilers.clearAndDeallocate();
- for (auto& defaultCompiler : m_defaultCompilers)
- {
- defaultCompiler.setNull();
- }
-
- // Release any shared libraries
- m_sharedLibraries.clearAndDeallocate();
- }
-
-protected:
-
- Index _findIndex(const DownstreamCompiler::Desc& desc) const;
-
-
- RefPtr<DownstreamCompiler> m_defaultCompilers[int(SLANG_SOURCE_LANGUAGE_COUNT_OF)];
- // This could be a dictionary/map - but doing a linear search is going to be fine and it makes
- // somethings easier.
- List<RefPtr<DownstreamCompiler>> m_compilers;
-
- List<ComPtr<ISlangSharedLibrary>> m_sharedLibraries;
-};
-
-typedef SlangResult (*DownstreamCompilerLocatorFunc)(const String& path, ISlangSharedLibraryLoader* loader, DownstreamCompilerSet* set);
-
/* Only purpose of having base-class here is to make all the DownstreamCompiler types available directly in derived Utils */
struct DownstreamCompilerBaseUtil
{
- typedef DownstreamCompiler::CompileOptions CompileOptions;
- typedef DownstreamCompiler::OptimizationLevel OptimizationLevel;
- typedef DownstreamCompiler::DebugInfoType DebugInfoType;
-
- typedef DownstreamDiagnostics::Diagnostic Diagnostic;
+ typedef DownstreamCompileOptions CompileOptions;
- typedef DownstreamCompiler::FloatingPointMode FloatingPointMode;
- typedef DownstreamCompiler::ProductFlag ProductFlag;
- typedef DownstreamCompiler::ProductFlags ProductFlags;
-};
+ typedef CompileOptions::OptimizationLevel OptimizationLevel;
+ typedef CompileOptions::DebugInfoType DebugInfoType;
-struct DownstreamCompilerUtil: public DownstreamCompilerBaseUtil
-{
- enum class MatchType
- {
- MinGreaterEqual,
- MinAbsolute,
- Newest,
- };
-
- /// Find a compiler
- static DownstreamCompiler* findCompiler(const DownstreamCompilerSet* set, MatchType matchType, const DownstreamCompiler::Desc& desc);
- static DownstreamCompiler* findCompiler(const List<DownstreamCompiler*>& compilers, MatchType matchType, const DownstreamCompiler::Desc& desc);
+ typedef CompileOptions::FloatingPointMode FloatingPointMode;
- static DownstreamCompiler* findCompiler(const List<DownstreamCompiler*>& compilers, SlangPassThrough type, const SemanticVersion& version);
- static DownstreamCompiler* findCompiler(const List<DownstreamCompiler*>& compilers, const DownstreamCompiler::Desc& desc);
-
- /// Find all the compilers with the version
- static void findVersions(const List<DownstreamCompiler*>& compilers, SlangPassThrough compiler, List<SemanticVersion>& versions);
-
-
- /// Find the compiler closest to the desc
- static DownstreamCompiler* findClosestCompiler(const List<DownstreamCompiler*>& compilers, const DownstreamCompilerMatchVersion& version);
- static DownstreamCompiler* findClosestCompiler(const DownstreamCompilerSet* set, const DownstreamCompilerMatchVersion& version);
-
- /// Get the information on the compiler used to compile this source
- static DownstreamCompilerMatchVersion getCompiledVersion();
-
- static void updateDefault(DownstreamCompilerSet* set, SlangSourceLanguage sourceLanguage);
- static void updateDefaults(DownstreamCompilerSet* set);
-
- static void setDefaultLocators(DownstreamCompilerLocatorFunc outFuncs[int(SLANG_PASS_THROUGH_COUNT_OF)]);
-
- /// Attempts to determine what 'path' is and load appropriately. Is it a path to a shared library? Is it a directory holding the libraries?
- /// Some downstream shared libraries need other shared libraries to be loaded before the main shared library, such that they are in the same directory
- /// otherwise the shared library could come from some unwanted location.
- /// dependentNames names shared libraries which should be attempted to be loaded in the path of the main shared library.
- /// The list is optional (nullptr can be passed in), and the list is terminated by nullptr.
- static SlangResult loadSharedLibrary(const String& path, ISlangSharedLibraryLoader* loader, const char*const* dependantNames, const char* libraryName, ComPtr<ISlangSharedLibrary>& outSharedLib);
+ typedef DownstreamProductFlag ProductFlag;
+ typedef DownstreamProductFlags ProductFlags;
+ typedef DownstreamDiagnostic Diagnostic;
};
}