LLVM 24.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
19#include "llvm/MC/MCContext.h"
20
21namespace llvm {
22class CallBase;
23class MCSymbol;
24
26private:
27 /// The parameter symbols whose image handles were replaced with image
28 /// references.
29 SmallPtrSet<const MCSymbol *, 8> ImageHandleSymbols;
30
31 using CallProtoTy = std::pair<const CallBase *, MCSymbol *>;
32 /// Stores the call instructions that need an indirect-call prototype emitted.
33 std::vector<CallProtoTy> CallPrototypes;
34
35public:
37
41 const override {
42 return DestMF.cloneInfo<NVPTXMachineFunctionInfo>(*this);
43 }
44
45 /// Record that \p Symbol's handle was replaced with an image reference.
46 void addImageHandleSymbol(const MCSymbol *Symbol) {
47 ImageHandleSymbols.insert(Symbol);
48 }
49
50 /// Check whether \p Symbol's handle was replaced with an image reference.
51 bool checkImageHandleSymbol(const MCSymbol *Symbol) const {
52 return ImageHandleSymbols.contains(Symbol);
53 }
54
56 MCSymbol *Symbol = MF.getContext().createTempSymbol("prototype_");
57 CallPrototypes.push_back({CB, Symbol});
58 return Symbol;
59 }
60
61 ArrayRef<CallProtoTy> getCallPrototypes() const { return CallPrototypes; }
62};
63}
64
65#endif
#define F(x, y, z)
Definition MD5.cpp:54
Basic Register Allocator
This file defines the SmallPtrSet class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
LLVM_ABI MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
MCContext & getContext() const
Ty * cloneInfo(const Ty &Old)
void addImageHandleSymbol(const MCSymbol *Symbol)
Record that Symbol's handle was replaced with an image reference.
MCSymbol * addCallPrototype(const CallBase *CB, MachineFunction &MF)
ArrayRef< CallProtoTy > getCallPrototypes() const
NVPTXMachineFunctionInfo(const Function &F, const TargetSubtargetInfo *STI)
bool checkImageHandleSymbol(const MCSymbol *Symbol) const
Check whether Symbol's handle was replaced with an image reference.
MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const override
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
TargetSubtargetInfo - Generic base class for all target subtargets.
This is an optimization pass for GlobalISel generic memory operations.
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:390
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...