summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-emit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-emit.cpp')
-rw-r--r--source/slang/slang-emit.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index 0ed17ad7c..72ad80873 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -23,6 +23,7 @@
#include "slang-ir-com-interface.h"
#include "slang-ir-lower-generics.h"
#include "slang-ir-lower-tuple-types.h"
+#include "slang-ir-lower-result-type.h"
#include "slang-ir-lower-bit-cast.h"
#include "slang-ir-lower-reinterpret.h"
#include "slang-ir-metadata.h"
@@ -200,6 +201,19 @@ Result linkAndOptimizeIR(
// un-specialized IR.
dumpIRIfEnabled(codeGenContext, irModule);
+ switch (target)
+ {
+ default:
+ break;
+ case CodeGenTarget::HostCPPSource:
+ lowerComInterfaces(irModule, sink);
+ generateDllImportFuncs(irModule, sink);
+ break;
+ }
+
+ // Lower `Result<T,E>` types into ordinary struct types.
+ lowerResultType(irModule, sink);
+
// Replace any global constants with their values.
//
replaceGlobalConstants(irModule);
@@ -689,16 +703,6 @@ Result linkAndOptimizeIR(
break;
}
- switch (target)
- {
- default:
- break;
- case CodeGenTarget::HostCPPSource:
- lowerComInterfaces(irModule, sink);
- generateDllImportFuncs(irModule, sink);
- break;
- }
-
// TODO: our current dynamic dispatch pass will remove all uses of witness tables.
// If we are going to support function-pointer based, "real" modular dynamic dispatch,
// we will need to disable this pass.