LLVM  9.0.0svn
NVPTXMachineFunctionInfo.h
Go to the documentation of this file.
1 //===-- NVPTXMachineFunctionInfo.h - NVPTX-specific Function Info --------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This class is attached to a MachineFunction instance and tracks target-
11 // dependent information
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXMACHINEFUNCTIONINFO_H
16 #define LLVM_LIB_TARGET_NVPTX_NVPTXMACHINEFUNCTIONINFO_H
17 
19 
20 namespace llvm {
22 private:
23  /// Stores a mapping from index to symbol name for removing image handles
24  /// on Fermi.
25  SmallVector<std::string, 8> ImageHandleList;
26 
27 public:
29 
30  /// Returns the index for the symbol \p Symbol. If the symbol was previously,
31  /// added, the same index is returned. Otherwise, the symbol is added and the
32  /// new index is returned.
33  unsigned getImageHandleSymbolIndex(const char *Symbol) {
34  // Is the symbol already present?
35  for (unsigned i = 0, e = ImageHandleList.size(); i != e; ++i)
36  if (ImageHandleList[i] == std::string(Symbol))
37  return i;
38  // Nope, insert it
39  ImageHandleList.push_back(Symbol);
40  return ImageHandleList.size()-1;
41  }
42 
43  /// Returns the symbol name at the given index.
44  const char *getImageHandleSymbol(unsigned Idx) const {
45  assert(ImageHandleList.size() > Idx && "Bad index");
46  return ImageHandleList[Idx].c_str();
47  }
48 };
49 }
50 
51 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:24
void push_back(const T &Elt)
Definition: SmallVector.h:218
unsigned getImageHandleSymbolIndex(const char *Symbol)
Returns the index for the symbol Symbol.
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
NVPTXMachineFunctionInfo(MachineFunction &MF)
const char * getImageHandleSymbol(unsigned Idx) const
Returns the symbol name at the given index.
size_t size() const
Definition: SmallVector.h:53
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())