LLVM: lib/IR/VectorTypeUtils.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

11

12using namespace llvm;

13

14

15

17 if (EC.isScalar())

18 return StructTy;

20 "expected unpacked struct literal");

22 "expected all element types to be valid vector element types");

26 return VectorType::get(ElTy, EC);

27 }));

28}

29

30

31

34 "expected unpacked struct literal");

38 return ElTy->getScalarType();

39 }));

40}

41

42

43

46 return false;

47 auto ElemTys = StructTy->elements();

48 if (ElemTys.empty() || !ElemTys.front()->isVectorTy())

49 return false;

51 return all_of(ElemTys, [&](Type *Ty) {

52 return Ty->isVectorTy() && cast(Ty)->getElementCount() == VF;

53 });

54}

55

56

57

59 auto ElemTys = StructTy->elements();

62}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

Class to represent struct types.

static LLVM_ABI 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.

LLVMContext & getContext() const

Return the LLVMContext in which this type was uniqued.

static LLVM_ABI bool isValidElementType(Type *ElemTy)

Return true if the specified type is valid as a element type.

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.

LLVM_ABI bool canVectorizeStructTy(StructType *StructTy)

Returns true if StructTy is an unpacked literal struct where all elements are scalars that can be use...

Definition VectorTypeUtils.cpp:58

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.

LLVM_ABI Type * toVectorizedStructTy(StructType *StructTy, ElementCount EC)

A helper for converting structs of scalar types to structs of vector types.

Definition VectorTypeUtils.cpp:16

decltype(auto) cast(const From &Val)

cast - Return the argument parameter cast to the specified type.

LLVM_ABI Type * toScalarizedStructTy(StructType *StructTy)

A helper for converting structs of vector types to structs of scalar types.

Definition VectorTypeUtils.cpp:32

LLVM_ABI bool isVectorizedStructTy(StructType *StructTy)

Returns true if StructTy is an unpacked literal struct where all elements are vectors of matching ele...

Definition VectorTypeUtils.cpp:44