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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16#if defined(_MSC_VER) && !defined(__clang__) && defined(_M_IX86)

17

18

19

20#pragma runtime_checks("", off)

21#pragma optimize("gs", on)

22#endif

23

25

26using namespace llvm;

27

29 return

30 [=](const LegalityQuery &Query) { return Query.Types[TypeIdx] == Type; };

31}

32

35 std::initializer_list TypesInit) {

39 };

40}

41

43 unsigned TypeIdx0, unsigned TypeIdx1,

44 std::initializer_list<std::pair<LLT, LLT>> TypesInit) {

47 std::pair<LLT, LLT> Match = {Query.Types[TypeIdx0], Query.Types[TypeIdx1]};

49 };

50}

51

53 unsigned TypeIdx0, unsigned TypeIdx1, unsigned TypeIdx2,

54 std::initializer_list<std::tuple<LLT, LLT, LLT>> TypesInit) {

57 std::tuple<LLT, LLT, LLT> Match = {

58 Query.Types[TypeIdx0], Query.Types[TypeIdx1], Query.Types[TypeIdx2]};

60 };

61}

62

64 unsigned TypeIdx0, unsigned TypeIdx1, unsigned MMOIdx,

65 std::initializer_list TypesAndMemDescInit) {

68 TypePairAndMemDesc Match = {Query.Types[TypeIdx0], Query.Types[TypeIdx1],

69 Query.MMODescrs[MMOIdx].MemoryTy,

70 Query.MMODescrs[MMOIdx].AlignInBits};

74 });

75 };

76}

77

80 return Query.Types[TypeIdx].isScalar();

81 };

82}

83

86 return Query.Types[TypeIdx].isVector();

87 };

88}

89

92 return Query.Types[TypeIdx].isPointer();

93 };

94}

95

97 unsigned AddrSpace) {

99 LLT Ty = Query.Types[TypeIdx];

100 return Ty.isPointer() && Ty.getAddressSpace() == AddrSpace;

101 };

102}

103

106 return Query.Types[TypeIdx].isPointerVector();

107 };

108}

109

111 LLT EltTy) {

113 const LLT QueryTy = Query.Types[TypeIdx];

115 };

116}

117

119 unsigned Size) {

121 const LLT QueryTy = Query.Types[TypeIdx];

123 };

124}

125

127 unsigned Size) {

129 const LLT QueryTy = Query.Types[TypeIdx];

131 };

132}

133

135 unsigned TypeIdx1) {

137 return Query.Types[TypeIdx0].getSizeInBits() <

138 Query.Types[TypeIdx1].getSizeInBits();

139 };

140}

141

143 unsigned TypeIdx1) {

145 return Query.Types[TypeIdx0].getSizeInBits() >

146 Query.Types[TypeIdx1].getSizeInBits();

147 };

148}

149

151 unsigned Size) {

153 const LLT QueryTy = Query.Types[TypeIdx];

155 };

156}

157

160 unsigned Size) {

161

163 const LLT QueryTy = Query.Types[TypeIdx];

165 };

166}

167

170 unsigned Size) {

171

173 const LLT QueryTy = Query.Types[TypeIdx];

175 };

176}

177

179 unsigned Size) {

181 const LLT QueryTy = Query.Types[TypeIdx];

183 };

184}

185

188 const LLT QueryTy = Query.Types[TypeIdx];

190 };

191}

192

194 unsigned Size) {

196 const LLT QueryTy = Query.Types[TypeIdx];

198 };

199}

200

203 const LLT QueryTy = Query.Types[TypeIdx];

206 };

207}

208

211 return Query.Types[TypeIdx].getSizeInBits() == Size;

212 };

213}

214

216 unsigned TypeIdx1) {

218 return Query.Types[TypeIdx0].getSizeInBits() ==

219 Query.Types[TypeIdx1].getSizeInBits();

220 };

221}

222

226 Query.MMODescrs[MMOIdx].MemoryTy.getSizeInBytes());

