1
0
Fork 0
mirror of https://git.suyu.dev/suyu/sirit.git synced 2024-12-22 20:22:02 +00:00

Add OpCompositeConstruct

This commit is contained in:
ReinUsesLisp 2018-11-04 02:38:13 -03:00
parent 5830eca337
commit 44043bca56
2 changed files with 12 additions and 0 deletions

View file

@ -237,6 +237,10 @@ class Module {
Id OpCompositeExtract(Id result_type, Id composite,
const std::vector<Literal>& indexes = {});
/// Construct a new composite object from a set of constituent objects that
/// will fully form it.
Id OpCompositeConstruct(Id result_type, const std::vector<Id>& ids);
// Annotation
/// Add a decoration to target.

View file

@ -69,4 +69,12 @@ Id Module::OpCompositeExtract(Id result_type, Id composite,
return AddCode(std::move(op));
}
Id Module::OpCompositeConstruct(Id result_type, const std::vector<Id>& ids) {
assert(ids.size() >= 1);
auto op{std::make_unique<Op>(spv::Op::OpCompositeConstruct, bound++,
result_type)};
op->Add(ids);
return AddCode(std::move(op));
}
} // namespace Sirit