From 844d8d2212d11f3d28a55c81f234c99db2c26250 Mon Sep 17 00:00:00 2001 From: Darren Wihandi <65404740+fairywreath@users.noreply.github.com> Date: Fri, 21 Mar 2025 11:52:28 -0400 Subject: Emit errors for missing returns on unsupported targets (#6633) * initial wip * more WIP * preserve old lower behavior * remove unnecessary includes * add test * add no target case in test * fix broken test --------- Co-authored-by: Ellie Hermaszewska --- source/slang/slang-emit.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/slang/slang-emit.cpp') diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index 845712c2d..841f44a80 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -79,6 +79,7 @@ #include "slang-ir-lower-tuple-types.h" #include "slang-ir-metadata.h" #include "slang-ir-metal-legalize.h" +#include "slang-ir-missing-return.h" #include "slang-ir-optix-entry-point-uniforms.h" #include "slang-ir-pytorch-cpp-binding.h" #include "slang-ir-redundancy-removal.h" @@ -326,6 +327,7 @@ struct RequiredLoweringPassSet bool dynamicResourceHeap; bool resolveVaryingInputRef; bool specializeStageSwitch; + bool missingReturn; }; // Scan the IR module and determine which lowering/legalization passes are needed based @@ -451,6 +453,9 @@ void calcRequiredLoweringPassSet( case kIROp_GetCurrentStage: result.specializeStageSwitch = true; break; + case kIROp_MissingReturn: + result.missingReturn = true; + break; } if (!result.generics || !result.existentialTypeLayout) { @@ -1082,6 +1087,9 @@ Result linkAndOptimizeIR( checkForRecursiveTypes(irModule, sink); checkForRecursiveFunctions(codeGenContext->getTargetReq(), irModule, sink); + if (requiredLoweringPassSet.missingReturn) + checkForMissingReturns(irModule, sink, target, false); + // For some targets, we are more restrictive about what types are allowed // to be used as shader parameters in ConstantBuffer/ParameterBlock. // We will check for these restrictions here. -- cgit v1.2.3