summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit.cpp
diff options
context:
space:
mode:
authorDarren Wihandi <65404740+fairywreath@users.noreply.github.com>2025-03-21 11:52:28 -0400
committerGitHub <noreply@github.com>2025-03-21 15:52:28 +0000
commit844d8d2212d11f3d28a55c81f234c99db2c26250 (patch)
treef541932dc6fca77f8b0f5ad869644a674d60fccf /source/slang/slang-emit.cpp
parent16ac0efa3e1e834e3b12af8ac34cf47a6418bb34 (diff)
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 <ellieh@nvidia.com>
Diffstat (limited to 'source/slang/slang-emit.cpp')
-rw-r--r--source/slang/slang-emit.cpp8
1 files changed, 8 insertions, 0 deletions
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.