LLVM 20.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"
21
22namespace llvm {
23class FunctionPass;
24class MachineFunctionPass;
25class NVPTXTargetMachine;
26class PassRegistry;
27
28namespace NVPTXCC {
35 GE
36};
37}
38
39FunctionPass *createNVPTXISelDag(NVPTXTargetMachine &TM,
40 llvm::CodeGenOptLevel OptLevel);
52 bool NoTrapAfterNoreturn);
55
56struct NVVMIntrRangePass : PassInfoMixin<NVVMIntrRangePass> {
58};
59
60struct NVVMReflectPass : PassInfoMixin<NVVMReflectPass> {
62 NVVMReflectPass(unsigned SmVersion) : SmVersion(SmVersion) {}
64
65private:
66 unsigned SmVersion;
67};
68
69struct GenericToNVVMPass : PassInfoMixin<GenericToNVVMPass> {
71};
72
73struct NVPTXCopyByValArgsPass : PassInfoMixin<NVPTXCopyByValArgsPass> {
75};
76
77namespace NVPTX {
80 CUDA
81};
82
83// A field inside TSFlags needs a shift and a mask. The usage is
84// always as follows :
85// ((TSFlags & fieldMask) >> fieldShift)
86// The enum keeps the mask, the shift, and all valid values of the
87// field in one place.
91
92 VecNOP = 0,
100 VecOther = 15
102
111 isStoreShift = 6
113
114// Extends LLVM AtomicOrdering with PTX Orderings:
115using OrderingUnderlyingType = unsigned int;
118 AtomicOrdering::NotAtomic, // PTX calls these: "Weak"
119 // Unordered = 1, // NVPTX maps LLVM Unorderd to Relaxed
121 // Consume = 3, // Unimplemented in LLVM; NVPTX would map to "Acquire"
131
132using ScopeUnderlyingType = unsigned int;
135 Block = 1,
141
142using AddressSpaceUnderlyingType = unsigned int;
147 Const = 4,
148 Local = 5,
149
150 // NVPTX Backend Private:
151 Param = 101
153
154namespace PTXLdStInstCode {
159 Untyped
163 V2 = 2,
164 V4 = 4
166} // namespace PTXLdStInstCode
167
168/// PTXCvtMode - Conversion code enumeration
169namespace PTXCvtMode {
171 NONE = 0,
181
182 BASE_MASK = 0x0F,
183 FTZ_FLAG = 0x10,
184 SAT_FLAG = 0x20,
185 RELU_FLAG = 0x40
187}
188
189/// PTXCmpMode - Comparison mode enumeration
190namespace PTXCmpMode {
192 EQ = 0,
209 // NAN is a MACRO
211
212 BASE_MASK = 0xFF,
213 FTZ_FLAG = 0x100
215}
216
217namespace PTXPrmtMode {
226};
227}
228}
230} // namespace llvm
231
232// Defines symbolic names for NVPTX registers. This defines a mapping from
233// register name to register number.
234#define GET_REGINFO_ENUM
235#include "NVPTXGenRegisterInfo.inc"
236
237// Defines symbolic names for the NVPTX instructions.
238#define GET_INSTRINFO_ENUM
239#define GET_INSTRINFO_MC_HELPER_DECLS
240#include "NVPTXGenInstrInfo.inc"
241
242#endif
Atomic ordering constants.
This header defines various interfaces for pass management in LLVM.
#define F(x, y, z)
Definition: MD5.cpp:55
unsigned SmVersion
Definition: NVVMReflect.cpp:78
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:253
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:310
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:251
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
Definition: PassRegistry.h:37
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:111
AddressSpace
Definition: NVPTX.h:143
@ Global
Definition: NVPTX.h:145
@ Shared
Definition: NVPTX.h:146
@ Generic
Definition: NVPTX.h:144
VecInstType
Definition: NVPTX.h:88
@ VecOther
Definition: NVPTX.h:100
@ VecInstTypeShift
Definition: NVPTX.h:89
@ VecExtract
Definition: NVPTX.h:97
@ VecInsert
Definition: NVPTX.h:98
@ VecShuffle
Definition: NVPTX.h:96
@ VecBuild
Definition: NVPTX.h:95
@ VecInstTypeMask
Definition: NVPTX.h:90
@ VecLoad
Definition: NVPTX.h:93
@ VecDest
Definition: NVPTX.h:99
@ VecStore
Definition: NVPTX.h:94
@ VecNOP
Definition: NVPTX.h:92
unsigned int AddressSpaceUnderlyingType
Definition: NVPTX.h:142
unsigned int OrderingUnderlyingType
Definition: NVPTX.h:115
unsigned int ScopeUnderlyingType
Definition: NVPTX.h:132
DrvInterface
Definition: NVPTX.h:78
@ NVCL
Definition: NVPTX.h:79
@ CUDA
Definition: NVPTX.h:80
@ System
Definition: NVPTX.h:138
@ Cluster
Definition: NVPTX.h:136
@ Thread
Definition: NVPTX.h:134
@ Device
Definition: NVPTX.h:137
@ LASTSCOPE
Definition: NVPTX.h:139
@ RelaxedMMIO
Definition: NVPTX.h:128
@ Acquire
Definition: NVPTX.h:122
@ Relaxed
Definition: NVPTX.h:120
@ AcquireRelease
Definition: NVPTX.h:124
@ LASTORDERING
Definition: NVPTX.h:129
@ NotAtomic
Definition: NVPTX.h:117
@ Volatile
Definition: NVPTX.h:127
@ Release
Definition: NVPTX.h:123
@ SequentiallyConsistent
Definition: NVPTX.h:125
@ isStoreShift
Definition: NVPTX.h:111
@ isLoadShift
Definition: NVPTX.h:109
@ isLoadMask
Definition: NVPTX.h:108
@ isStoreMask
Definition: NVPTX.h:110
@ SimpleMoveShift
Definition: NVPTX.h:105
@ SimpleMoveMask
Definition: NVPTX.h:104
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
ModulePass * createNVPTXAssignValidGlobalNamesPass()
MachineFunctionPass * createNVPTXReplaceImageHandlesPass()
FunctionPass * createNVPTXLowerUnreachablePass(bool TrapUnreachable, bool NoTrapAfterNoreturn)
ModulePass * createGenericToNVVMLegacyPass()
FunctionPass * createNVVMReflectPass(unsigned int SmVersion)
Definition: NVVMReflect.cpp:65
MachineFunctionPass * createNVPTXPrologEpilogPass()
MachineFunctionPass * createNVPTXProxyRegErasurePass()
MachineFunctionPass * createNVPTXPeephole()
FunctionPass * createNVPTXISelDag(NVPTXTargetMachine &TM, llvm::CodeGenOptLevel OptLevel)
createNVPTXISelDag - This pass converts a legalized DAG into a NVPTX-specific DAG,...
FunctionPass * createNVPTXLowerArgsPass()
FunctionPass * createNVPTXImageOptimizerPass()
FunctionPass * createNVPTXLowerAllocaPass()
CodeGenOptLevel
Code generation optimization level.
Definition: CodeGen.h:54
ModulePass * createNVPTXCtorDtorLoweringLegacyPass()
FunctionPass * createNVVMIntrRangePass()
void initializeNVPTXDAGToDAGISelLegacyPass(PassRegistry &)
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
NVVMReflectPass(unsigned SmVersion)
Definition: NVPTX.h:62
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:69