Fixup build issues

This commit is contained in:
ReinUsesLisp
2018-11-01 05:13:30 -03:00
parent f3a63aa55f
commit 91e0769db5
6 changed files with 78 additions and 74 deletions

View File

@@ -4,7 +4,7 @@
* Lesser General Public License version 2.1 or any later version.
*/
#include "insts.h"
#include "op.h"
#include "sirit/sirit.h"
#include <cassert>
@@ -12,51 +12,51 @@ namespace Sirit {
Id Module::OpVariable(Id result_type, spv::StorageClass storage_class,
Id initializer) {
auto op{new Op(spv::Op::OpVariable, bound++, result_type)};
AddEnum(op, storage_class);
auto op{std::make_unique<Op>(spv::Op::OpVariable, bound++, result_type)};
op->Add(static_cast<u32>(storage_class));
if (initializer) {
op->Add(initializer);
}
return AddCode(op);
return AddCode(std::move(op));
}
Id Module::OpLoad(Id result_type, Id pointer,
std::optional<spv::MemoryAccessMask> memory_access) {
auto op{new Op(spv::Op::OpLoad, bound++, result_type)};
auto op{std::make_unique<Op>(spv::Op::OpLoad, bound++, result_type)};
op->Add(pointer);
if (memory_access) {
AddEnum(op, *memory_access);
op->Add(static_cast<u32>(*memory_access));
}
return AddCode(op);
return AddCode(std::move(op));
}
Id Module::OpStore(Id pointer, Id object,
std::optional<spv::MemoryAccessMask> memory_access) {
auto op{new Op(spv::Op::OpStore)};
auto op{std::make_unique<Op>(spv::Op::OpStore)};
op->Add(pointer);
op->Add(object);
if (memory_access) {
AddEnum(op, *memory_access);
op->Add(static_cast<u32>(*memory_access));
}
return AddCode(op);
return AddCode(std::move(op));
}
Id Module::OpAccessChain(Id result_type, Id base,
const std::vector<Id>& indexes) {
assert(indexes.size() > 0);
auto op{new Op(spv::Op::OpAccessChain, bound++, result_type)};
auto op{std::make_unique<Op>(spv::Op::OpAccessChain, bound++, result_type)};
op->Add(base);
op->Add(indexes);
return AddCode(op);
return AddCode(std::move(op));
}
Id Module::OpCompositeInsert(Id result_type, Id object, Id composite,
const std::vector<Literal>& indexes) {
auto op{new Op(spv::Op::OpCompositeInsert, bound++, result_type)};
auto op{std::make_unique<Op>(spv::Op::OpCompositeInsert, bound++, result_type)};
op->Add(object);
op->Add(composite);
op->Add(indexes);
return AddCode(op);
return AddCode(std::move(op));
}
} // namespace Sirit