LLVM API Documentation
00001 //===-- NVPTX.h - Top-level interface for NVPTX representation --*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file contains the entry points for global functions defined in 00011 // the LLVM NVPTX back-end. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_TARGET_NVPTX_H 00016 #define LLVM_TARGET_NVPTX_H 00017 00018 #include "MCTargetDesc/NVPTXBaseInfo.h" 00019 #include "llvm/ADT/StringMap.h" 00020 #include "llvm/IR/Module.h" 00021 #include "llvm/IR/Value.h" 00022 #include "llvm/Support/ErrorHandling.h" 00023 #include "llvm/Target/TargetMachine.h" 00024 #include <cassert> 00025 #include <iosfwd> 00026 00027 namespace llvm { 00028 class NVPTXTargetMachine; 00029 class FunctionPass; 00030 class formatted_raw_ostream; 00031 00032 namespace NVPTXCC { 00033 enum CondCodes { 00034 EQ, 00035 NE, 00036 LT, 00037 LE, 00038 GT, 00039 GE 00040 }; 00041 } 00042 00043 inline static const char *NVPTXCondCodeToString(NVPTXCC::CondCodes CC) { 00044 switch (CC) { 00045 case NVPTXCC::NE: 00046 return "ne"; 00047 case NVPTXCC::EQ: 00048 return "eq"; 00049 case NVPTXCC::LT: 00050 return "lt"; 00051 case NVPTXCC::LE: 00052 return "le"; 00053 case NVPTXCC::GT: 00054 return "gt"; 00055 case NVPTXCC::GE: 00056 return "ge"; 00057 } 00058 llvm_unreachable("Unknown condition code"); 00059 } 00060 00061 FunctionPass * 00062 createNVPTXISelDag(NVPTXTargetMachine &TM, llvm::CodeGenOpt::Level OptLevel); 00063 FunctionPass *createLowerStructArgsPass(NVPTXTargetMachine &); 00064 FunctionPass *createNVPTXReMatPass(NVPTXTargetMachine &); 00065 FunctionPass *createNVPTXReMatBlockPass(NVPTXTargetMachine &); 00066 ModulePass *createGenericToNVVMPass(); 00067 ModulePass *createNVVMReflectPass(); 00068 ModulePass *createNVVMReflectPass(const StringMap<int>& Mapping); 00069 00070 bool isImageOrSamplerVal(const Value *, const Module *); 00071 00072 extern Target TheNVPTXTarget32; 00073 extern Target TheNVPTXTarget64; 00074 00075 namespace NVPTX { 00076 enum DrvInterface { 00077 NVCL, 00078 CUDA, 00079 TEST 00080 }; 00081 00082 // A field inside TSFlags needs a shift and a mask. The usage is 00083 // always as follows : 00084 // ((TSFlags & fieldMask) >> fieldShift) 00085 // The enum keeps the mask, the shift, and all valid values of the 00086 // field in one place. 00087 enum VecInstType { 00088 VecInstTypeShift = 0, 00089 VecInstTypeMask = 0xF, 00090 00091 VecNOP = 0, 00092 VecLoad = 1, 00093 VecStore = 2, 00094 VecBuild = 3, 00095 VecShuffle = 4, 00096 VecExtract = 5, 00097 VecInsert = 6, 00098 VecDest = 7, 00099 VecOther = 15 00100 }; 00101 00102 enum SimpleMove { 00103 SimpleMoveMask = 0x10, 00104 SimpleMoveShift = 4 00105 }; 00106 enum LoadStore { 00107 isLoadMask = 0x20, 00108 isLoadShift = 5, 00109 isStoreMask = 0x40, 00110 isStoreShift = 6 00111 }; 00112 00113 namespace PTXLdStInstCode { 00114 enum AddressSpace { 00115 GENERIC = 0, 00116 GLOBAL = 1, 00117 CONSTANT = 2, 00118 SHARED = 3, 00119 PARAM = 4, 00120 LOCAL = 5 00121 }; 00122 enum FromType { 00123 Unsigned = 0, 00124 Signed, 00125 Float 00126 }; 00127 enum VecType { 00128 Scalar = 1, 00129 V2 = 2, 00130 V4 = 4 00131 }; 00132 } 00133 } 00134 } // end namespace llvm; 00135 00136 // Defines symbolic names for NVPTX registers. This defines a mapping from 00137 // register name to register number. 00138 #define GET_REGINFO_ENUM 00139 #include "NVPTXGenRegisterInfo.inc" 00140 00141 // Defines symbolic names for the NVPTX instructions. 00142 #define GET_INSTRINFO_ENUM 00143 #include "NVPTXGenInstrInfo.inc" 00144 00145 #endif