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
73namespace NVPTX {
76 CUDA
77};
78
79// A field inside TSFlags needs a shift and a mask. The usage is
80// always as follows :
81// ((TSFlags & fieldMask) >> fieldShift)
82// The enum keeps the mask, the shift, and all valid values of the
83// field in one place.
87
88 VecNOP = 0,
96 VecOther = 15
97};
98
107 isStoreShift = 6
109
110// Extends LLVM AtomicOrdering with PTX Orderings:
111using OrderingUnderlyingType = unsigned int;
114 AtomicOrdering::NotAtomic, // PTX calls these: "Weak"
115 // Unordered = 1, // NVPTX maps LLVM Unorderd to Relaxed
117 // Consume = 3, // Unimplemented in LLVM; NVPTX would map to "Acquire"
120 // AcquireRelease = 6, // TODO
127
128namespace PTXLdStInstCode {
134 PARAM = 4,
135 LOCAL = 5
141 Untyped
145 V2 = 2,
146 V4 = 4
148} // namespace PTXLdStInstCode
149
150/// PTXCvtMode - Conversion code enumeration
151namespace PTXCvtMode {
153 NONE = 0,
163
164 BASE_MASK = 0x0F,
165 FTZ_FLAG = 0x10,
166 SAT_FLAG = 0x20,
167 RELU_FLAG = 0x40
169}
170
171/// PTXCmpMode - Comparison mode enumeration
172namespace PTXCmpMode {
174 EQ = 0,
191 // NAN is a MACRO
193
194 BASE_MASK = 0xFF,
195 FTZ_FLAG = 0x100
197}
198
199namespace PTXPrmtMode {
208};
209}
210}
212} // namespace llvm
213
214// Defines symbolic names for NVPTX registers. This defines a mapping from
215// register name to register number.
216#define GET_REGINFO_ENUM
217#include "NVPTXGenRegisterInfo.inc"
218
219// Defines symbolic names for the NVPTX instructions.
220#define GET_INSTRINFO_ENUM
221#define GET_INSTRINFO_MC_HELPER_DECLS
222#include "NVPTXGenInstrInfo.inc"
223
224#endif
Atomic ordering constants.
#define F(x, y, z)
Definition: MD5.cpp:55
unsigned SmVersion
Definition: NVVMReflect.cpp:81
This header defines various interfaces for pass management in LLVM.
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
VecInstType
Definition: NVPTX.h:84
@ VecOther
Definition: NVPTX.h:96
@ VecInstTypeShift
Definition: NVPTX.h:85
@ VecExtract
Definition: NVPTX.h:93
@ VecInsert
Definition: NVPTX.h:94
@ VecShuffle
Definition: NVPTX.h:92
@ VecBuild
Definition: NVPTX.h:91
@ VecInstTypeMask
Definition: NVPTX.h:86
@ VecLoad
Definition: NVPTX.h:89
@ VecDest
Definition: NVPTX.h:95
@ VecStore
Definition: NVPTX.h:90
@ VecNOP
Definition: NVPTX.h:88
unsigned int OrderingUnderlyingType
Definition: NVPTX.h:111
DrvInterface
Definition: NVPTX.h:74
@ NVCL
Definition: NVPTX.h:75
@ CUDA
Definition: NVPTX.h:76
@ RelaxedMMIO
Definition: NVPTX.h:124
@ Acquire
Definition: NVPTX.h:118
@ Relaxed
Definition: NVPTX.h:116
@ NotAtomic
Definition: NVPTX.h:113
@ Volatile
Definition: NVPTX.h:123
@ Release
Definition: NVPTX.h:119
@ SequentiallyConsistent
Definition: NVPTX.h:121
@ isStoreShift
Definition: NVPTX.h:107
@ isLoadShift
Definition: NVPTX.h:105
@ isLoadMask
Definition: NVPTX.h:104
@ isStoreMask
Definition: NVPTX.h:106
SimpleMove
Definition: NVPTX.h:99
@ SimpleMoveShift
Definition: NVPTX.h:101
@ SimpleMoveMask
Definition: NVPTX.h:100
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:68
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)
NVVMReflectPass(unsigned SmVersion)
Definition: NVPTX.h:62
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:69