LLVM: lib/CodeGen/GlobalISel/LegalizeMutations.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

14

15using namespace llvm;

16

18 return

19 [=](const LegalityQuery &Query) { return std::make_pair(TypeIdx, Ty); };

20}

21

23 unsigned FromTypeIdx) {

25 return std::make_pair(TypeIdx, Query.Types[FromTypeIdx]);

26 };

27}

28

30 unsigned FromTypeIdx) {

32 const LLT OldTy = Query.Types[TypeIdx];

33 const LLT NewTy = Query.Types[FromTypeIdx];

35 };

36}

37

39 LLT NewEltTy) {

41 const LLT OldTy = Query.Types[TypeIdx];

42 return std::make_pair(TypeIdx, OldTy.changeElementType(NewEltTy));

43 };

44}

45

47 unsigned FromTypeIdx) {

49 const LLT OldTy = Query.Types[TypeIdx];

50 const LLT NewTy = Query.Types[FromTypeIdx];

53 return std::make_pair(TypeIdx, OldTy.changeElementCount(NewEltCount));

54 };

55}

56

60 const LLT OldTy = Query.Types[TypeIdx];

62 };

63}

64

66 unsigned FromTypeIdx) {

68 const LLT OldTy = Query.Types[TypeIdx];

69 const LLT NewTy = Query.Types[FromTypeIdx];

71 return std::make_pair(TypeIdx, OldTy.changeElementType(NewEltTy));

72 };

73}

74

76 unsigned Min) {

78 const LLT Ty = Query.Types[TypeIdx];

79 unsigned NewEltSizeInBits =

80 std::max(1u << Log2_32_Ceil(Ty.getScalarSizeInBits()), Min);

81 return std::make_pair(TypeIdx, Ty.changeElementSize(NewEltSizeInBits));

82 };

83}

84

87 unsigned Size) {

89 const LLT Ty = Query.Types[TypeIdx];

90 unsigned NewEltSizeInBits = alignTo(Ty.getScalarSizeInBits(), Size);

91 return std::make_pair(TypeIdx, Ty.changeElementSize(NewEltSizeInBits));

92 };

93}

94

96 unsigned Min) {

98 const LLT VecTy = Query.Types[TypeIdx];

99 unsigned NewNumElements =

101 return std::make_pair(

103 };

104}

105

108 return std::make_pair(TypeIdx, Query.Types[TypeIdx].getElementType());

109 };

110}

Interface for Targets to specify which operations they can successfully select and how the others sho...

static constexpr ElementCount getFixed(ScalarTy MinVal)

constexpr unsigned getScalarSizeInBits() const

constexpr LLT changeElementType(LLT NewEltTy) const

If this type is a vector, return a vector with the same number of elements but the new element type.

static constexpr LLT scalar(unsigned SizeInBits)

Get a low-level scalar or aggregate "bag of bits".

constexpr uint16_t getNumElements() const

Returns the number of elements in a vector LLT.

constexpr bool isVector() const

constexpr LLT getElementType() const

Returns the vector's element type. Only valid for vector types.

constexpr ElementCount getElementCount() const

static constexpr LLT fixed_vector(unsigned NumElements, unsigned ScalarSizeInBits)

Get a low-level fixed-width vector of some number of elements and element width.

constexpr LLT changeElementCount(ElementCount EC) const

Return a vector or scalar with the same element type and the new element count.

LLVM_ABI LegalizeMutation moreElementsToNextPow2(unsigned TypeIdx, unsigned Min=0)

Add more elements to the type for the given type index to the next power of.

Definition LegalizeMutations.cpp:95

LLVM_ABI LegalizeMutation changeElementCountTo(unsigned TypeIdx, unsigned FromTypeIdx)

Keep the same scalar or element type as TypeIdx, but take the number of elements from FromTypeIdx.

Definition LegalizeMutations.cpp:46

LLVM_ABI LegalizeMutation scalarize(unsigned TypeIdx)

Break up the vector type for the given type index into the element type.

Definition LegalizeMutations.cpp:106

LLVM_ABI LegalizeMutation changeElementTo(unsigned TypeIdx, unsigned FromTypeIdx)

Keep the same scalar or element type as the given type index.

Definition LegalizeMutations.cpp:29

LLVM_ABI LegalizeMutation widenScalarOrEltToNextPow2(unsigned TypeIdx, unsigned Min=0)

Widen the scalar type or vector element type for the given type index to the next power of 2.

Definition LegalizeMutations.cpp:75

LLVM_ABI LegalizeMutation changeTo(unsigned TypeIdx, LLT Ty)

Select this specific type for the given type index.

Definition LegalizeMutations.cpp:17

LLVM_ABI LegalizeMutation widenScalarOrEltToNextMultipleOf(unsigned TypeIdx, unsigned Size)

Widen the scalar type or vector element type for the given type index to next multiple of Size.

Definition LegalizeMutations.cpp:86

LLVM_ABI LegalizeMutation changeElementSizeTo(unsigned TypeIdx, unsigned FromTypeIdx)

Change the scalar size or element size to have the same scalar size as type index FromIndex.

Definition LegalizeMutations.cpp:65

This is an optimization pass for GlobalISel generic memory operations.

unsigned Log2_32_Ceil(uint32_t Value)

Return the ceil log base 2 of the specified value, 32 if the value is zero.

std::function< std::pair< unsigned, LLT >(const LegalityQuery &)> LegalizeMutation

uint64_t alignTo(uint64_t Size, Align A)

Returns a multiple of A needed to store Size bytes.

The LegalityQuery object bundles together all the information that's needed to decide whether a given...