LLVM 20.0.0git
SPIRVUtils.h
Go to the documentation of this file.
1//===--- SPIRVUtils.h ---- SPIR-V Utility Functions -------------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains miscellaneous utility functions.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_SPIRV_SPIRVUTILS_H
14#define LLVM_LIB_TARGET_SPIRV_SPIRVUTILS_H
15
19#include "llvm/IR/Dominators.h"
20#include "llvm/IR/IRBuilder.h"
22#include <queue>
23#include <string>
24#include <unordered_set>
25
26namespace llvm {
27class MCInst;
28class MachineFunction;
29class MachineInstr;
30class MachineInstrBuilder;
31class MachineIRBuilder;
32class MachineRegisterInfo;
33class Register;
34class StringRef;
35class SPIRVInstrInfo;
36class SPIRVSubtarget;
37class SPIRVGlobalRegistry;
38
39// This class implements a partial ordering visitor, which visits a cyclic graph
40// in natural topological-like ordering. Topological ordering is not defined for
41// directed graphs with cycles, so this assumes cycles are a single node, and
42// ignores back-edges. The cycle is visited from the entry in the same
43// topological-like ordering.
44//
45// Note: this visitor REQUIRES a reducible graph.
46//
47// This means once we visit a node, we know all the possible ancestors have been
48// visited.
49//
50// clang-format off
51//
52// Given this graph:
53//
54// ,-> B -\
55// A -+ +---> D ----> E -> F -> G -> H
56// `-> C -/ ^ |
57// +-----------------+
58//
59// Visit order is:
60// A, [B, C in any order], D, E, F, G, H
61//
62// clang-format on
63//
64// Changing the function CFG between the construction of the visitor and
65// visiting is undefined. The visitor can be reused, but if the CFG is updated,
66// the visitor must be rebuilt.
69 LoopInfo LI;
70
71 std::unordered_set<BasicBlock *> Queued = {};
72 std::queue<BasicBlock *> ToVisit = {};
73
74 struct OrderInfo {
75 size_t Rank;
76 size_t TraversalIndex;
77 };
78
79 using BlockToOrderInfoMap = std::unordered_map<BasicBlock *, OrderInfo>;
80 BlockToOrderInfoMap BlockToOrder;
81 std::vector<BasicBlock *> Order = {};
82
83 // Get all basic-blocks reachable from Start.
84 std::unordered_set<BasicBlock *> getReachableFrom(BasicBlock *Start);
85
86 // Internal function used to determine the partial ordering.
87 // Visits |BB| with the current rank being |Rank|.
88 size_t visit(BasicBlock *BB, size_t Rank);
89
90 bool CanBeVisited(BasicBlock *BB) const;
91
92public:
93 size_t GetNodeRank(BasicBlock *BB) const;
94
95 // Build the visitor to operate on the function F.
97
98 // Returns true is |LHS| comes before |RHS| in the partial ordering.
99 // If |LHS| and |RHS| have the same rank, the traversal order determines the
100 // order (order is stable).
101 bool compare(const BasicBlock *LHS, const BasicBlock *RHS) const;
102
103 // Visit the function starting from the basic block |Start|, and calling |Op|
104 // on each visited BB. This traversal ignores back-edges, meaning this won't
105 // visit a node to which |Start| is not an ancestor.
106 // If Op returns |true|, the visitor continues. If |Op| returns false, the
107 // visitor will stop at that rank. This means if 2 nodes share the same rank,
108 // and Op returns false when visiting the first, the second will be visited
109 // afterwards. But none of their successors will.
110 void partialOrderVisit(BasicBlock &Start,
111 std::function<bool(BasicBlock *)> Op);
112};
113
114// Add the given string as a series of integer operand, inserting null
115// terminators and padding to make sure the operands all have 32-bit
116// little-endian words.
117void addStringImm(const StringRef &Str, MCInst &Inst);
118void addStringImm(const StringRef &Str, MachineInstrBuilder &MIB);
119void addStringImm(const StringRef &Str, IRBuilder<> &B,
120 std::vector<Value *> &Args);
121
122// Read the series of integer operands back as a null-terminated string using
123// the reverse of the logic in addStringImm.
124std::string getStringImm(const MachineInstr &MI, unsigned StartIndex);
125
126// Add the given numerical immediate to MIB.
127void addNumImm(const APInt &Imm, MachineInstrBuilder &MIB);
128
129// Add an OpName instruction for the given target register.
131 MachineIRBuilder &MIRBuilder);
133 const SPIRVInstrInfo &TII);
134
135// Add an OpDecorate instruction for the given Reg.
137 SPIRV::Decoration::Decoration Dec,
138 const std::vector<uint32_t> &DecArgs,
139 StringRef StrImm = "");
141 SPIRV::Decoration::Decoration Dec,
142 const std::vector<uint32_t> &DecArgs,
143 StringRef StrImm = "");
144
145// Add an OpDecorate instruction by "spirv.Decorations" metadata node.
147 const MDNode *GVarMD);
148
149// Return a valid position for the OpVariable instruction inside a function,
150// i.e., at the beginning of the first block of the function.
152
153// Return a valid position for the instruction at the end of the block before
154// terminators and debug instructions.
156
157// Convert a SPIR-V storage class to the corresponding LLVM IR address space.
158// TODO: maybe the following two functions should be handled in the subtarget
159// to allow for different OpenCL vs Vulkan handling.
160constexpr unsigned
161storageClassToAddressSpace(SPIRV::StorageClass::StorageClass SC) {
162 switch (SC) {
163 case SPIRV::StorageClass::Function:
164 return 0;
165 case SPIRV::StorageClass::CrossWorkgroup:
166 return 1;
167 case SPIRV::StorageClass::UniformConstant:
168 return 2;
169 case SPIRV::StorageClass::Workgroup:
170 return 3;
171 case SPIRV::StorageClass::Generic:
172 return 4;
173 case SPIRV::StorageClass::DeviceOnlyINTEL:
174 return 5;
175 case SPIRV::StorageClass::HostOnlyINTEL:
176 return 6;
177 case SPIRV::StorageClass::Input:
178 return 7;
179 case SPIRV::StorageClass::Output:
180 return 8;
181 case SPIRV::StorageClass::CodeSectionINTEL:
182 return 9;
183 case SPIRV::StorageClass::Private:
184 return 10;
185 default:
186 report_fatal_error("Unable to get address space id");
187 }
188}
189
190// Convert an LLVM IR address space to a SPIR-V storage class.
191SPIRV::StorageClass::StorageClass
192addressSpaceToStorageClass(unsigned AddrSpace, const SPIRVSubtarget &STI);
193
194SPIRV::MemorySemantics::MemorySemantics
195getMemSemanticsForStorageClass(SPIRV::StorageClass::StorageClass SC);
196
197SPIRV::MemorySemantics::MemorySemantics getMemSemantics(AtomicOrdering Ord);
198
199SPIRV::Scope::Scope getMemScope(LLVMContext &Ctx, SyncScope::ID Id);
200
201// Find def instruction for the given ConstReg, walking through
202// spv_track_constant and ASSIGN_TYPE instructions. Updates ConstReg by def
203// of OpConstant instruction.
204MachineInstr *getDefInstrMaybeConstant(Register &ConstReg,
205 const MachineRegisterInfo *MRI);
206
207// Get constant integer value of the given ConstReg.
208uint64_t getIConstVal(Register ConstReg, const MachineRegisterInfo *MRI);
209
210// Check if MI is a SPIR-V specific intrinsic call.
211bool isSpvIntrinsic(const MachineInstr &MI, Intrinsic::ID IntrinsicID);
212// Check if it's a SPIR-V specific intrinsic call.
213bool isSpvIntrinsic(const Value *Arg);
214
215// Get type of i-th operand of the metadata node.
216Type *getMDOperandAsType(const MDNode *N, unsigned I);
217
218// If OpenCL or SPIR-V builtin function name is recognized, return a demangled
219// name, otherwise return an empty string.
220std::string getOclOrSpirvBuiltinDemangledName(StringRef Name);
221
222// Check if a string contains a builtin prefix.
223bool hasBuiltinTypePrefix(StringRef Name);
224
225// Check if given LLVM type is a special opaque builtin type.
226bool isSpecialOpaqueType(const Type *Ty);
227
228// Check if the function is an SPIR-V entry point
229bool isEntryPoint(const Function &F);
230
231// Parse basic scalar type name, substring TypeName, and return LLVM type.
232Type *parseBasicTypeName(StringRef &TypeName, LLVMContext &Ctx);
233
234// Sort blocks in a partial ordering, so each block is after all its
235// dominators. This should match both the SPIR-V and the MIR requirements.
236// Returns true if the function was changed.
237bool sortBlocks(Function &F);
238
239// True if this is an instance of TypedPointerType.
240inline bool isTypedPointerTy(const Type *T) {
241 return T && T->getTypeID() == Type::TypedPointerTyID;
242}
243
244// True if this is an instance of PointerType.
245inline bool isUntypedPointerTy(const Type *T) {
246 return T && T->getTypeID() == Type::PointerTyID;
247}
248
249// True if this is an instance of PointerType or TypedPointerType.
250inline bool isPointerTy(const Type *T) {
252}
253
254// Get the address space of this pointer or pointer vector type for instances of
255// PointerType or TypedPointerType.
256inline unsigned getPointerAddressSpace(const Type *T) {
257 Type *SubT = T->getScalarType();
258 return SubT->getTypeID() == Type::PointerTyID
259 ? cast<PointerType>(SubT)->getAddressSpace()
260 : cast<TypedPointerType>(SubT)->getAddressSpace();
261}
262
263// Return true if the Argument is decorated with a pointee type
264inline bool hasPointeeTypeAttr(Argument *Arg) {
265 return Arg->hasByValAttr() || Arg->hasByRefAttr() || Arg->hasStructRetAttr();
266}
267
268// Return the pointee type of the argument or nullptr otherwise
270 if (Arg->hasByValAttr())
271 return Arg->getParamByValType();
272 if (Arg->hasStructRetAttr())
273 return Arg->getParamStructRetType();
274 if (Arg->hasByRefAttr())
275 return Arg->getParamByRefType();
276 return nullptr;
277}
278
280 SmallVector<Type *> ArgTys;
281 for (unsigned i = 0; i < F->arg_size(); ++i)
282 ArgTys.push_back(F->getArg(i)->getType());
283 return FunctionType::get(F->getReturnType(), ArgTys, F->isVarArg());
284}
285
286#define TYPED_PTR_TARGET_EXT_NAME "spirv.$TypedPointerType"
287inline Type *getTypedPointerWrapper(Type *ElemTy, unsigned AS) {
289 {ElemTy}, {AS});
290}
291
292inline bool isTypedPointerWrapper(const TargetExtType *ExtTy) {
293 return ExtTy->getName() == TYPED_PTR_TARGET_EXT_NAME &&
294 ExtTy->getNumIntParameters() == 1 &&
295 ExtTy->getNumTypeParameters() == 1;
296}
297
298// True if this is an instance of PointerType or TypedPointerType.
299inline bool isPointerTyOrWrapper(const Type *Ty) {
300 if (auto *ExtTy = dyn_cast<TargetExtType>(Ty))
301 return isTypedPointerWrapper(ExtTy);
302 return isPointerTy(Ty);
303}
304
305inline Type *applyWrappers(Type *Ty) {
306 if (auto *ExtTy = dyn_cast<TargetExtType>(Ty)) {
307 if (isTypedPointerWrapper(ExtTy))
308 return TypedPointerType::get(applyWrappers(ExtTy->getTypeParameter(0)),
309 ExtTy->getIntParameter(0));
310 } else if (auto *VecTy = dyn_cast<VectorType>(Ty)) {
311 Type *ElemTy = VecTy->getElementType();
312 Type *NewElemTy = ElemTy->isTargetExtTy() ? applyWrappers(ElemTy) : ElemTy;
313 if (NewElemTy != ElemTy)
314 return VectorType::get(NewElemTy, VecTy->getElementCount());
315 }
316 return Ty;
317}
318
319inline Type *getPointeeType(const Type *Ty) {
320 if (Ty) {
321 if (auto PType = dyn_cast<TypedPointerType>(Ty))
322 return PType->getElementType();
323 else if (auto *ExtTy = dyn_cast<TargetExtType>(Ty))
324 if (isTypedPointerWrapper(ExtTy))
325 return ExtTy->getTypeParameter(0);
326 }
327 return nullptr;
328}
329
330inline bool isUntypedEquivalentToTyExt(Type *Ty1, Type *Ty2) {
331 if (!isUntypedPointerTy(Ty1) || !Ty2)
332 return false;
333 if (auto *ExtTy = dyn_cast<TargetExtType>(Ty2))
334 if (isTypedPointerWrapper(ExtTy) &&
335 ExtTy->getTypeParameter(0) ==
337 ExtTy->getIntParameter(0) == cast<PointerType>(Ty1)->getAddressSpace())
338 return true;
339 return false;
340}
341
342inline bool isEquivalentTypes(Type *Ty1, Type *Ty2) {
343 return isUntypedEquivalentToTyExt(Ty1, Ty2) ||
345}
346
348 if (Type *NewTy = applyWrappers(Ty); NewTy != Ty)
349 return NewTy;
350 return isUntypedPointerTy(Ty)
353 : Ty;
354}
355
357 Type *OrigRetTy = FTy->getReturnType();
358 Type *RetTy = toTypedPointer(OrigRetTy);
359 bool IsUntypedPtr = false;
360 for (Type *PTy : FTy->params()) {
361 if (isUntypedPointerTy(PTy)) {
362 IsUntypedPtr = true;
363 break;
364 }
365 }
366 if (!IsUntypedPtr && RetTy == OrigRetTy)
367 return FTy;
368 SmallVector<Type *> ParamTys;
369 for (Type *PTy : FTy->params())
370 ParamTys.push_back(toTypedPointer(PTy));
371 return FunctionType::get(RetTy, ParamTys, FTy->isVarArg());
372}
373
374inline const Type *unifyPtrType(const Type *Ty) {
375 if (auto FTy = dyn_cast<FunctionType>(Ty))
376 return toTypedFunPointer(const_cast<FunctionType *>(FTy));
377 return toTypedPointer(const_cast<Type *>(Ty));
378}
379
380MachineInstr *getVRegDef(MachineRegisterInfo &MRI, Register Reg);
381
382#define SPIRV_BACKEND_SERVICE_FUN_NAME "__spirv_backend_service_fun"
383bool getVacantFunctionName(Module &M, std::string &Name);
384
385void setRegClassType(Register Reg, const Type *Ty, SPIRVGlobalRegistry *GR,
386 MachineIRBuilder &MIRBuilder, bool Force = false);
389 const MachineFunction &MF, bool Force = false);
393 const MachineFunction &MF);
396 MachineIRBuilder &MIRBuilder);
398 MachineIRBuilder &MIRBuilder);
399
400// Return true if there is an opaque pointer type nested in the argument.
401bool isNestedPointer(const Type *Ty);
402
404
405inline FPDecorationId demangledPostfixToDecorationId(const std::string &S) {
406 static std::unordered_map<std::string, FPDecorationId> Mapping = {
407 {"rte", FPDecorationId::RTE},
408 {"rtz", FPDecorationId::RTZ},
409 {"rtp", FPDecorationId::RTP},
410 {"rtn", FPDecorationId::RTN},
411 {"sat", FPDecorationId::SAT}};
412 auto It = Mapping.find(S);
413 return It == Mapping.end() ? FPDecorationId::NONE : It->second;
414}
415
416} // namespace llvm
417#endif // LLVM_LIB_TARGET_SPIRV_SPIRVUTILS_H
unsigned const MachineRegisterInfo * MRI
MachineBasicBlock & MBB
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
return RetTy
std::string Name
const HexagonInstrInfo * TII
IRTranslator LLVM IR MI
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
unsigned Reg
Promote Memory to Register
Definition: Mem2Reg.cpp:110
#define TYPED_PTR_TARGET_EXT_NAME
Definition: SPIRVUtils.h:286
Value * RHS
Value * LHS
Class for arbitrary precision integers.
Definition: APInt.h:78
This class represents an incoming formal argument to a Function.
Definition: Argument.h:31
Type * getParamByRefType() const
If this is a byref argument, return its type.
Definition: Function.cpp:245
bool hasByRefAttr() const
Return true if this argument has the byref attribute.
Definition: Function.cpp:149
Type * getParamStructRetType() const
If this is an sret argument, return its type.
Definition: Function.cpp:240
bool hasByValAttr() const
Return true if this argument has the byval attribute.
Definition: Function.cpp:144
Type * getParamByValType() const
If this is a byval argument, return its type.
Definition: Function.cpp:235
bool hasStructRetAttr() const
Return true if this argument has the sret attribute.
Definition: Function.cpp:298
LLVM Basic Block Representation.
Definition: BasicBlock.h:61
This class represents an Operation in the Expression.
Core dominator tree base class.
Class to represent function types.
Definition: DerivedTypes.h:105
ArrayRef< Type * > params() const
Definition: DerivedTypes.h:132
bool isVarArg() const
Definition: DerivedTypes.h:125
Type * getReturnType() const
Definition: DerivedTypes.h:126
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition: IRBuilder.h:2697
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:185
Metadata node.
Definition: Metadata.h:1069
Helper class to build MachineInstr.
Representation of each machine instruction.
Definition: MachineInstr.h:69
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
size_t GetNodeRank(BasicBlock *BB) const
Definition: SPIRVUtils.cpp:558
void partialOrderVisit(BasicBlock &Start, std::function< bool(BasicBlock *)> Op)
Definition: SPIRVUtils.cpp:649
bool compare(const BasicBlock *LHS, const BasicBlock *RHS) const
Definition: SPIRVUtils.cpp:640
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
void push_back(const T &Elt)
Definition: SmallVector.h:413
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1196
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
Class to represent target extensions types, which are generally unintrospectable from target-independ...
Definition: DerivedTypes.h:744
unsigned getNumIntParameters() const
Definition: DerivedTypes.h:802
static TargetExtType * get(LLVMContext &Context, StringRef Name, ArrayRef< Type * > Types={}, ArrayRef< unsigned > Ints={})
Return a target extension type having the specified name and optional type and integer parameters.
Definition: Type.cpp:895
unsigned getNumTypeParameters() const
Definition: DerivedTypes.h:793
StringRef getName() const
Return the name for this target extension type.
Definition: DerivedTypes.h:778
Target - Wrapper for Target specific information.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
@ TypedPointerTyID
Typed pointer used by some GPU targets.
Definition: Type.h:77
@ PointerTyID
Pointers.
Definition: Type.h:72
bool isTargetExtTy() const
Return true if this is a target extension type.
Definition: Type.h:203
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Definition: Type.h:128
static IntegerType * getInt8Ty(LLVMContext &C)
TypeID getTypeID() const
Return the type id for the type.
Definition: Type.h:136
static TypedPointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space.
static VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
void buildOpName(Register Target, const StringRef &Name, MachineIRBuilder &MIRBuilder)
Definition: SPIRVUtils.cpp:103
bool getVacantFunctionName(Module &M, std::string &Name)
Definition: SPIRVUtils.cpp:711
std::string getStringImm(const MachineInstr &MI, unsigned StartIndex)
Definition: SPIRVUtils.cpp:79
bool isTypedPointerWrapper(const TargetExtType *ExtTy)
Definition: SPIRVUtils.h:292
unsigned getPointerAddressSpace(const Type *T)
Definition: SPIRVUtils.h:256
void addNumImm(const APInt &Imm, MachineInstrBuilder &MIB)
Definition: SPIRVUtils.cpp:83
FPDecorationId demangledPostfixToDecorationId(const std::string &S)
Definition: SPIRVUtils.h:405
bool sortBlocks(Function &F)
Definition: SPIRVUtils.cpp:679
Type * toTypedFunPointer(FunctionType *FTy)
Definition: SPIRVUtils.h:356
FPDecorationId
Definition: SPIRVUtils.h:403
@ RTP
Definition: SPIRVUtils.h:403
@ RTE
Definition: SPIRVUtils.h:403
@ RTN
Definition: SPIRVUtils.h:403
@ NONE
Definition: Attributor.h:6476
@ SAT
Definition: SPIRVUtils.h:403
@ RTZ
Definition: SPIRVUtils.h:403
uint64_t getIConstVal(Register ConstReg, const MachineRegisterInfo *MRI)
Definition: SPIRVUtils.cpp:326
SPIRV::MemorySemantics::MemorySemantics getMemSemanticsForStorageClass(SPIRV::StorageClass::StorageClass SC)
Definition: SPIRVUtils.cpp:245
constexpr unsigned storageClassToAddressSpace(SPIRV::StorageClass::StorageClass SC)
Definition: SPIRVUtils.h:161
bool isNestedPointer(const Type *Ty)
Definition: SPIRVUtils.cpp:774
std::string getOclOrSpirvBuiltinDemangledName(StringRef Name)
Definition: SPIRVUtils.cpp:392
bool isTypedPointerTy(const Type *T)
Definition: SPIRVUtils.h:240
bool isUntypedEquivalentToTyExt(Type *Ty1, Type *Ty2)
Definition: SPIRVUtils.h:330
void buildOpDecorate(Register Reg, MachineIRBuilder &MIRBuilder, SPIRV::Decoration::Decoration Dec, const std::vector< uint32_t > &DecArgs, StringRef StrImm)
Definition: SPIRVUtils.cpp:130
MachineBasicBlock::iterator getOpVariableMBBIt(MachineInstr &I)
Definition: SPIRVUtils.cpp:177
Register createVirtualRegister(SPIRVType *SpvType, SPIRVGlobalRegistry *GR, MachineRegisterInfo *MRI, const MachineFunction &MF)
Definition: SPIRVUtils.cpp:748
Type * getTypedPointerWrapper(Type *ElemTy, unsigned AS)
Definition: SPIRVUtils.h:287
Type * reconstructFunctionType(Function *F)
Definition: SPIRVUtils.h:279
Type * toTypedPointer(Type *Ty)
Definition: SPIRVUtils.h:347
bool isSpecialOpaqueType(const Type *Ty)
Definition: SPIRVUtils.cpp:436
void setRegClassType(Register Reg, SPIRVType *SpvType, SPIRVGlobalRegistry *GR, MachineRegisterInfo *MRI, const MachineFunction &MF, bool Force)
Definition: SPIRVUtils.cpp:727
bool isPointerTy(const Type *T)
Definition: SPIRVUtils.h:250
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:167
MachineBasicBlock::iterator getInsertPtValidEnd(MachineBasicBlock *MBB)
Definition: SPIRVUtils.cpp:197
const Type * unifyPtrType(const Type *Ty)
Definition: SPIRVUtils.h:374
bool isEntryPoint(const Function &F)
Definition: SPIRVUtils.cpp:445
SPIRV::StorageClass::StorageClass addressSpaceToStorageClass(unsigned AddrSpace, const SPIRVSubtarget &STI)
Definition: SPIRVUtils.cpp:211
AtomicOrdering
Atomic ordering for LLVM's memory model.
SPIRV::Scope::Scope getMemScope(LLVMContext &Ctx, SyncScope::ID Id)
Definition: SPIRVUtils.cpp:281
Type * parseBasicTypeName(StringRef &TypeName, LLVMContext &Ctx)
Definition: SPIRVUtils.cpp:459
Type * getPointeeTypeByAttr(Argument *Arg)
Definition: SPIRVUtils.h:269
bool hasPointeeTypeAttr(Argument *Arg)
Definition: SPIRVUtils.h:264
MachineInstr * getDefInstrMaybeConstant(Register &ConstReg, const MachineRegisterInfo *MRI)
Definition: SPIRVUtils.cpp:307
bool isEquivalentTypes(Type *Ty1, Type *Ty2)
Definition: SPIRVUtils.h:342
bool hasBuiltinTypePrefix(StringRef Name)
Definition: SPIRVUtils.cpp:429
Type * getMDOperandAsType(const MDNode *N, unsigned I)
Definition: SPIRVUtils.cpp:338
Type * applyWrappers(Type *Ty)
Definition: SPIRVUtils.h:305
bool isPointerTyOrWrapper(const Type *Ty)
Definition: SPIRVUtils.h:299
bool isSpvIntrinsic(const MachineInstr &MI, Intrinsic::ID IntrinsicID)
Definition: SPIRVUtils.cpp:332
Type * getPointeeType(const Type *Ty)
Definition: SPIRVUtils.h:319
void addStringImm(const StringRef &Str, MCInst &Inst)
Definition: SPIRVUtils.cpp:54
MachineInstr * getVRegDef(MachineRegisterInfo &MRI, Register Reg)
Definition: SPIRVUtils.cpp:704
void buildOpSpirvDecorations(Register Reg, MachineIRBuilder &MIRBuilder, const MDNode *GVarMD)
Definition: SPIRVUtils.cpp:149
bool isUntypedPointerTy(const Type *T)
Definition: SPIRVUtils.h:245
SPIRV::MemorySemantics::MemorySemantics getMemSemantics(AtomicOrdering Ord)
Definition: SPIRVUtils.cpp:263
#define N