From b7d318f48db2cb83a41d665f1727ae93fc555124 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 28 Sep 2023 18:07:40 -0700 Subject: Support `constref` parameters passing. (#3249) * Support `constref` parameters passing. * Fix. * Fix. * Add test and diagnostic on mix use of __constref and no_diff. * check for [constref] on differentiable member method. --------- Co-authored-by: Yong He --- source/slang/core.meta.slang | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/slang/core.meta.slang') diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang index 43640eb41..87697076e 100644 --- a/source/slang/core.meta.slang +++ b/source/slang/core.meta.slang @@ -678,6 +678,12 @@ __intrinsic_type($(kIROp_RefType)) struct Ref {}; +__generic +__magic_type(ConstRefType) +__intrinsic_type($(kIROp_ConstRefType)) +struct ConstRef +{}; + __generic __magic_type(OptionalType) __intrinsic_type($(kIROp_OptionalType)) @@ -2237,6 +2243,9 @@ attribute_syntax [mutating] : MutatingAttribute; __attributeTarget(SetterDecl) attribute_syntax [nonmutating] : NonmutatingAttribute; +__attributeTarget(FunctionDeclBase) +attribute_syntax [constref] : ConstRefAttribute; + /// Indicates that a function computes its result as a function of its arguments without loading/storing any memory or other state. /// /// This is equivalent to the LLVM `readnone` function attribute. -- cgit v1.2.3