1//===------- VectorTypeUtils.cpp - Vector type utility functions ----------===// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7//===----------------------------------------------------------------------===// 14/// A helper for converting structs of scalar types to structs of vector types. 15/// Note: Only unpacked literal struct types are supported. 20"expected unpacked struct literal");
22"expected all element types to be valid vector element types");
26 return VectorType::get(ElTy, EC);
30/// A helper for converting structs of vector types to structs of scalar types. 31/// Note: Only unpacked literal struct types are supported. 34"expected unpacked struct literal");
38 return ElTy->getScalarType();
42/// Returns true if `StructTy` is an unpacked literal struct where all elements 43/// are vectors of matching element count. This does not include empty structs. 48if (ElemTys.empty() || !ElemTys.front()->isVectorTy())
50ElementCount VF = cast<VectorType>(ElemTys.front())->getElementCount();
52return Ty->
isVectorTy() && cast<VectorType>(Ty)->getElementCount() == VF;
56/// Returns true if `StructTy` is an unpacked literal struct where all elements 57/// are scalars that can be used as vector element types. 61all_of(ElemTys, VectorType::isValidElementType);
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines less commonly used SmallVector utilities.
Class to represent struct types.
static StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
ArrayRef< Type * > elements() const
The instances of the Type class are immutable: once they are created, they are never changed.
bool isVectorTy() const
True if this is an instance of VectorType.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
bool canVectorizeStructTy(StructType *StructTy)
Returns true if StructTy is an unpacked literal struct where all elements are scalars that can be use...
bool isUnpackedStructLiteral(StructType *StructTy)
auto map_to_vector(ContainerTy &&C, FuncTy &&F)
Map a range to a SmallVector with element types deduced from the mapping.
Type * toVectorizedStructTy(StructType *StructTy, ElementCount EC)
A helper for converting structs of scalar types to structs of vector types.
Type * toScalarizedStructTy(StructType *StructTy)
A helper for converting structs of vector types to structs of scalar types.
bool isVectorizedStructTy(StructType *StructTy)
Returns true if StructTy is an unpacked literal struct where all elements are vectors of matching ele...