From 84fab900242f3565f2ba8eb643aa03ede3ff39e9 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sun, 28 Mar 2021 18:52:32 -0300 Subject: [PATCH] Add OpFunctionParameter --- include/sirit/sirit.h | 3 +++ src/instructions/function.cpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h index 574a9cc..c26304b 100644 --- a/include/sirit/sirit.h +++ b/include/sirit/sirit.h @@ -242,6 +242,9 @@ public: return OpFunctionCall(result_type, function, std::span({arguments...})); } + /// Declare a formal parameter of the current function. + Id OpFunctionParameter(Id result_type); + // Flow /** diff --git a/src/instructions/function.cpp b/src/instructions/function.cpp index ece60e6..f84cd7f 100644 --- a/src/instructions/function.cpp +++ b/src/instructions/function.cpp @@ -26,4 +26,9 @@ Id Module::OpFunctionCall(Id result_type, Id function, std::span argum return *code << OpId{spv::Op::OpFunctionCall, result_type} << function << arguments << EndOp{}; } +Id Module::OpFunctionParameter(Id result_type) { + code->Reserve(3); + return *code << OpId{spv::Op::OpFunctionParameter, result_type} << EndOp{}; +} + } // namespace Sirit