From 66d4466d680bcd97b7eb561f08bd6da80a1d6c4e Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Thu, 7 Jan 2021 12:18:55 -0800 Subject: 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. --- source/slang/slang-emit-hlsl.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/slang/slang-emit-hlsl.cpp') diff --git a/source/slang/slang-emit-hlsl.cpp b/source/slang/slang-emit-hlsl.cpp index 57d603940..a1da1bbdf 100644 --- a/source/slang/slang-emit-hlsl.cpp +++ b/source/slang/slang-emit-hlsl.cpp @@ -693,6 +693,20 @@ void HLSLSourceEmitter::emitLoopControlDecorationImpl(IRLoopControlDecoration* d } } +void HLSLSourceEmitter::emitFuncDecorationImpl(IRDecoration* decoration) +{ + switch( decoration->op ) + { + case kIROp_NoInlineDecoration: + m_writer->emit("[noinline]\n"); + break; + + default: + break; + } +} + + void HLSLSourceEmitter::emitSimpleValueImpl(IRInst* inst) { switch (inst->op) -- cgit v1.2.3