From e7a83323bfc4dd698ef491375a37c65c83915951 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Tue, 29 May 2018 11:39:55 -0700 Subject: Fix global atomic functions (#582) Fixes #581 This change adds a new parameter passing mode `__ref` to exist alongisde `in`, `out`, and `inout`. The `__ref` modifier indicates true by-reference parameter passing (whereas `inout` is copy-in-copy-out). This is not intended to be something that users interact with directly, but rather a low-level feature that lets us provide a correct signature for the `Interlocked*()` operations in the standard library. Most of the support for passing what are logically addresses around already exists in the IR, so the majority of the work here is just in introducing the new type `Ref` and then using it appropriately when lowering `__ref` parameters/arguments to the IR. --- source/slang/ir.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/slang/ir.cpp') diff --git a/source/slang/ir.cpp b/source/slang/ir.cpp index 92801ec9a..2a8885b0e 100644 --- a/source/slang/ir.cpp +++ b/source/slang/ir.cpp @@ -1308,6 +1308,11 @@ namespace Slang return (IRInOutType*) getPtrType(kIROp_InOutType, valueType); } + IRRefType* IRBuilder::getRefType(IRType* valueType) + { + return (IRRefType*) getPtrType(kIROp_RefType, valueType); + } + IRPtrTypeBase* IRBuilder::getPtrType(IROp op, IRType* valueType) { IRInst* operands[] = { valueType }; -- cgit v1.2.3