summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source/slang/slang-emit-c-like.cpp7
-rw-r--r--source/slang/slang-emit-c-like.h1
-rw-r--r--source/slang/slang-emit-glsl.cpp2
-rw-r--r--source/slang/slang-emit-hlsl.cpp2
4 files changed, 9 insertions, 3 deletions
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp
index bf1754a32..72ee1644d 100644
--- a/source/slang/slang-emit-c-like.cpp
+++ b/source/slang/slang-emit-c-like.cpp
@@ -1883,6 +1883,11 @@ void CLikeSourceEmitter::emitInstExpr(IRInst* inst, const EmitOpInfo& inOuterPre
defaultEmitInstExpr(inst, inOuterPrec);
}
+void CLikeSourceEmitter::diagnoseUnhandledInst(IRInst* inst)
+{
+ getSink()->diagnose(inst, Diagnostics::unimplemented, "unexpected IR opcode during code emit");
+}
+
void CLikeSourceEmitter::defaultEmitInstExpr(IRInst* inst, const EmitOpInfo& inOuterPrec)
{
EmitOpInfo outerPrec = inOuterPrec;
@@ -2195,7 +2200,7 @@ void CLikeSourceEmitter::defaultEmitInstExpr(IRInst* inst, const EmitOpInfo& inO
break;
default:
- m_writer->emit("/* unhandled */");
+ diagnoseUnhandledInst(inst);
break;
}
maybeCloseParens(needClose);
diff --git a/source/slang/slang-emit-c-like.h b/source/slang/slang-emit-c-like.h
index e5a8de9ec..a02fc873a 100644
--- a/source/slang/slang-emit-c-like.h
+++ b/source/slang/slang-emit-c-like.h
@@ -196,6 +196,7 @@ public:
void emitInstExpr(IRInst* inst, EmitOpInfo const& inOuterPrec);
void defaultEmitInstExpr(IRInst* inst, EmitOpInfo const& inOuterPrec);
+ void diagnoseUnhandledInst(IRInst* inst);
BaseType extractBaseType(IRType* inType);
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp
index af1cfd897..c05f14f25 100644
--- a/source/slang/slang-emit-glsl.cpp
+++ b/source/slang/slang-emit-glsl.cpp
@@ -1128,7 +1128,7 @@ bool GLSLSourceEmitter::tryEmitInstExprImpl(IRInst* inst, const EmitOpInfo& inOu
switch (toType)
{
default:
- m_writer->emit("/* unhandled */");
+ diagnoseUnhandledInst(inst);
break;
case BaseType::UInt:
diff --git a/source/slang/slang-emit-hlsl.cpp b/source/slang/slang-emit-hlsl.cpp
index 489e17c8e..f0238ce70 100644
--- a/source/slang/slang-emit-hlsl.cpp
+++ b/source/slang/slang-emit-hlsl.cpp
@@ -439,7 +439,7 @@ bool HLSLSourceEmitter::tryEmitInstExprImpl(IRInst* inst, const EmitOpInfo& inOu
switch (toType)
{
default:
- m_writer->emit("/* unhandled */");
+ diagnoseUnhandledInst(inst);
break;
case BaseType::UInt:
break;