summaryrefslogtreecommitdiff
path: root/source/slang/slang-compiler.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2022-08-16 03:39:41 -0400
committerGitHub <noreply@github.com>2022-08-16 00:39:41 -0700
commitac71724c03392b429e44641a3641b2bcf7cc55fc (patch)
tree8f7ffa61329dd24bc9be551e293840b6b94aab36 /source/slang/slang-compiler.h
parent786f48d32340c36a06865a333ff9066033b5b2bc (diff)
Remove CompileResult to use IArtifact (#2357)
* #include an absolute path didn't work - because paths were taken to always be relative. * 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.
Diffstat (limited to 'source/slang/slang-compiler.h')
-rwxr-xr-xsource/slang/slang-compiler.h46
1 files changed, 18 insertions, 28 deletions
diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h
index 56e161483..9f75d94d3 100755
--- a/source/slang/slang-compiler.h
+++ b/source/slang/slang-compiler.h
@@ -144,11 +144,7 @@ namespace Slang
class Module;
class TranslationUnitRequest;
- struct PostEmitMetadata : public RefObject
- {
- List<ShaderBindingRange> usedBindings;
- };
-
+#if 0
// Result of compiling an entry point.
// Should only ever be string, binary or shared library
class CompileResult
@@ -187,6 +183,7 @@ namespace Slang
RefPtr<PostEmitMetadata> postEmitMetadata;
};
+#endif
/// Information collected about global or entry-point shader parameters
struct ShaderParamInfo
@@ -2171,11 +2168,10 @@ namespace Slang
/// been requested, report any errors that arise during
/// code generation to the given `sink`.
///
- CompileResult& getOrCreateEntryPointResult(Int entryPointIndex, DiagnosticSink* sink);
- CompileResult& getOrCreateWholeProgramResult(DiagnosticSink* sink);
+ IArtifact* getOrCreateEntryPointResult(Int entryPointIndex, DiagnosticSink* sink);
+ IArtifact* getOrCreateWholeProgramResult(DiagnosticSink* sink);
-
- CompileResult& getExistingWholeProgramResult()
+ IArtifact* getExistingWholeProgramResult()
{
return m_wholeProgramResult;
}
@@ -2184,12 +2180,12 @@ namespace Slang
/// This routine assumes that `getOrCreateEntryPointResult`
/// has already been called previously.
///
- CompileResult& getExistingEntryPointResult(Int entryPointIndex)
+ IArtifact* getExistingEntryPointResult(Int entryPointIndex)
{
return m_entryPointResults[entryPointIndex];
}
- CompileResult& _createWholeProgramResult(
+ IArtifact* _createWholeProgramResult(
DiagnosticSink* sink,
EndToEndCompileRequest* endToEndReq = nullptr);
@@ -2200,7 +2196,7 @@ namespace Slang
///
/// Shouldn't be called directly by most code.
///
- CompileResult& _createEntryPointResult(
+ IArtifact* _createEntryPointResult(
Int entryPointIndex,
DiagnosticSink* sink,
EndToEndCompileRequest* endToEndReq = nullptr);
@@ -2227,8 +2223,8 @@ namespace Slang
// Generated compile results for each entry point
// in the parent `Program` (indexing matches
// the order they are given in the `Program`)
- CompileResult m_wholeProgramResult;
- List<CompileResult> m_entryPointResults;
+ ComPtr<IArtifact> m_wholeProgramResult;
+ List<ComPtr<IArtifact>> m_entryPointResults;
RefPtr<IRModule> m_irModuleForLayout;
};
@@ -2416,7 +2412,7 @@ namespace Slang
//
- CompileResult emitEntryPoints();
+ SlangResult emitEntryPoints(ComPtr<IArtifact>& outArtifact);
SlangResult dissassembleWithDownstream(
const void* data,
@@ -2431,6 +2427,8 @@ namespace Slang
CodeGenTarget m_targetFormat = CodeGenTarget::Unknown;
ExtensionTracker* m_extensionTracker = nullptr;
+ void maybeDumpIntermediate(IArtifact* artifact);
+
// Helper to dump intermediate output when debugging
void maybeDumpIntermediate(
void const* data,
@@ -2459,17 +2457,11 @@ namespace Slang
/* Emits entry point source taking into account if a pass-through or not. Uses 'targetFormat' to determine
the target (not targetReq) */
- SlangResult emitEntryPointsSource(
- String& outSource,
- RefPtr<PostEmitMetadata>& outMetadata);
-
- SlangResult emitEntryPointsSourceFromIR(
- String& outSource,
- RefPtr<PostEmitMetadata>& outMetadata);
+ SlangResult emitEntryPointsSource(ComPtr<IArtifact>& outArtifact);
- SlangResult emitWithDownstreamForEntryPoints(
- RefPtr<DownstreamCompileResult>& outResult,
- RefPtr<PostEmitMetadata>& outMetadata);
+ SlangResult emitEntryPointsSourceFromIR(ComPtr<IArtifact>& outArtifact);
+
+ SlangResult emitWithDownstreamForEntryPoints(ComPtr<IArtifact>& outArtifact);
/* Determines a suitable filename to identify the input for a given entry point being compiled.
If the end-to-end compile is a pass-through case, will attempt to find the (unique) source file
@@ -2484,9 +2476,7 @@ namespace Slang
Int entryPointIndex);
- SlangResult _emitEntryPoints(
- RefPtr<DownstreamCompileResult>& outDownstreamResult,
- RefPtr<PostEmitMetadata>& outMetadata);
+ SlangResult _emitEntryPoints(ComPtr<IArtifact>& outArtifact);
private:
Shared* m_shared = nullptr;