Coverage Report

Created: 2017-10-03 07:32

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.h
Line
Count
Source
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"
21
#include "llvm/CodeGen/SelectionDAGISel.h"
22
#include "llvm/IR/Intrinsics.h"
23
#include "llvm/Support/Compiler.h"
24
25
namespace llvm {
26
27
class LLVM_LIBRARY_VISIBILITY NVPTXDAGToDAGISel : public SelectionDAGISel {
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:
40
  explicit NVPTXDAGToDAGISel(NVPTXTargetMachine &tm,
41
                             CodeGenOpt::Level   OptLevel);
42
43
  // Pass Name
44
1
  StringRef getPassName() const override {
45
1
    return "NVPTX DAG->DAG Pattern Instruction Selection";
46
1
  }
47
  bool runOnMachineFunction(MachineFunction &MF) override;
48
  const NVPTXSubtarget *Subtarget;
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
  void SelectMatchAll(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
16.0k
  inline SDValue getI32Imm(unsigned Imm, const SDLoc &DL) {
79
16.0k
    return CurDAG->getTargetConstant(Imm, DL, MVT::i32);
80
16.0k
  }
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
92
  bool SelectADDRsi_imp(SDNode *OpNode, SDValue Addr, SDValue &Base,
93
                        SDValue &Offset, MVT mvt);
94
  bool SelectADDRsi(SDNode *OpNode, SDValue Addr, SDValue &Base,
95
                    SDValue &Offset);
96
  bool SelectADDRsi64(SDNode *OpNode, SDValue Addr, SDValue &Base,
97
                      SDValue &Offset);
98
99
  bool ChkMemSDNodeAddressSpace(SDNode *N, unsigned int spN) const;
100
101
  static unsigned GetConvertOpcode(MVT DestTy, MVT SrcTy, bool IsSigned);
102
};
103
} // end namespace llvm
104
105
#endif