summaryrefslogtreecommitdiffstats
path: root/source/slang/emit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/emit.cpp')
-rw-r--r--source/slang/emit.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp
index b8fbc350e..46c0b20a9 100644
--- a/source/slang/emit.cpp
+++ b/source/slang/emit.cpp
@@ -8084,17 +8084,17 @@ String emitEntryPoint(
EmitVisitor visitor(&context);
+ // We are going to create a fresh IR module that we will use to
+ // clone any code needed by the user's entry point.
+ IRSpecializationState* irSpecializationState = createIRSpecializationState(
+ entryPoint,
+ programLayout,
+ target,
+ targetRequest);
{
TypeLegalizationContext typeLegalizationContext;
typeLegalizationContext.session = entryPoint->compileRequest->mSession;
- // We are going to create a fresh IR module that we will use to
- // clone any code needed by the user's entry point.
- IRSpecializationState* irSpecializationState = createIRSpecializationState(
- entryPoint,
- programLayout,
- target,
- targetRequest);
IRModule* irModule = getIRModule(irSpecializationState);
typeLegalizationContext.irModule = irModule;
@@ -8158,8 +8158,8 @@ String emitEntryPoint(
// TODO: do we want to emit directly from IR, or translate the
// IR back into AST for emission?
visitor.emitIRModule(&context, irModule);
- destroyIRSpecializationState(irSpecializationState);
}
+ destroyIRSpecializationState(irSpecializationState);
String code = sharedContext.sb.ProduceString();
sharedContext.sb.Clear();