LLVM  5.0.0
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 
39 public:
41  CodeGenOpt::Level OptLevel);
42 
43  // Pass Name
44  StringRef getPassName() const override {
45  return "NVPTX DAG->DAG Pattern Instruction Selection";
46  }
47  bool runOnMachineFunction(MachineFunction &MF) override;
49 
50  bool SelectInlineAsmMemoryOperand(const SDValue &Op,
51  unsigned ConstraintID,
52  std::vector<SDValue> &OutOps) override;
53 private:
54 // Include the pieces autogenerated from the target description.
55 #include "NVPTXGenDAGISel.inc"
56 
57  void Select(SDNode *N) override;
58  bool tryIntrinsicNoChain(SDNode *N);
59  bool tryIntrinsicChain(SDNode *N);
60  void SelectTexSurfHandle(SDNode *N);
61  bool tryLoad(SDNode *N);
62  bool tryLoadVector(SDNode *N);
63  bool tryLDGLDU(SDNode *N);
64  bool tryStore(SDNode *N);
65  bool tryStoreVector(SDNode *N);
66  bool tryLoadParam(SDNode *N);
67  bool tryStoreRetval(SDNode *N);
68  bool tryStoreParam(SDNode *N);
69  void SelectAddrSpaceCast(SDNode *N);
70  bool tryTextureIntrinsic(SDNode *N);
71  bool trySurfaceIntrinsic(SDNode *N);
72  bool tryBFE(SDNode *N);
73  bool tryConstantFP16(SDNode *N);
74  bool SelectSETP_F16X2(SDNode *N);
75  bool tryEXTRACT_VECTOR_ELEMENT(SDNode *N);
76 
77  inline SDValue getI32Imm(unsigned Imm, const SDLoc &DL) {
78  return CurDAG->getTargetConstant(Imm, DL, MVT::i32);
79  }
80 
81  // Match direct address complex pattern.
82  bool SelectDirectAddr(SDValue N, SDValue &Address);
83 
84  bool SelectADDRri_imp(SDNode *OpNode, SDValue Addr, SDValue &Base,
85  SDValue &Offset, MVT mvt);
86  bool SelectADDRri(SDNode *OpNode, SDValue Addr, SDValue &Base,
87  SDValue &Offset);
88  bool SelectADDRri64(SDNode *OpNode, SDValue Addr, SDValue &Base,
89  SDValue &Offset);
90 
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
const NVPTXSubtarget * Subtarget
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Machine Value Type.
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library...
Definition: Compiler.h:105
const size_t N
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.
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...