LLVM  14.0.0git
NVPTX.h
Go to the documentation of this file.
1 //===-- NVPTX.h - Top-level interface for NVPTX representation --*- 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 entry points for global functions defined in
10 // the LLVM NVPTX back-end.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTX_H
15 #define LLVM_LIB_TARGET_NVPTX_NVPTX_H
16 
17 #include "llvm/IR/PassManager.h"
18 #include "llvm/Pass.h"
19 #include "llvm/Support/CodeGen.h"
20 
21 namespace llvm {
22 class NVPTXTargetMachine;
23 class FunctionPass;
24 class MachineFunctionPass;
25 
26 namespace NVPTXCC {
27 enum CondCodes {
28  EQ,
29  NE,
30  LT,
31  LE,
32  GT,
34 };
35 }
36 
37 FunctionPass *createNVPTXISelDag(NVPTXTargetMachine &TM,
38  llvm::CodeGenOpt::Level OptLevel);
40 ModulePass *createGenericToNVVMPass();
41 FunctionPass *createNVVMIntrRangePass(unsigned int SmVersion);
42 FunctionPass *createNVVMReflectPass(unsigned int SmVersion);
43 MachineFunctionPass *createNVPTXPrologEpilogPass();
44 MachineFunctionPass *createNVPTXReplaceImageHandlesPass();
45 FunctionPass *createNVPTXImageOptimizerPass();
46 FunctionPass *createNVPTXLowerArgsPass(const NVPTXTargetMachine *TM);
47 FunctionPass *createNVPTXLowerAllocaPass();
48 MachineFunctionPass *createNVPTXPeephole();
49 MachineFunctionPass *createNVPTXProxyRegErasurePass();
50 
51 struct NVVMIntrRangePass : PassInfoMixin<NVVMIntrRangePass> {
53  NVVMIntrRangePass(unsigned SmVersion) : SmVersion(SmVersion) {}
55 
56 private:
57  unsigned SmVersion;
58 };
59 
60 struct NVVMReflectPass : PassInfoMixin<NVVMReflectPass> {
62  NVVMReflectPass(unsigned SmVersion) : SmVersion(SmVersion) {}
64 
65 private:
66  unsigned SmVersion;
67 };
68 
69 namespace NVPTX {
73 };
74 
75 // A field inside TSFlags needs a shift and a mask. The usage is
76 // always as follows :
77 // ((TSFlags & fieldMask) >> fieldShift)
78 // The enum keeps the mask, the shift, and all valid values of the
79 // field in one place.
83 
84  VecNOP = 0,
85  VecLoad = 1,
86  VecStore = 2,
87  VecBuild = 3,
90  VecInsert = 6,
91  VecDest = 7,
92  VecOther = 15
93 };
94 
95 enum SimpleMove {
98 };
99 enum LoadStore {
100  isLoadMask = 0x20,
102  isStoreMask = 0x40,
104 };
105 
106 namespace PTXLdStInstCode {
108  GENERIC = 0,
109  GLOBAL = 1,
110  CONSTANT = 2,
111  SHARED = 3,
112  PARAM = 4,
113  LOCAL = 5
114 };
115 enum FromType {
116  Unsigned = 0,
120 };
121 enum VecType {
122  Scalar = 1,
123  V2 = 2,
124  V4 = 4
125 };
126 }
127 
128 /// PTXCvtMode - Conversion code enumeration
129 namespace PTXCvtMode {
130 enum CvtMode {
131  NONE = 0,
136  RN,
137  RZ,
138  RM,
139  RP,
140 
141  BASE_MASK = 0x0F,
142  FTZ_FLAG = 0x10,
143  SAT_FLAG = 0x20
144 };
145 }
146 
147 /// PTXCmpMode - Comparison mode enumeration
148 namespace PTXCmpMode {
149 enum CmpMode {
150  EQ = 0,
151  NE,
152  LT,
153  LE,
154  GT,
155  GE,
156  LO,
157  LS,
158  HI,
159  HS,
167  // NAN is a MACRO
169 
170  BASE_MASK = 0xFF,
171  FTZ_FLAG = 0x100
172 };
173 }
174 }
175 } // end namespace llvm;
176 
177 // Defines symbolic names for NVPTX registers. This defines a mapping from
178 // register name to register number.
179 #define GET_REGINFO_ENUM
180 #include "NVPTXGenRegisterInfo.inc"
181 
182 // Defines symbolic names for the NVPTX instructions.
183 #define GET_INSTRINFO_ENUM
184 #include "NVPTXGenInstrInfo.inc"
185 
186 #endif
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:155
llvm::NVPTX::PTXCmpMode::EQ
@ EQ
Definition: NVPTX.h:150
llvm::NVPTX::PTXCmpMode::LE
@ LE
Definition: NVPTX.h:153
llvm::NVPTX::SimpleMoveMask
@ SimpleMoveMask
Definition: NVPTX.h:96
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::NVPTX::PTXLdStInstCode::SHARED
@ SHARED
Definition: NVPTX.h:111
llvm::NVPTX::SimpleMove
SimpleMove
Definition: NVPTX.h:95
llvm::NVPTX::PTXCmpMode::EQU
@ EQU
Definition: NVPTX.h:160
llvm::PassInfoMixin
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:374
llvm::NVPTXCC::LT
@ LT
Definition: NVPTX.h:30
llvm::Function
Definition: Function.h:61
llvm::NVPTX::PTXCmpMode::NotANumber
@ NotANumber
Definition: NVPTX.h:168
llvm::NVPTX::isLoadMask
@ isLoadMask
Definition: NVPTX.h:100
llvm::NVPTX::LoadStore
LoadStore
Definition: NVPTX.h:99
Pass.h
llvm::NVPTX::PTXCmpMode::LS
@ LS
Definition: NVPTX.h:157
llvm::NVPTX::PTXCmpMode::NUM
@ NUM
Definition: NVPTX.h:166
llvm::NVPTX::PTXLdStInstCode::LOCAL
@ LOCAL
Definition: NVPTX.h:113
llvm::NVPTX::PTXCvtMode::RPI
@ RPI
Definition: NVPTX.h:135
llvm::NVPTX::PTXCvtMode::RZI
@ RZI
Definition: NVPTX.h:133
llvm::createNVPTXReplaceImageHandlesPass
MachineFunctionPass * createNVPTXReplaceImageHandlesPass()
Definition: NVPTXReplaceImageHandles.cpp:189
llvm::NVPTX::PTXCmpMode::GEU
@ GEU
Definition: NVPTX.h:165
llvm::NVPTX::PTXCvtMode::RMI
@ RMI
Definition: NVPTX.h:134
llvm::NVPTX::PTXCvtMode::RN
@ RN
Definition: NVPTX.h:136
llvm::createNVPTXLowerArgsPass
FunctionPass * createNVPTXLowerArgsPass(const NVPTXTargetMachine *TM)
Definition: NVPTXLowerArgs.cpp:379
llvm::NVVMIntrRangePass::run
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Definition: NVVMIntrRange.cpp:165
llvm::createNVPTXAssignValidGlobalNamesPass
ModulePass * createNVPTXAssignValidGlobalNamesPass()
Definition: NVPTXAssignValidGlobalNames.cpp:87
llvm::NVPTX::isStoreShift
@ isStoreShift
Definition: NVPTX.h:103
llvm::NVPTX::PTXLdStInstCode::VecType
VecType
Definition: NVPTX.h:121
llvm::NVPTX::PTXCmpMode::LO
@ LO
Definition: NVPTX.h:156
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::NVPTXCC::NE
@ NE
Definition: NVPTX.h:29
llvm::NVPTXCC::EQ
@ EQ
Definition: NVPTX.h:28
llvm::NVPTX::PTXCmpMode::HS
@ HS
Definition: NVPTX.h:159
llvm::NVPTX::VecExtract
@ VecExtract
Definition: NVPTX.h:89
llvm::NVVMIntrRangePass::NVVMIntrRangePass
NVVMIntrRangePass()
Definition: NVVMIntrRange.cpp:163
llvm::NVPTXCC::LE
@ LE
Definition: NVPTX.h:31
llvm::NVPTXCC::CondCodes
CondCodes
Definition: NVPTX.h:27
llvm::NVPTX::SimpleMoveShift
@ SimpleMoveShift
Definition: NVPTX.h:97
llvm::NVVMIntrRangePass
Definition: NVPTX.h:51
llvm::NVPTX::DrvInterface
DrvInterface
Definition: NVPTX.h:70
llvm::createNVPTXPrologEpilogPass
MachineFunctionPass * createNVPTXPrologEpilogPass()
Definition: NVPTXPrologEpilogPass.cpp:44
llvm::NVPTX::VecInstTypeShift
@ VecInstTypeShift
Definition: NVPTX.h:81
llvm::NVPTX::PTXCvtMode::BASE_MASK
@ BASE_MASK
Definition: NVPTX.h:141
llvm::NVPTX::PTXCmpMode::LT
@ LT
Definition: NVPTX.h:152
llvm::NVPTX::PTXLdStInstCode::Scalar
@ Scalar
Definition: NVPTX.h:122
llvm::NVPTX::PTXCvtMode::RP
@ RP
Definition: NVPTX.h:139
llvm::createNVVMIntrRangePass
FunctionPass * createNVVMIntrRangePass(unsigned int SmVersion)
Definition: NVVMIntrRange.cpp:51
llvm::NVPTX::NVCL
@ NVCL
Definition: NVPTX.h:71
llvm::NVPTX::PTXCmpMode::HI
@ HI
Definition: NVPTX.h:158
llvm::NVVMIntrRangePass::NVVMIntrRangePass
NVVMIntrRangePass(unsigned SmVersion)
Definition: NVPTX.h:53
llvm::NVPTX::isLoadShift
@ isLoadShift
Definition: NVPTX.h:101
llvm::NVPTXCC::GE
@ GE
Definition: NVPTX.h:33
llvm::NVPTX::PTXLdStInstCode::AddressSpace
AddressSpace
Definition: NVPTX.h:107
llvm::NVPTX::PTXLdStInstCode::V4
@ V4
Definition: NVPTX.h:124
llvm::NVPTX::VecInsert
@ VecInsert
Definition: NVPTX.h:90
llvm::createNVVMReflectPass
FunctionPass * createNVVMReflectPass(unsigned int SmVersion)
Definition: NVVMReflect.cpp:64
llvm::NVPTX::PTXLdStInstCode::Float
@ Float
Definition: NVPTX.h:118
llvm::NVPTX::VecOther
@ VecOther
Definition: NVPTX.h:92
llvm::NVVMReflectPass::NVVMReflectPass
NVVMReflectPass(unsigned SmVersion)
Definition: NVPTX.h:62
llvm::NVPTXCC::GT
@ GT
Definition: NVPTX.h:32
llvm::NVPTX::PTXCvtMode::RNI
@ RNI
Definition: NVPTX.h:132
llvm::NVPTX::PTXCmpMode::GT
@ GT
Definition: NVPTX.h:154
llvm::NVPTX::PTXLdStInstCode::FromType
FromType
Definition: NVPTX.h:115
llvm::createNVPTXISelDag
FunctionPass * createNVPTXISelDag(NVPTXTargetMachine &TM, llvm::CodeGenOpt::Level OptLevel)
createNVPTXISelDag - This pass converts a legalized DAG into a NVPTX-specific DAG,...
Definition: NVPTXISelDAGToDAG.cpp:33
llvm::NVPTX::PTXLdStInstCode::CONSTANT
@ CONSTANT
Definition: NVPTX.h:110
llvm::NVPTX::PTXCmpMode::GTU
@ GTU
Definition: NVPTX.h:164
llvm::NVPTX::VecDest
@ VecDest
Definition: NVPTX.h:91
llvm::NVPTX::PTXCmpMode::LEU
@ LEU
Definition: NVPTX.h:163
llvm::NVPTX::PTXLdStInstCode::Signed
@ Signed
Definition: NVPTX.h:117
llvm::NVPTX::VecInstTypeMask
@ VecInstTypeMask
Definition: NVPTX.h:82
llvm::NVPTX::VecNOP
@ VecNOP
Definition: NVPTX.h:84
llvm::NVPTX::PTXLdStInstCode::Untyped
@ Untyped
Definition: NVPTX.h:119
llvm::CodeGenOpt::Level
Level
Definition: CodeGen.h:52
SmVersion
unsigned SmVersion
Definition: NVVMReflect.cpp:77
llvm::NVPTX::PTXCvtMode::RZ
@ RZ
Definition: NVPTX.h:137
llvm::NVPTX::VecInstType
VecInstType
Definition: NVPTX.h:80
llvm::NVPTX::PTXCvtMode::CvtMode
CvtMode
Definition: NVPTX.h:130
llvm::NVPTX::PTXCmpMode::FTZ_FLAG
@ FTZ_FLAG
Definition: NVPTX.h:171
llvm::NVPTX::PTXLdStInstCode::V2
@ V2
Definition: NVPTX.h:123
llvm::NVPTX::PTXCvtMode::SAT_FLAG
@ SAT_FLAG
Definition: NVPTX.h:143
llvm::NVPTX::VecStore
@ VecStore
Definition: NVPTX.h:86
llvm::NVPTX::CUDA
@ CUDA
Definition: NVPTX.h:72
llvm::NVPTX::PTXLdStInstCode::PARAM
@ PARAM
Definition: NVPTX.h:112
llvm::NVVMReflectPass
Definition: NVPTX.h:60
llvm::NVPTX::VecLoad
@ VecLoad
Definition: NVPTX.h:85
llvm::NVPTX::PTXCmpMode::BASE_MASK
@ BASE_MASK
Definition: NVPTX.h:170
PassManager.h
llvm::NVPTX::PTXCmpMode::NEU
@ NEU
Definition: NVPTX.h:161
llvm::NVVMReflectPass::NVVMReflectPass
NVVMReflectPass()
Definition: NVVMReflect.cpp:188
llvm::createNVPTXImageOptimizerPass
FunctionPass * createNVPTXImageOptimizerPass()
Definition: NVPTXImageOptimizer.cpp:177
llvm::NVPTX::isStoreMask
@ isStoreMask
Definition: NVPTX.h:102
llvm::NVPTX::PTXLdStInstCode::GLOBAL
@ GLOBAL
Definition: NVPTX.h:109
llvm::NVPTX::PTXLdStInstCode::GENERIC
@ GENERIC
Definition: NVPTX.h:108
CodeGen.h
llvm::NVPTX::PTXCmpMode::GE
@ GE
Definition: NVPTX.h:155
llvm::createGenericToNVVMPass
ModulePass * createGenericToNVVMPass()
Definition: NVPTXGenericToNVVM.cpp:64
llvm::NVPTX::PTXCvtMode::NONE
@ NONE
Definition: NVPTX.h:131
llvm::NVPTX::PTXCmpMode::NE
@ NE
Definition: NVPTX.h:151
llvm::NVPTX::PTXCvtMode::RM
@ RM
Definition: NVPTX.h:138
llvm::createNVPTXProxyRegErasurePass
MachineFunctionPass * createNVPTXProxyRegErasurePass()
Definition: NVPTXProxyRegErasure.cpp:119
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::createNVPTXPeephole
MachineFunctionPass * createNVPTXPeephole()
Definition: NVPTXPeephole.cpp:156
llvm::NVPTX::PTXCmpMode::CmpMode
CmpMode
Definition: NVPTX.h:149
llvm::NVPTX::PTXLdStInstCode::Unsigned
@ Unsigned
Definition: NVPTX.h:116
llvm::NVPTX::VecShuffle
@ VecShuffle
Definition: NVPTX.h:88
llvm::NVVMReflectPass::run
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Definition: NVVMReflect.cpp:190
llvm::createNVPTXLowerAllocaPass
FunctionPass * createNVPTXLowerAllocaPass()
Definition: NVPTXLowerAlloca.cpp:118
llvm::NVPTX::PTXCvtMode::FTZ_FLAG
@ FTZ_FLAG
Definition: NVPTX.h:142
llvm::NVPTX::VecBuild
@ VecBuild
Definition: NVPTX.h:87
llvm::NVPTX::PTXCmpMode::LTU
@ LTU
Definition: NVPTX.h:162