summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-c-like.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2021-01-07 12:18:55 -0800
committerGitHub <noreply@github.com>2021-01-07 12:18:55 -0800
commit66d4466d680bcd97b7eb561f08bd6da80a1d6c4e (patch)
treea83e3ee0e2662d2ffc77485ccd77da77da81a5f0 /source/slang/slang-emit-c-like.cpp
parent92636513abe72d2da0c45f0e2c1235415e0671c3 (diff)
Add support for [noinline] attribute (#1650)
This adds the `[noinline]` attribute to the front-end, and passes it through when generating HLSL output. Notes: * This change doesn't include a test since the dxc version I have locally parses `[noinline]` but then generates DXIL that fails validation. * This change doesn't include logic to handle `[noinline]` for other targets. Notably, SPIR-V has decorations that convey the same intention, but we don't yet take advantage of the GLSL extension(s) that would let us generate those decorations. * By necesstiy, `[noinline]` is only a "strong suggestion" and not actually something the compiler can ever guarantee/enforce.
Diffstat (limited to 'source/slang/slang-emit-c-like.cpp')
-rw-r--r--source/slang/slang-emit-c-like.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp
index facb8a710..44564e575 100644
--- a/source/slang/slang-emit-c-like.cpp
+++ b/source/slang/slang-emit-c-like.cpp
@@ -3160,6 +3160,7 @@ void CLikeSourceEmitter::emitSimpleFuncImpl(IRFunc* func)
auto name = getName(func);
+ emitFuncDecorations(func);
emitType(resultType, name);
emitSimpleFuncParamsImpl(func);
emitSemantics(func);
@@ -3268,6 +3269,7 @@ void CLikeSourceEmitter::emitFuncDecl(IRFunc* func)
auto name = getName(func);
+ emitFuncDecorations(func);
emitType(resultType, name);
m_writer->emit("(");
@@ -3344,6 +3346,15 @@ void CLikeSourceEmitter::emitFunc(IRFunc* func)
}
}
+void CLikeSourceEmitter::emitFuncDecorations(IRFunc* func)
+{
+ for(auto decoration : func->getDecorations())
+ {
+ emitFuncDecorationImpl(decoration);
+ }
+}
+
+
void CLikeSourceEmitter::emitStruct(IRStructType* structType)
{
// If the selected `struct` type is actually an intrinsic