| Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 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 |  | 
| Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 14 | #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXUTILITIES_H | 
|  | 15 | #define LLVM_LIB_TARGET_NVPTX_NVPTXUTILITIES_H | 
| Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 16 |  | 
| Chandler Carruth | 9fb823b | 2013-01-02 11:36:10 +0000 | [diff] [blame] | 17 | #include "llvm/IR/Function.h" | 
|  | 18 | #include "llvm/IR/GlobalVariable.h" | 
|  | 19 | #include "llvm/IR/IntrinsicInst.h" | 
|  | 20 | #include "llvm/IR/Value.h" | 
| Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 21 | #include <cstdarg> | 
|  | 22 | #include <set> | 
|  | 23 | #include <string> | 
|  | 24 | #include <vector> | 
|  | 25 |  | 
| Justin Holewinski | 0497ab1 | 2013-03-30 14:29:21 +0000 | [diff] [blame] | 26 | namespace llvm { | 
| Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 27 |  | 
|  | 28 | #define NVCL_IMAGE2D_READONLY_FUNCNAME "__is_image2D_readonly" | 
|  | 29 | #define NVCL_IMAGE3D_READONLY_FUNCNAME "__is_image3D_readonly" | 
|  | 30 |  | 
| Justin Holewinski | 5959695 | 2014-04-09 15:38:52 +0000 | [diff] [blame] | 31 | void clearAnnotationCache(const llvm::Module *); | 
|  | 32 |  | 
| Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 33 | bool findOneNVVMAnnotation(const llvm::GlobalValue *, std::string, unsigned &); | 
|  | 34 | bool findAllNVVMAnnotation(const llvm::GlobalValue *, std::string, | 
|  | 35 | std::vector<unsigned> &); | 
|  | 36 |  | 
|  | 37 | bool isTexture(const llvm::Value &); | 
|  | 38 | bool isSurface(const llvm::Value &); | 
|  | 39 | bool isSampler(const llvm::Value &); | 
|  | 40 | bool isImage(const llvm::Value &); | 
|  | 41 | bool isImageReadOnly(const llvm::Value &); | 
|  | 42 | bool isImageWriteOnly(const llvm::Value &); | 
| Justin Holewinski | 5959695 | 2014-04-09 15:38:52 +0000 | [diff] [blame] | 43 | bool isImageReadWrite(const llvm::Value &); | 
|  | 44 | bool isManaged(const llvm::Value &); | 
| Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 45 |  | 
|  | 46 | std::string getTextureName(const llvm::Value &); | 
|  | 47 | std::string getSurfaceName(const llvm::Value &); | 
|  | 48 | std::string getSamplerName(const llvm::Value &); | 
|  | 49 |  | 
|  | 50 | bool getMaxNTIDx(const llvm::Function &, unsigned &); | 
|  | 51 | bool getMaxNTIDy(const llvm::Function &, unsigned &); | 
|  | 52 | bool getMaxNTIDz(const llvm::Function &, unsigned &); | 
|  | 53 |  | 
|  | 54 | bool getReqNTIDx(const llvm::Function &, unsigned &); | 
|  | 55 | bool getReqNTIDy(const llvm::Function &, unsigned &); | 
|  | 56 | bool getReqNTIDz(const llvm::Function &, unsigned &); | 
|  | 57 |  | 
|  | 58 | bool getMinCTASm(const llvm::Function &, unsigned &); | 
|  | 59 | bool isKernelFunction(const llvm::Function &); | 
|  | 60 |  | 
|  | 61 | bool getAlign(const llvm::Function &, unsigned index, unsigned &); | 
|  | 62 | bool getAlign(const llvm::CallInst &, unsigned index, unsigned &); | 
|  | 63 |  | 
| Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 64 | BasicBlock *getParentBlock(Value *v); | 
|  | 65 | Function *getParentFunction(Value *v); | 
|  | 66 | void dumpBlock(Value *v, char *blockName); | 
|  | 67 | Instruction *getInst(Value *base, char *instName); | 
|  | 68 | void dumpInst(Value *base, char *instName); | 
|  | 69 | void dumpInstRec(Value *v, std::set<Instruction *> *visited); | 
|  | 70 | void dumpInstRec(Value *v); | 
|  | 71 | void dumpParent(Value *v); | 
|  | 72 |  | 
| Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 73 | } | 
| Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 74 |  | 
|  | 75 | #endif |