From 4043020f452145d11cd6d26bdf9db739b5fdaa9c Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Thu, 1 Nov 2018 01:54:10 -0300 Subject: [PATCH] Add OpFunctionCall --- include/sirit/sirit.h | 4 ++++ src/insts/function.cpp | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h index d24ce2c..ee3a024 100644 --- a/include/sirit/sirit.h +++ b/include/sirit/sirit.h @@ -160,6 +160,10 @@ class Module { /// Ends a function. Id OpFunctionEnd(); + /// Call a function. + Id OpFunctionCall(Id result_type, Id function, + const std::vector& arguments = {}); + // Flow /// Declare a structured loop. diff --git a/src/insts/function.cpp b/src/insts/function.cpp index dcd803a..f9f74df 100644 --- a/src/insts/function.cpp +++ b/src/insts/function.cpp @@ -20,4 +20,13 @@ Id Module::OpFunction(Id result_type, spv::FunctionControlMask function_control, Id Module::OpFunctionEnd() { return AddCode(spv::Op::OpFunctionEnd); } +Id Module::OpFunctionCall(Id result_type, Id function, + const std::vector& arguments) { + auto op{ + std::make_unique(spv::Op::OpFunctionCall, bound++, result_type)}; + op->Add(function); + op->Add(arguments); + return AddCode(std::move(op)); +} + } // namespace Sirit