Path: blob/main/contrib/llvm-project/llvm/lib/Target/NVPTX/NVPTXMachineFunctionInfo.h
35271 views
//===-- NVPTXMachineFunctionInfo.h - NVPTX-specific Function Info --------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This class is attached to a MachineFunction instance and tracks target-9// dependent information10//11//===----------------------------------------------------------------------===//1213#ifndef LLVM_LIB_TARGET_NVPTX_NVPTXMACHINEFUNCTIONINFO_H14#define LLVM_LIB_TARGET_NVPTX_NVPTXMACHINEFUNCTIONINFO_H1516#include "llvm/CodeGen/MachineFunction.h"1718namespace llvm {19class NVPTXMachineFunctionInfo : public MachineFunctionInfo {20private:21/// Stores a mapping from index to symbol name for removing image handles22/// on Fermi.23SmallVector<std::string, 8> ImageHandleList;2425public:26NVPTXMachineFunctionInfo(const Function &F, const TargetSubtargetInfo *STI) {}2728MachineFunctionInfo *29clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF,30const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB)31const override {32return DestMF.cloneInfo<NVPTXMachineFunctionInfo>(*this);33}3435/// Returns the index for the symbol \p Symbol. If the symbol was previously,36/// added, the same index is returned. Otherwise, the symbol is added and the37/// new index is returned.38unsigned getImageHandleSymbolIndex(const char *Symbol) {39// Is the symbol already present?40for (unsigned i = 0, e = ImageHandleList.size(); i != e; ++i)41if (ImageHandleList[i] == std::string(Symbol))42return i;43// Nope, insert it44ImageHandleList.push_back(Symbol);45return ImageHandleList.size()-1;46}4748/// Returns the symbol name at the given index.49const char *getImageHandleSymbol(unsigned Idx) const {50assert(ImageHandleList.size() > Idx && "Bad index");51return ImageHandleList[Idx].c_str();52}53};54}5556#endif575859