From f59df3814a514cab01f69a24e3330d13de3f9c92 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 31 Oct 2019 15:02:18 -0400 Subject: Reference IR modules with entry point (#1101) * Added RiffReadHelper * Move type to fourCC in Chunk simplifies some code. * Make MemoryArena able to track external blocks. Allow ownership of Data to vary. Changed IR serialization to use moved allocations to avoid copies. As it turns out all of the array writes could use unowned data, but doing so requires the IRData to stay in scope longer than IRSerialData, which it does at the moment - but perhaps needs better naming or a control for the feature. * Write out slang-module container. * WIP on -r option. Loading modules - with -r. * Making the serialized-module run (without using imported module). * Split compiling module from the test. * Separate module compilation with a function working. * Remove serialization test as not used. * Fix warning on gcc. * Updated test to have types across module boundary. * Allow entry point declaration. A test that tries to build with just an entry point declaration and a module. * Try to make link work with multiple modules. * Multi module linking first pass working. * Multi module test working with -module-name option * Use isDefinition - for determining to add decorations to entry point lowering. --- source/slang/slang-options.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'source/slang/slang-options.cpp') diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp index 76ebcca52..7429db2fc 100644 --- a/source/slang/slang-options.cpp +++ b/source/slang/slang-options.cpp @@ -497,7 +497,7 @@ struct OptionsParser else if (argStr == "-dump-repro") { SLANG_RETURN_ON_FAIL(tryReadCommandLineArgument(sink, arg, &argCursor, argEnd, requestImpl->dumpRepro)); - spEnableReproCapture(asExternal(requestImpl)); + spEnableReproCapture(compileRequest); } else if (argStr == "-dump-repro-on-error") { @@ -510,6 +510,13 @@ struct OptionsParser SLANG_RETURN_ON_FAIL(StateSerializeUtil::extractFilesToDirectory(reproName)); } + else if (argStr == "-module-name") + { + String moduleName; + SLANG_RETURN_ON_FAIL(tryReadCommandLineArgument(sink, arg, &argCursor, argEnd, moduleName)); + + spSetDefaultModuleName(compileRequest, moduleName.getBuffer()); + } else if(argStr == "-load-repro") { String reproName; @@ -860,16 +867,16 @@ struct OptionsParser } else if (argStr == "-r") { - String moduleName; - SLANG_RETURN_ON_FAIL(tryReadCommandLineArgument(sink, arg, &argCursor, argEnd, moduleName)); + String referenceModuleName; + SLANG_RETURN_ON_FAIL(tryReadCommandLineArgument(sink, arg, &argCursor, argEnd, referenceModuleName)); // We need to deserialize and add the modules - FileStream fileStream(moduleName, FileMode::Open, FileAccess::Read, FileShare::ReadWrite); + FileStream fileStream(referenceModuleName, FileMode::Open, FileAccess::Read, FileShare::ReadWrite); List> irModules; if (SLANG_FAILED(IRSerialReader::readStreamModules(&fileStream, asInternal(session), requestImpl->getFrontEndReq()->getSourceManager(), irModules))) { - sink->diagnose(SourceLoc(), Diagnostics::unableToReadModuleContainer, moduleName); + sink->diagnose(SourceLoc(), Diagnostics::unableToReadModuleContainer, referenceModuleName); return SLANG_FAIL; } -- cgit v1.2.3