diff options
| author | Dietrich Geisler <dgeisler50@gmail.com> | 2020-06-29 17:42:12 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-29 14:42:12 -0700 |
| commit | 47b43f8b15ef35c520b9b287fd17ff25e36bfe95 (patch) | |
| tree | fed30013e307f9ee17700ab7e8839bee56f104e1 /source/slang/slang-compiler.h | |
| parent | 3e8bdb60afb5b0c0a53ce06d1dbbc429988f5885 (diff) | |
Backend for Multiple Entry Points (#1411)
* Backend for Multiple Entry Points
Introduces the basic backend on the compiler for zero or more entry
points. Entry points have been extended to lists for several functions,
with loopFunctions have been extended to take in entry points and
indices as appropriate, to allow for multiple entry points once the
frontend is expanded. Several functions are currently being assumed to
have a single entry point for simplicity and provide a work in progress
commit.
* Progress on debugging fixes
* Tests passing
* Refactored emitEntryPoints
* Updated lists to be by constant reference
* Fixes to formatting
* Refactoring updates for the compiler
* Fix for compilation errors
* Reformatting
* More reformatting
* Moved struct around to help with compilation
Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'source/slang/slang-compiler.h')
| -rw-r--r-- | source/slang/slang-compiler.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h index e4b537e19..72c40a497 100644 --- a/source/slang/slang-compiler.h +++ b/source/slang/slang-compiler.h @@ -1129,6 +1129,7 @@ namespace Slang SlangTargetFlags targetFlags = 0; Slang::Profile targetProfile = Slang::Profile(); FloatingPointMode floatingPointMode = FloatingPointMode::Default; + bool isWholeProgramRequest = false; Linkage* getLinkage() { return linkage; } CodeGenTarget getTarget() { return target; } @@ -1681,7 +1682,13 @@ namespace Slang /// code generation to the given `sink`. /// CompileResult& getOrCreateEntryPointResult(Int entryPointIndex, DiagnosticSink* sink); + CompileResult& getOrCreateWholeProgramResult(List<Int> entryPointIndices, DiagnosticSink* sink); + + CompileResult& getExistingWholeProgramResult() + { + return m_wholeProgramResult; + } /// Get the compiled code for an entry point on the target. /// /// This routine assumes that `getOrCreateEntryPointResult` @@ -1692,7 +1699,10 @@ namespace Slang return m_entryPointResults[entryPointIndex]; } - + CompileResult& _createWholeProgramResult( + List<Int> entryPointIndices, + BackEndCompileRequest* backEndRequest, + EndToEndCompileRequest* endToEndRequest); /// Internal helper for `getOrCreateEntryPointResult`. /// /// This is used so that command-line and API-based @@ -1727,6 +1737,7 @@ 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; RefPtr<IRModule> m_irModuleForLayout; @@ -1839,6 +1850,7 @@ namespace Slang // An empty string indices no output desired for // the given entry point. Dictionary<Int, String> entryPointOutputPaths; + String wholeTargetOutputPath; }; Dictionary<TargetRequest*, RefPtr<TargetInfo>> targetInfos; @@ -1944,7 +1956,10 @@ namespace Slang @param endToEndReq The end-to-end compile request which might be using pass-through compilation @param entryPointIndex The index of the entry point to compute a filename for. @return the appropriate source filename */ - String calcSourcePathForEntryPoint(EndToEndCompileRequest* endToEndReq, UInt entryPointIndex); + // TODO(DG): Note to reviewer; this was changed from UInt to List<Int> -- let me know if that's a problem + // and I can work out the appropriate casts + String calcSourcePathForEntryPoint(EndToEndCompileRequest* endToEndReq, Int entryPointIndex); + String calcSourcePathForEntryPoints(EndToEndCompileRequest* endToEndReq, List<Int> entryPointIndices); struct SourceResult { @@ -1961,9 +1976,9 @@ namespace Slang /* Emits entry point source taking into account if a pass-through or not. Uses 'target' to determine the target (not targetReq) */ - SlangResult emitEntryPointSource( + SlangResult emitEntryPointsSource( BackEndCompileRequest* compileRequest, - Int entryPointIndex, + List<Int> entryPointIndices, TargetRequest* targetReq, CodeGenTarget target, EndToEndCompileRequest* endToEndReq, |
