LLVM 23.0.0git
NVVMProperties.h
Go to the documentation of this file.
1//===-- NVVMProperties - NVVM annotation utilities -------------*- 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 declarations for NVVM attribute and metadata query
10// utilities.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_NVPTX_NVVMPROPERTIES_H
15#define LLVM_LIB_TARGET_NVPTX_NVVMPROPERTIES_H
16
18#include "llvm/IR/CallingConv.h"
19#include "llvm/IR/Function.h"
21#include <cstdint>
22#include <optional>
23
24namespace llvm {
25
26class Argument;
27class CallInst;
28class Module;
29class Value;
30
31void clearAnnotationCache(const Module *);
32
33inline bool isKernelFunction(const Function &F) {
34 return F.getCallingConv() == CallingConv::PTX_Kernel;
35}
36
37bool isTexture(const Value &);
38bool isSurface(const Value &);
39bool isSampler(const Value &);
40bool isImage(const Value &);
41bool isImageReadOnly(const Value &);
42bool isImageWriteOnly(const Value &);
43bool isImageReadWrite(const Value &);
44bool isManaged(const Value &);
45
46SmallVector<unsigned, 3> getMaxNTID(const Function &);
47SmallVector<unsigned, 3> getReqNTID(const Function &);
49
50std::optional<uint64_t> getOverallMaxNTID(const Function &);
51std::optional<uint64_t> getOverallReqNTID(const Function &);
52std::optional<uint64_t> getOverallClusterRank(const Function &);
53
54std::optional<unsigned> getMaxClusterRank(const Function &);
55std::optional<unsigned> getMinCTASm(const Function &);
56std::optional<unsigned> getMaxNReg(const Function &);
57
58bool hasBlocksAreClusters(const Function &);
59
60bool isParamGridConstant(const Argument &);
61
62inline MaybeAlign getAlign(const Function &F, unsigned Index) {
63 return F.getAttributes().getAttributes(Index).getStackAlignment();
64}
65MaybeAlign getAlign(const CallInst &, unsigned);
66
67} // namespace llvm
68
69#endif
#define F(x, y, z)
Definition MD5.cpp:54
This file defines the SmallVector class.
This class represents an incoming formal argument to a Function.
Definition Argument.h:32
This class represents a function call, abstracting a target machine's calling convention.
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
LLVM Value Representation.
Definition Value.h:75
@ PTX_Kernel
Call to a PTX kernel. Passes all arguments in parameter space.
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
bool isManaged(const Value &V)
std::optional< uint64_t > getOverallClusterRank(const Function &F)
MaybeAlign getAlign(const CallInst &I, unsigned Index)
std::optional< unsigned > getMaxNReg(const Function &F)
bool isImageReadWrite(const Value &V)
bool isImageReadOnly(const Value &V)
std::optional< unsigned > getMinCTASm(const Function &F)
SmallVector< unsigned, 3 > getReqNTID(const Function &F)
bool isImage(const Value &V)
bool isSampler(const Value &V)
void clearAnnotationCache(const Module *Mod)
bool isSurface(const Value &V)
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
std::optional< unsigned > getMaxClusterRank(const Function &F)
SmallVector< unsigned, 3 > getMaxNTID(const Function &F)
bool isParamGridConstant(const Argument &Arg)
std::optional< uint64_t > getOverallReqNTID(const Function &F)
bool isKernelFunction(const Function &F)
bool isTexture(const Value &V)
bool isImageWriteOnly(const Value &V)
std::optional< uint64_t > getOverallMaxNTID(const Function &F)
bool hasBlocksAreClusters(const Function &F)
SmallVector< unsigned, 3 > getClusterDim(const Function &F)
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition Alignment.h:106