LLVM 19.0.0git
NVPTXMachineFunctionInfo.h
Go to the documentation of this file.
1//===-- NVPTXMachineFunctionInfo.h - NVPTX-specific Function Info --------===//
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 class is attached to a MachineFunction instance and tracks target-
10// dependent information
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_NVPTX_NVPTXMACHINEFUNCTIONINFO_H
15#define LLVM_LIB_TARGET_NVPTX_NVPTXMACHINEFUNCTIONINFO_H
16
18
19namespace llvm {
21private:
22 /// Stores a mapping from index to symbol name for removing image handles
23 /// on Fermi.
24 SmallVector<std::string, 8> ImageHandleList;
25
26public:
28
32 const override {
33 return DestMF.cloneInfo<NVPTXMachineFunctionInfo>(*this);
34 }
35
36 /// Returns the index for the symbol \p Symbol. If the symbol was previously,
37 /// added, the same index is returned. Otherwise, the symbol is added and the
38 /// new index is returned.
39 unsigned getImageHandleSymbolIndex(const char *Symbol) {
40 // Is the symbol already present?
41 for (unsigned i = 0, e = ImageHandleList.size(); i != e; ++i)
42 if (ImageHandleList[i] == std::string(Symbol))
43 return i;
44 // Nope, insert it
45 ImageHandleList.push_back(Symbol);
46 return ImageHandleList.size()-1;
47 }
48
49 /// Returns the symbol name at the given index.
50 const char *getImageHandleSymbol(unsigned Idx) const {
51 assert(ImageHandleList.size() > Idx && "Bad index");
52 return ImageHandleList[Idx].c_str();
53 }
54};
55}
56
57#endif
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
#define F(x, y, z)
Definition: MD5.cpp:55
Basic Register Allocator
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:66
Ty * cloneInfo(const Ty &Old)
NVPTXMachineFunctionInfo(const Function &F, const TargetSubtargetInfo *STI)
unsigned getImageHandleSymbolIndex(const char *Symbol)
Returns the index for the symbol Symbol.
const char * getImageHandleSymbol(unsigned Idx) const
Returns the symbol name at the given index.
MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const override
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
size_t size() const
Definition: SmallVector.h:91
void push_back(const T &Elt)
Definition: SmallVector.h:426
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
TargetSubtargetInfo - Generic base class for all target subtargets.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...