1//===-- NVPTXUtilities - 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 the declaration of the NVVM specific utility functions.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_NVPTX_NVPTXUTILITIES_H
14#define LLVM_LIB_TARGET_NVPTX_NVPTXUTILITIES_H
15
16#include "llvm/IR/Function.h"
17#include "llvm/IR/GlobalVariable.h"
18#include "llvm/IR/IntrinsicInst.h"
19#include "llvm/IR/Value.h"
20#include <cstdarg>
21#include <set>
22#include <string>
23#include <vector>
24
25namespace llvm {
26
27void clearAnnotationCache(const Module *);
28
29bool findOneNVVMAnnotation(const GlobalValue *, const std::string &,
30                           unsigned &);
31bool findAllNVVMAnnotation(const GlobalValue *, const std::string &,
32                           std::vector<unsigned> &);
33
34bool isTexture(const Value &);
35bool isSurface(const Value &);
36bool isSampler(const Value &);
37bool isImage(const Value &);
38bool isImageReadOnly(const Value &);
39bool isImageWriteOnly(const Value &);
40bool isImageReadWrite(const Value &);
41bool isManaged(const Value &);
42
43std::string getTextureName(const Value &);
44std::string getSurfaceName(const Value &);
45std::string getSamplerName(const Value &);
46
47bool getMaxNTIDx(const Function &, unsigned &);
48bool getMaxNTIDy(const Function &, unsigned &);
49bool getMaxNTIDz(const Function &, unsigned &);
50
51bool getReqNTIDx(const Function &, unsigned &);
52bool getReqNTIDy(const Function &, unsigned &);
53bool getReqNTIDz(const Function &, unsigned &);
54
55bool getMinCTASm(const Function &, unsigned &);
56bool getMaxNReg(const Function &, unsigned &);
57bool isKernelFunction(const Function &);
58
59bool getAlign(const Function &, unsigned index, unsigned &);
60bool getAlign(const CallInst &, unsigned index, unsigned &);
61
62}
63
64#endif
65