2018-08-26 10:01:31 +02:00
|
|
|
/* This file is part of the sirit project.
|
|
|
|
|
* Copyright (c) 2018 ReinUsesLisp
|
|
|
|
|
* This software may be used and distributed according to the terms of the GNU
|
2018-11-16 08:10:10 +01:00
|
|
|
* Lesser General Public License version 3 or any later version.
|
2018-08-26 10:01:31 +02:00
|
|
|
*/
|
|
|
|
|
|
2018-11-01 04:02:45 +01:00
|
|
|
#include "common_types.h"
|
|
|
|
|
#include "op.h"
|
2018-10-28 17:44:12 +01:00
|
|
|
#include "sirit/sirit.h"
|
2018-08-26 10:01:31 +02:00
|
|
|
|
|
|
|
|
namespace Sirit {
|
|
|
|
|
|
2018-11-01 04:02:45 +01:00
|
|
|
Id Module::OpFunction(Id result_type, spv::FunctionControlMask function_control,
|
|
|
|
|
Id function_type) {
|
|
|
|
|
auto op{std::make_unique<Op>(spv::Op::OpFunction, bound++, result_type)};
|
2018-08-26 10:01:31 +02:00
|
|
|
op->Add(static_cast<u32>(function_control));
|
|
|
|
|
op->Add(function_type);
|
2018-11-01 04:02:45 +01:00
|
|
|
return AddCode(std::move(op));
|
2018-08-26 10:01:31 +02:00
|
|
|
}
|
|
|
|
|
|
2018-11-01 02:20:49 +01:00
|
|
|
Id Module::OpFunctionEnd() { return AddCode(spv::Op::OpFunctionEnd); }
|
2018-08-26 10:01:31 +02:00
|
|
|
|
2018-11-01 05:54:10 +01:00
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-26 10:01:31 +02:00
|
|
|
} // namespace Sirit
|