227 };

228}

229

232 const LLT MemTy = Query.MMODescrs[MMOIdx].MemoryTy;

236 };

237}

238

241 const LLT QueryTy = Query.Types[TypeIdx];

243 };

244}

245

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

constexpr unsigned getScalarSizeInBits() const

constexpr bool isScalar() const

constexpr uint16_t getNumElements() const

Returns the number of elements in a vector LLT.

constexpr bool isVector() const

constexpr bool isByteSized() const

constexpr TypeSize getSizeInBits() const

Returns the total size of the type. Must only be called on sized types.

constexpr bool isPointer() const

constexpr LLT getElementType() const

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

constexpr bool isFixedVector() const

Returns true if the LLT is a fixed vector.

constexpr TypeSize getSizeInBytes() const

Returns the total size of the type in bytes, i.e.

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

The instances of the Type class are immutable: once they are created, they are never changed.

constexpr ScalarTy getKnownMinValue() const

Returns the minimum value this quantity can represent.

LLVM_ABI LegalityPredicate scalarOrEltWiderThan(unsigned TypeIdx, unsigned Size)

True iff the specified type index is a scalar or a vector with an element type that's wider than the ...

Definition LegalityPredicates.cpp:178

LLVM_ABI LegalityPredicate isScalar(unsigned TypeIdx)

True iff the specified type index is a scalar.

Definition LegalityPredicates.cpp:78

LLVM_ABI LegalityPredicate memSizeInBytesNotPow2(unsigned MMOIdx)

True iff the specified MMO index has a size (rounded to bytes) that is not a power of 2.

Definition LegalityPredicates.cpp:223

LLVM_ABI LegalityPredicate numElementsNotPow2(unsigned TypeIdx)

True iff the specified type index is a vector whose element count is not a power of 2.

Definition LegalityPredicates.cpp:239

LLVM_ABI LegalityPredicate isPointerVector(unsigned TypeIdx)

True iff the specified type index is a vector of pointers (with any address space).

Definition LegalityPredicates.cpp:104

LLVM_ABI LegalityPredicate isPointer(unsigned TypeIdx)

True iff the specified type index is a pointer (with any address space).

Definition LegalityPredicates.cpp:90

LLVM_ABI LegalityPredicate vectorElementCountIsLessThanOrEqualTo(unsigned TypeIdx, unsigned Size)

True iff the specified type index is a vector with a number of elements that's less than or equal to ...

Definition LegalityPredicates.cpp:169

LLVM_ABI LegalityPredicate typeInSet(unsigned TypeIdx, std::initializer_list< LLT > TypesInit)

True iff the given type index is one of the specified types.

Definition LegalityPredicates.cpp:34

LLVM_ABI LegalityPredicate smallerThan(unsigned TypeIdx0, unsigned TypeIdx1)

True iff the first type index has a smaller total bit size than second type index.

Definition LegalityPredicates.cpp:134

LLVM_ABI LegalityPredicate atomicOrderingAtLeastOrStrongerThan(unsigned MMOIdx, AtomicOrdering Ordering)

True iff the specified MMO index has at an atomic ordering of at Ordering or stronger.

Definition LegalityPredicates.cpp:246

LLVM_ABI LegalityPredicate scalarOrEltSizeNotPow2(unsigned TypeIdx)

True iff the specified type index is a scalar or vector whose element size is not a power of 2.

Definition LegalityPredicates.cpp:186

LLVM_ABI LegalityPredicate largerThan(unsigned TypeIdx0, unsigned TypeIdx1)

True iff the first type index has a larger total bit size than second type index.

Definition LegalityPredicates.cpp:142

LLVM_ABI LegalityPredicate typePairInSet(unsigned TypeIdx0, unsigned TypeIdx1, std::initializer_list< std::pair< LLT, LLT > > TypesInit)

True iff the given types for the given pair of type indexes is one of the specified type pairs.

Definition LegalityPredicates.cpp:42

