MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / BuildCompositeConstruct

Function BuildCompositeConstruct

source/opt/folding_rules.cpp:2765–2779  ·  view source on GitHub ↗

Returns an OpCompositeConstruct instruction that build an object with |type_id| out of the values in |values_inserted|. Each value will be placed at the index corresponding to the value. The new instruction will be placed before |insert_before|.

Source from the content-addressed store, hash-verified

2763// placed at the index corresponding to the value. The new instruction will
2764// be placed before |insert_before|.
2765Instruction* BuildCompositeConstruct(
2766 uint32_t type_id, const std::map<uint32_t, uint32_t>& values_inserted,
2767 Instruction* insert_before) {
2768 InstructionBuilder ir_builder(
2769 insert_before->context(), insert_before,
2770 IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping);
2771
2772 std::vector<uint32_t> ids_in_order;
2773 for (auto it : values_inserted) {
2774 ids_in_order.push_back(it.second);
2775 }
2776 Instruction* construct =
2777 ir_builder.AddCompositeConstruct(type_id, ids_in_order);
2778 return construct;
2779}
2780
2781// Replaces the OpCompositeInsert |inst| that inserts |construct| into the same
2782// object as |inst| with final index removed. If the resulting

Callers 1

Calls 3

AddCompositeConstructMethod · 0.80
contextMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected