LLVM  14.0.0git
NVPTXISelDAGToDAG.h
Go to the documentation of this file.
1 //===-- NVPTXISelDAGToDAG.h - A dag to dag inst selector for NVPTX --------===//
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 defines an instruction selector for the NVPTX target.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXISELDAGTODAG_H
14 #define LLVM_LIB_TARGET_NVPTX_NVPTXISELDAGTODAG_H
15 
16 #include "NVPTX.h"
17 #include "NVPTXISelLowering.h"
18 #include "NVPTXRegisterInfo.h"
19 #include "NVPTXTargetMachine.h"
22 #include "llvm/IR/Intrinsics.h"
23 #include "llvm/Support/Compiler.h"
24 
25 namespace llvm {
26 
28  const NVPTXTargetMachine &TM;
29 
30  // If true, generate mul.wide from sext and mul
31  bool doMulWide;
32 
33  int getDivF32Level() const;
34  bool usePrecSqrtF32() const;
35  bool useF32FTZ() const;
36  bool allowFMA() const;
37  bool allowUnsafeFPMath() const;
38  bool useShortPointers() const;
39 
40 public:
42  CodeGenOpt::Level OptLevel);
43 
44  // Pass Name
45  StringRef getPassName() const override {
46  return "NVPTX DAG->DAG Pattern Instruction Selection";
47  }
48  bool runOnMachineFunction(MachineFunction &MF) override;
49  const NVPTXSubtarget *Subtarget = nullptr;
50 
51  bool SelectInlineAsmMemoryOperand(const SDValue &Op,
52  unsigned ConstraintID,
53  std::vector<SDValue> &OutOps) override;
54 private:
55 // Include the pieces autogenerated from the target description.
56 #include "NVPTXGenDAGISel.inc"
57 
58  void Select(SDNode *N) override;
59  bool tryIntrinsicNoChain(SDNode *N);
60  bool tryIntrinsicChain(SDNode *N);
61  void SelectTexSurfHandle(SDNode *N);
62  bool tryLoad(SDNode *N);
63  bool tryLoadVector(SDNode *N);
64  bool tryLDGLDU(SDNode *N);
65  bool tryStore(SDNode *N);
66  bool tryStoreVector(SDNode *N);
67  bool tryLoadParam(SDNode *N);
68  bool tryStoreRetval(SDNode *N);
69  bool tryStoreParam(SDNode *N);
70  void SelectAddrSpaceCast(SDNode *N);
71  bool tryTextureIntrinsic(SDNode *N);
72  bool trySurfaceIntrinsic(SDNode *N);
73  bool tryBFE(SDNode *N);
74  bool tryConstantFP16(SDNode *N);
75  bool SelectSETP_F16X2(SDNode *N);
76  bool tryEXTRACT_VECTOR_ELEMENT(SDNode *N);
77 
78  inline SDValue getI32Imm(unsigned Imm, const SDLoc &DL) {
79  return CurDAG->getTargetConstant(Imm, DL, MVT::i32);
80  }
81 
82  // Match direct address complex pattern.
83  bool SelectDirectAddr(SDValue N, SDValue &Address);
84 
85  bool SelectADDRri_imp(SDNode *OpNode, SDValue Addr, SDValue &Base,
86  SDValue &Offset, MVT mvt);
87  bool SelectADDRri(SDNode *OpNode, SDValue Addr, SDValue &Base,
88  SDValue &Offset);
89  bool SelectADDRri64(SDNode *OpNode, SDValue Addr, SDValue &Base,
90  SDValue &Offset);
91  bool SelectADDRsi_imp(SDNode *OpNode, SDValue Addr, SDValue &Base,
92  SDValue &Offset, MVT mvt);
93  bool SelectADDRsi(SDNode *OpNode, SDValue Addr, SDValue &Base,
94  SDValue &Offset);
95  bool SelectADDRsi64(SDNode *OpNode, SDValue Addr, SDValue &Base,
96  SDValue &Offset);
97 
98  bool ChkMemSDNodeAddressSpace(SDNode *N, unsigned int spN) const;
99 
100  static unsigned GetConvertOpcode(MVT DestTy, MVT SrcTy, bool IsSigned);
101 };
102 } // end namespace llvm
103 
104 #endif
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::SDLoc
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Definition: SelectionDAGNodes.h:1086
llvm::NVPTXDAGToDAGISel::getPassName
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: NVPTXISelDAGToDAG.h:45
llvm::SDNode
Represents one node in the SelectionDAG.
Definition: SelectionDAGNodes.h:455
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
NVPTXRegisterInfo.h
llvm::NVPTXTargetMachine
NVPTXTargetMachine.
Definition: NVPTXTargetMachine.h:24
NVPTX.h
Intrinsics.h
llvm::NVPTXSubtarget
Definition: NVPTXSubtarget.h:31
Addr
uint64_t Addr
Definition: ELFObjHandler.cpp:80
NVPTXBaseInfo.h
llvm::MVT
Machine Value Type.
Definition: MachineValueType.h:31
llvm::MachineFunction
Definition: MachineFunction.h:230
SelectionDAGISel.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
Compiler.h
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
LLVM_LIBRARY_VISIBILITY
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library,...
Definition: Compiler.h:131
llvm::CodeGenOpt::Level
Level
Definition: CodeGen.h:52
NVPTXISelLowering.h
llvm::NVPTXDAGToDAGISel
Definition: NVPTXISelDAGToDAG.h:27
llvm::MCID::Select
@ Select
Definition: MCInstrDesc.h:162
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:321
NVPTXTargetMachine.h
llvm::MVT::i32
@ i32
Definition: MachineValueType.h:46
llvm::SDValue
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
Definition: SelectionDAGNodes.h:138
llvm::SelectionDAGISel
SelectionDAGISel - This is the common base class used for SelectionDAG-based pattern-matching instruc...
Definition: SelectionDAGISel.h:39
N
#define N
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::sampleprof::Base
@ Base
Definition: Discriminator.h:58