LLVM: lib/Target/NVPTX/NVPTXUtilities.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_LIB_TARGET_NVPTX_NVPTXUTILITIES_H

14#define LLVM_LIB_TARGET_NVPTX_NVPTXUTILITIES_H

15

27#include

28#include

29

30namespace llvm {

31

33

35

44

48

52

56

60

62

66

68

70 return F.getAttributes().getAttributes(Index).getStackAlignment();

71}

72

73MaybeAlign getAlign(const CallInst &, unsigned);

75

76

77

79 if (size <= 32)

80 return 32;

81 if (size <= 64)

82 return 64;

83 if (size <= 128)

84 return 128;

86}

87

89

91 return Ty->isAggregateType() || Ty->isVectorTy() ||

92 Ty->getScalarSizeInBits() >= 128 || Ty->isHalfTy() || Ty->isBFloatTy();

93}

94

95namespace NVPTX {

96

97

98

100 static const auto PackedTypes = {MVT::v4i8, MVT::v2f16, MVT::v2bf16,

101 MVT::v2i16, MVT::v2f32, MVT::v2i32};

102 return PackedTypes;

103}

104

105

109

110

115

117 std::string ValidName;

118 ValidName.reserve(Name.size() + 4);

119 for (char C : Name)

120

121

122 if (isAlnum(C) || C == '_' || C == '$')

123 ValidName.push_back(C);

124 else

125 ValidName.append({'_', '$', '_'});

126

127 return ValidName;

128}

129

131 switch (Order) {

133 return "NotAtomic";

135 return "Relaxed";

137 return "Acquire";

139 return "Release";

141 return "AcquireRelease";

143 return "SequentiallyConsistent";

145 return "Volatile";

147 return "RelaxedMMIO";

148 }

151}

152

157

159 switch (S) {

161 return "Thread";

163 return "System";

165 return "Block";

167 return "Cluster";

169 return "Device";

171 return "DefaultDevice";

172 }

175}

176

181

183 switch (A) {

185 return "generic";

187 return "global";

189 return "const";

191 return "shared";

193 return "shared::cluster";

195 return "param";

197 return "local";

198 }

201}

202

207

208}

209}

210

211#endif

static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

This file defines the SmallVector class.

A Module instance is used to store all the information related to an LLVM module.

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

StringRef - Represent a constant reference to a string, i.e.

Primary interface to the complete machine description for the target machine.

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

LLVM Value Representation.

This class implements an extremely fast bulk output stream that can only output to a stream.

@ PTX_Kernel

Call to a PTX kernel. Passes all arguments in parameter space.

@ C

The default llvm calling convention, compatible with C.

raw_ostream & operator<<(raw_ostream &O, Ordering Order)

Definition NVPTXUtilities.h:153

unsigned int OrderingUnderlyingType

std::string ScopeToString(Scope S)

Definition NVPTXUtilities.h:158

auto packed_types()

Definition NVPTXUtilities.h:99

std::string OrderingToString(Ordering Order)

Definition NVPTXUtilities.h:130

unsigned int ScopeUnderlyingType

bool isPackedVectorTy(EVT VT)

Definition NVPTXUtilities.h:106

bool isPackedElementTy(EVT ET)

Definition NVPTXUtilities.h:111

std::string AddressSpaceToString(AddressSpace A)

Definition NVPTXUtilities.h:182

unsigned int AddressSpaceUnderlyingType

std::string getValidPTXIdentifier(StringRef Name)

Definition NVPTXUtilities.h:116

This is an optimization pass for GlobalISel generic memory operations.

bool isManaged(const Value &V)

std::optional< uint64_t > getOverallClusterRank(const Function &F)

bool shouldEmitPTXNoReturn(const Value *V, const TargetMachine &TM)

MaybeAlign getAlign(const CallInst &I, unsigned Index)

auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)

Get the size of a range.

std::optional< unsigned > getMaxNReg(const Function &F)

StringRef getSamplerName(const Value &V)

bool isImageReadWrite(const Value &V)

bool isImageReadOnly(const Value &V)

std::optional< unsigned > getMinCTASm(const Function &F)

SmallVector< unsigned, 3 > getReqNTID(const Function &F)

bool any_of(R &&range, UnaryPredicate P)

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

auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)

bool isImage(const Value &V)

bool isSampler(const Value &V)

unsigned promoteScalarArgumentSize(unsigned size)

Definition NVPTXUtilities.h:78

void clearAnnotationCache(const Module *Mod)

LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)

bool shouldPassAsArray(Type *Ty)

Definition NVPTXUtilities.h:90

bool isAlnum(char C)

Checks whether character C is either a decimal digit or an uppercase or lowercase letter as classifie...

bool isSurface(const Value &V)

std::optional< unsigned > getMaxClusterRank(const Function &F)

StringRef getTextureName(const Value &V)

SmallVector< unsigned, 3 > getMaxNTID(const Function &F)

bool isParamGridConstant(const Argument &Arg)

StringRef getSurfaceName(const Value &V)

std::optional< uint64_t > getOverallReqNTID(const Function &F)

bool isKernelFunction(const Function &F)

Definition NVPTXUtilities.h:63

bool isTexture(const Value &V)

Function * getMaybeBitcastedCallee(const CallBase *CB)

bool isImageWriteOnly(const Value &V)

std::optional< uint64_t > getOverallMaxNTID(const Function &F)

bool hasBlocksAreClusters(const Function &F)

SmallVector< unsigned, 3 > getClusterDim(const Function &F)

EVT getVectorElementType() const

Given a vector type, return the type of each element.

This struct is a compact representation of a valid (power of two) or undefined (0) alignment.