mirror of
https://github.com/azahar-emu/sirit.git
synced 2026-03-28 06:11:02 +01:00
Move type opcodes to their own file
This commit is contained in:
@@ -10,16 +10,10 @@
|
||||
#include "common_types.h"
|
||||
#include "op.h"
|
||||
#include "stream.h"
|
||||
#include "opcodes.h"
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
template<typename T>
|
||||
static void WriteEnum(Stream& stream, spv::Op opcode, T value) {
|
||||
Op op{opcode};
|
||||
op.Add(static_cast<u32>(value));
|
||||
op.Write(stream);
|
||||
}
|
||||
|
||||
Module::Module() {}
|
||||
|
||||
Module::~Module() = default;
|
||||
@@ -89,19 +83,6 @@ void Module::AddEntryPoint(spv::ExecutionModel execution_model, const Op* entry_
|
||||
entry_points.push_back(std::unique_ptr<Op>(op));
|
||||
}
|
||||
|
||||
const Op* Module::TypeVoid() {
|
||||
return AddDeclaration(new Op(spv::Op::OpTypeVoid, bound));
|
||||
}
|
||||
|
||||
const Op* Module::TypeFunction(const Op* return_type, const std::vector<const Op*>& arguments) {
|
||||
Op* type_func{new Op(spv::Op::OpTypeFunction, bound)};
|
||||
type_func->Add(return_type);
|
||||
for (const Op* arg : arguments) {
|
||||
type_func->Add(arg);
|
||||
}
|
||||
return AddDeclaration(type_func);
|
||||
}
|
||||
|
||||
const Op* Module::Emit(const Op* op) {
|
||||
assert(op);
|
||||
code.push_back(op);
|
||||
|
||||
Reference in New Issue
Block a user