1 /* This file is part of the sirit project.
2 * Copyright (c) 2019 sirit
3 * This software may be used and distributed according to the terms of the
4 * 3-Clause BSD License
5 */
6
7 #include "common_types.h"
8 #include "op.h"
9 #include "sirit/sirit.h"
10
11 namespace Sirit {
12
OpFunction(Id result_type,spv::FunctionControlMask function_control,Id function_type)13 Id Module::OpFunction(Id result_type, spv::FunctionControlMask function_control, Id function_type) {
14 auto op{std::make_unique<Op>(spv::Op::OpFunction, bound++, result_type)};
15 op->Add(static_cast<u32>(function_control));
16 op->Add(function_type);
17 return AddCode(std::move(op));
18 }
19
OpFunctionEnd()20 Id Module::OpFunctionEnd() {
21 return AddCode(spv::Op::OpFunctionEnd);
22 }
23
OpFunctionCall(Id result_type,Id function,const std::vector<Id> & arguments)24 Id Module::OpFunctionCall(Id result_type, Id function, const std::vector<Id>& arguments) {
25 auto op{std::make_unique<Op>(spv::Op::OpFunctionCall, bound++, result_type)};
26 op->Add(function);
27 op->Add(arguments);
28 return AddCode(std::move(op));
29 }
30
31 } // namespace Sirit
32