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