From 8de0a2ebc58c510d62df1a3d211643bfb463d9c4 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 10 Jun 2020 14:57:30 -0700 Subject: Add compiler flag to disable specialization pass. --- source/slang/slang-compiler.h | 4 ++++ source/slang/slang-emit.cpp | 3 ++- source/slang/slang-options.cpp | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h index f8843fadc..26648ed48 100644 --- a/source/slang/slang-compiler.h +++ b/source/slang/slang-compiler.h @@ -1759,6 +1759,10 @@ namespace Slang /// Should SPIR-V be generated directly from Slang IR rather than via translation to GLSL? bool shouldEmitSPIRVDirectly = false; + + // If true will allow generating dynamic dispatch code for generics. + bool allowDynamicCode = false; + String m_dumpIntermediatePrefix; private: diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index 12996e783..3e0d6ae26 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -270,7 +270,8 @@ Result linkAndOptimizeIR( // perform specialization of functions based on parameter // values that need to be compile-time constants. // - specializeModule(irModule); + if (!compileRequest->allowDynamicCode) + specializeModule(irModule); // Debugging code for IR transformations... #if 0 diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp index 89fe03255..5bf0c6c9d 100644 --- a/source/slang/slang-options.cpp +++ b/source/slang/slang-options.cpp @@ -557,6 +557,10 @@ struct OptionsParser { requestImpl->getFrontEndReq()->useSerialIRBottleneck = true; } + else if (argStr == "-allow-dynamic-code") + { + requestImpl->getBackEndReq()->allowDynamicCode = true; + } else if (argStr == "-verbose-paths") { requestImpl->getSink()->setFlag(DiagnosticSink::Flag::VerbosePath); -- cgit v1.2.3