LLVM_ABI LegalityPredicate vectorElementCountIsGreaterThan(unsigned TypeIdx, unsigned Size)

True iff the specified type index is a vector with a number of elements that's greater than the given...

Definition LegalityPredicates.cpp:159

LLVM_ABI LegalityPredicate memSizeNotByteSizePow2(unsigned MMOIdx)

True iff the specified MMO index has a size that is not an even byte size, or that even byte size is ...

Definition LegalityPredicates.cpp:230

LLVM_ABI LegalityPredicate elementTypeIs(unsigned TypeIdx, LLT EltTy)

True if the type index is a vector with element type EltTy.

Definition LegalityPredicates.cpp:110

LLVM_ABI LegalityPredicate sameSize(unsigned TypeIdx0, unsigned TypeIdx1)

True iff the specified type indices are both the same bit size.

Definition LegalityPredicates.cpp:215

LLVM_ABI LegalityPredicate scalarOrEltNarrowerThan(unsigned TypeIdx, unsigned Size)

True iff the specified type index is a scalar or vector with an element type that's narrower than the...

Definition LegalityPredicates.cpp:150

LLVM_ABI LegalityPredicate sizeIs(unsigned TypeIdx, unsigned Size)

True if the total bitwidth of the specified type index is Size bits.

Definition LegalityPredicates.cpp:209

LLVM_ABI LegalityPredicate isVector(unsigned TypeIdx)

True iff the specified type index is a vector.

Definition LegalityPredicates.cpp:84

LLVM_ABI LegalityPredicate sizeNotPow2(unsigned TypeIdx)

True iff the specified type index is a scalar whose size is not a power of.

Definition LegalityPredicates.cpp:201

LLVM_ABI LegalityPredicate typeTupleInSet(unsigned TypeIdx0, unsigned TypeIdx1, unsigned Type2, std::initializer_list< std::tuple< LLT, LLT, LLT > > TypesInit)

True iff the given types for the given tuple of type indexes is one of the specified type tuple.

Definition LegalityPredicates.cpp:52

LLVM_ABI LegalityPredicate typePairAndMemDescInSet(unsigned TypeIdx0, unsigned TypeIdx1, unsigned MMOIdx, std::initializer_list< TypePairAndMemDesc > TypesAndMemDescInit)

True iff the given types for the given pair of type indexes is one of the specified type pairs.

Definition LegalityPredicates.cpp:63

LLVM_ABI LegalityPredicate sizeNotMultipleOf(unsigned TypeIdx, unsigned Size)

True iff the specified type index is a scalar whose size is not a multiple of Size.

Definition LegalityPredicates.cpp:193

LLVM_ABI LegalityPredicate typeIs(unsigned TypeIdx, LLT TypesInit)

True iff the given type index is the specified type.

Definition LegalityPredicates.cpp:28

LLVM_ABI LegalityPredicate scalarWiderThan(unsigned TypeIdx, unsigned Size)

True iff the specified type index is a scalar that's wider than the given size.

Definition LegalityPredicates.cpp:126

LLVM_ABI LegalityPredicate scalarNarrowerThan(unsigned TypeIdx, unsigned Size)

True iff the specified type index is a scalar that's narrower than the given size.

Definition LegalityPredicates.cpp:118

This is an optimization pass for GlobalISel generic memory operations.

constexpr bool has_single_bit(T Value) noexcept

bool any_of(R &&range, UnaryPredicate P)

Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.

std::function< bool(const LegalityQuery &)> LegalityPredicate

constexpr bool isPowerOf2_32(uint32_t Value)

Return true if the argument is a power of two > 0.

bool isAtLeastOrStrongerThan(AtomicOrdering AO, AtomicOrdering Other)

AtomicOrdering

Atomic ordering for LLVM's memory model.

bool is_contained(R &&Range, const E &Element)

Returns true if Element is found in Range.

bool isCompatible(const TypePairAndMemDesc &Other) const

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