summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-emit.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-06-04 13:05:58 -0700
committerGitHub <noreply@github.com>2025-06-04 13:05:58 -0700
commit812e478989e27983b8dea7ab11964de751654ba2 (patch)
treee6db6def9c7896ee48c5fe42926856644e81c0e6 /source/slang/slang-emit.cpp
parentb9dc21d362f65f22bc707bede733a9537b80460a (diff)
Make interface types non c-style in Slang2026. (#7260)
* Make interface types non c-style. * Make Optional<T> 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>
Diffstat (limited to 'source/slang/slang-emit.cpp')
-rw-r--r--source/slang/slang-emit.cpp46
1 files changed, 23 insertions, 23 deletions
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<T,E>` 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<T,E>` 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());