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

Method GetVectorComponents

source/opt/constants.cpp:565–584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

563}
564
565std::vector<const analysis::Constant*> Constant::GetVectorComponents(
566 analysis::ConstantManager* const_mgr) const {
567 std::vector<const analysis::Constant*> components;
568 const analysis::VectorConstant* a = this->AsVectorConstant();
569 const analysis::Vector* vector_type = this->type()->AsVector();
570 assert(vector_type != nullptr);
571 if (a != nullptr) {
572 for (uint32_t i = 0; i < vector_type->element_count(); ++i) {
573 components.push_back(a->GetComponents()[i]);
574 }
575 } else {
576 const analysis::Type* element_type = vector_type->element_type();
577 const analysis::Constant* element_null_const =
578 const_mgr->GetConstant(element_type, {});
579 for (uint32_t i = 0; i < vector_type->element_count(); ++i) {
580 components.push_back(element_null_const);
581 }
582 }
583 return components;
584}
585
586} // namespace analysis
587} // namespace opt

Callers 9

FoldVectorTimesScalarFunction · 0.80
FoldVectorTimesMatrixFunction · 0.80
FoldMatrixTimesVectorFunction · 0.80
FoldUnaryOpFunction · 0.80
FoldBinaryOpFunction · 0.80
FoldFPBinaryOpFunction · 0.80
FoldOpDotWithConstantsFunction · 0.80
RedundantAndShiftFunction · 0.80
DotProductDoingExtractFunction · 0.80

Calls 7

AsVectorConstantMethod · 0.95
typeMethod · 0.95
AsVectorMethod · 0.80
element_countMethod · 0.45
push_backMethod · 0.45
element_typeMethod · 0.45
GetConstantMethod · 0.45

Tested by

no test coverage detected