Movatterモバイル変換


[0]ホーム

URL:


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

Generated on Thu Jul 17 2025 15:38:08 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp