summaryrefslogtreecommitdiffstats
path: root/source/slang/lower-to-ir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/lower-to-ir.cpp')
-rw-r--r--source/slang/lower-to-ir.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/slang/lower-to-ir.cpp b/source/slang/lower-to-ir.cpp
index 4eb762333..bde50aa89 100644
--- a/source/slang/lower-to-ir.cpp
+++ b/source/slang/lower-to-ir.cpp
@@ -3757,6 +3757,24 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
decoration->targetName = targetMod->targetToken.Content;
}
+ // If this declaration was marked as having a target-specific lowering
+ // for a particular target, then handle that here.
+ for (auto targetMod : decl->GetModifiersOfType<TargetIntrinsicModifier>())
+ {
+ auto decoration = getBuilder()->addDecoration<IRTargetIntrinsicDecoration>(irFunc);
+ decoration->targetName = targetMod->targetToken.Content;
+
+ auto definitionToken = targetMod->definitionToken;
+ if (definitionToken.type == TokenType::StringLiteral)
+ {
+ decoration->definition = getStringLiteralTokenValue(definitionToken);
+ }
+ else
+ {
+ decoration->definition = definitionToken.Content;
+ }
+ }
+
// For convenience, ensure that any additional global
// values that were emitted while outputting the function
// body appear before the function itself in the list