LLVM  8.0.1
NVPTXISelDAGToDAG.h
Go to the documentation of this file.
1 //===-- NVPTXISelDAGToDAG.h - A dag to dag inst selector for NVPTX --------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines an instruction selector for the NVPTX target.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXISELDAGTODAG_H
15 #define LLVM_LIB_TARGET_NVPTX_NVPTXISELDAGTODAG_H
16 
17 #include "NVPTX.h"
18 #include "NVPTXISelLowering.h"
19 #include "NVPTXRegisterInfo.h"
20 #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;
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
This class represents lattice values for constants.
Definition: AllocatorList.h:24
const NVPTXSubtarget * Subtarget
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Machine Value Type.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
SelectionDAGISel - This is the common base class used for SelectionDAG-based pattern-matching instruc...
NVPTXTargetMachine.
#define N
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library...
Definition: Compiler.h:108
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...