mirror of
https://git.suyu.dev/suyu/sirit.git
synced 2025-12-23 15:55:05 +01:00
Move type opcodes to their own file
This commit is contained in:
parent
479f76f61b
commit
3bd3688567
6 changed files with 49 additions and 68 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue