From 812e478989e27983b8dea7ab11964de751654ba2 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 4 Jun 2025 13:05:58 -0700 Subject: Make interface types non c-style in Slang2026. (#7260) * Make interface types non c-style. * Make Optional work with autodiff and existential types. * Fix. * patch behind slang 2026. * Fix warnings. * cleanup. * Fix tests. * Fix. * Fix com interface lowering. * Add comment to test. * regenerate command line reference * Add test for passing `none` to autodiff function. * Fix recording of `getDynamicObjectRTTIBytes`. * Fix nested Optional types. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> --- source/slang/slang-emit.cpp | 46 ++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'source/slang/slang-emit.cpp') diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index a4362b912..20459c722 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -778,9 +778,6 @@ Result linkAndOptimizeIR( break; } - if (requiredLoweringPassSet.optionalType) - lowerOptionalType(irModule, sink); - switch (target) { case CodeGenTarget::CUDASource: @@ -792,20 +789,6 @@ Result linkAndOptimizeIR( break; } - switch (target) - { - case CodeGenTarget::CPPSource: - case CodeGenTarget::HostCPPSource: - { - lowerComInterfaces(irModule, artifactDesc.style, sink); - generateDllImportFuncs(codeGenContext->getTargetProgram(), irModule, sink); - generateDllExportFuncs(irModule, sink); - break; - } - default: - break; - } - #if 0 dumpIRIfEnabled(codeGenContext, irModule, "UNIONS DESUGARED"); #endif @@ -947,12 +930,6 @@ Result linkAndOptimizeIR( break; } - // Lower `Result` types into ordinary struct types. This must happen - // after specialization, since otherwise incompatible copies of the lowered - // result structure are generated. - if (requiredLoweringPassSet.resultType) - lowerResultType(irModule, sink); - // Report checkpointing information if (codeGenContext->shouldReportCheckpointIntermediates()) { @@ -978,6 +955,29 @@ Result linkAndOptimizeIR( finalizeSpecialization(irModule); + // Lower `Result` types into ordinary struct types. This must happen + // after specialization, since otherwise incompatible copies of the lowered + // result structure are generated. + if (requiredLoweringPassSet.resultType) + lowerResultType(irModule, sink); + + if (requiredLoweringPassSet.optionalType) + lowerOptionalType(irModule, sink); + + switch (target) + { + case CodeGenTarget::CPPSource: + case CodeGenTarget::HostCPPSource: + { + lowerComInterfaces(irModule, artifactDesc.style, sink); + generateDllImportFuncs(codeGenContext->getTargetProgram(), irModule, sink); + generateDllExportFuncs(irModule, sink); + break; + } + default: + break; + } + requiredLoweringPassSet = {}; calcRequiredLoweringPassSet(requiredLoweringPassSet, codeGenContext, irModule->getModuleInst()); -- cgit v1.2.3