Add OpFunctionCall

This commit is contained in:
ReinUsesLisp 2018-11-01 01:54:10 -03:00
parent 798f8a5866
commit 4043020f45
2 changed files with 13 additions and 0 deletions

View file

@ -160,6 +160,10 @@ class Module {
/// Ends a function. /// Ends a function.
Id OpFunctionEnd(); Id OpFunctionEnd();
/// Call a function.
Id OpFunctionCall(Id result_type, Id function,
const std::vector<Id>& arguments = {});
// Flow // Flow
/// Declare a structured loop. /// Declare a structured loop.

View file

@ -20,4 +20,13 @@ Id Module::OpFunction(Id result_type, spv::FunctionControlMask function_control,
Id Module::OpFunctionEnd() { return AddCode(spv::Op::OpFunctionEnd); } Id Module::OpFunctionEnd() { return AddCode(spv::Op::OpFunctionEnd); }
Id Module::OpFunctionCall(Id result_type, Id function,
const std::vector<Id>& arguments) {
auto op{
std::make_unique<Op>(spv::Op::OpFunctionCall, bound++, result_type)};
op->Add(function);
op->Add(arguments);
return AddCode(std::move(op));
}
} // namespace Sirit } // namespace Sirit