Coverage Report

Created: 2019-02-23 12:57

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/CodeGen/SelectionDAGTargetInfo.h
Line
Count
Source
1
//==- llvm/CodeGen/SelectionDAGTargetInfo.h - SelectionDAG Info --*- 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 declares the SelectionDAGTargetInfo class, which targets can
10
// subclass to parameterize the SelectionDAG lowering and instruction
11
// selection process.
12
//
13
//===----------------------------------------------------------------------===//
14
15
#ifndef LLVM_CODEGEN_SELECTIONDAGTARGETINFO_H
16
#define LLVM_CODEGEN_SELECTIONDAGTARGETINFO_H
17
18
#include "llvm/CodeGen/MachineMemOperand.h"
19
#include "llvm/CodeGen/SelectionDAGNodes.h"
20
#include "llvm/Support/CodeGen.h"
21
#include <utility>
22
23
namespace llvm {
24
25
class SelectionDAG;
26
27
//===----------------------------------------------------------------------===//
28
/// Targets can subclass this to parameterize the
29
/// SelectionDAG lowering and instruction selection process.
30
///
31
class SelectionDAGTargetInfo {
32
public:
33
49.6k
  explicit SelectionDAGTargetInfo() = default;
34
  SelectionDAGTargetInfo(const SelectionDAGTargetInfo &) = delete;
35
  SelectionDAGTargetInfo &operator=(const SelectionDAGTargetInfo &) = delete;
36
  virtual ~SelectionDAGTargetInfo();
37
38
  /// Emit target-specific code that performs a memcpy.
39
  /// This can be used by targets to provide code sequences for cases
40
  /// that don't fit the target's parameters for simple loads/stores and can be
41
  /// more efficient than using a library call. This function can return a null
42
  /// SDValue if the target declines to use custom code and a different
43
  /// lowering strategy should be used.
44
  ///
45
  /// If AlwaysInline is true, the size is constant and the target should not
46
  /// emit any calls and is strongly encouraged to attempt to emit inline code
47
  /// even if it is beyond the usual threshold because this intrinsic is being
48
  /// expanded in a place where calls are not feasible (e.g. within the prologue
49
  /// for another call). If the target chooses to decline an AlwaysInline
50
  /// request here, legalize will resort to using simple loads and stores.
51
  virtual SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, const SDLoc &dl,
52
                                          SDValue Chain, SDValue Op1,
53
                                          SDValue Op2, SDValue Op3,
54
                                          unsigned Align, bool isVolatile,
55
                                          bool AlwaysInline,
56
                                          MachinePointerInfo DstPtrInfo,
57
554
                                          MachinePointerInfo SrcPtrInfo) const {
58
554
    return SDValue();
59
554
  }
60
61
  /// Emit target-specific code that performs a memmove.
62
  /// This can be used by targets to provide code sequences for cases
63
  /// that don't fit the target's parameters for simple loads/stores and can be
64
  /// more efficient than using a library call. This function can return a null
65
  /// SDValue if the target declines to use custom code and a different
66
  /// lowering strategy should be used.
67
  virtual SDValue EmitTargetCodeForMemmove(
68
      SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Op1,
69
      SDValue Op2, SDValue Op3, unsigned Align, bool isVolatile,
70
53
      MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const {
71
53
    return SDValue();
72
53
  }
73
74
  /// Emit target-specific code that performs a memset.
75
  /// This can be used by targets to provide code sequences for cases
76
  /// that don't fit the target's parameters for simple stores and can be more
77
  /// efficient than using a library call. This function can return a null
78
  /// SDValue if the target declines to use custom code and a different
79
  /// lowering strategy should be used.
80
  virtual SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, const SDLoc &dl,
81
                                          SDValue Chain, SDValue Op1,
82
                                          SDValue Op2, SDValue Op3,
83
                                          unsigned Align, bool isVolatile,
84
21
                                          MachinePointerInfo DstPtrInfo) const {
85
21
    return SDValue();
86
21
  }
87
88
  /// Emit target-specific code that performs a memcmp, in cases where that is
89
  /// faster than a libcall. The first returned SDValue is the result of the
90
  /// memcmp and the second is the chain. Both SDValues can be null if a normal
91
  /// libcall should be used.
92
  virtual std::pair<SDValue, SDValue>
93
  EmitTargetCodeForMemcmp(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain,
94
                          SDValue Op1, SDValue Op2, SDValue Op3,
95
                          MachinePointerInfo Op1PtrInfo,
96
378
                          MachinePointerInfo Op2PtrInfo) const {
97
378
    return std::make_pair(SDValue(), SDValue());
98
378
  }
99
100
  /// Emit target-specific code that performs a memchr, in cases where that is
101
  /// faster than a libcall. The first returned SDValue is the result of the
102
  /// memchr and the second is the chain. Both SDValues can be null if a normal
103
  /// libcall should be used.
104
  virtual std::pair<SDValue, SDValue>
105
  EmitTargetCodeForMemchr(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain,
106
                          SDValue Src, SDValue Char, SDValue Length,
107
28
                          MachinePointerInfo SrcPtrInfo) const {
108
28
    return std::make_pair(SDValue(), SDValue());
109
28
  }
110
111
  /// Emit target-specific code that performs a strcpy or stpcpy, in cases
112
  /// where that is faster than a libcall.
113
  /// The first returned SDValue is the result of the copy (the start
114
  /// of the destination string for strcpy, a pointer to the null terminator
115
  /// for stpcpy) and the second is the chain.  Both SDValues can be null
116
  /// if a normal libcall should be used.
117
  virtual std::pair<SDValue, SDValue>
118
  EmitTargetCodeForStrcpy(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain,
119
                          SDValue Dest, SDValue Src,
120
                          MachinePointerInfo DestPtrInfo,
121
239
                          MachinePointerInfo SrcPtrInfo, bool isStpcpy) const {
122
239
    return std::make_pair(SDValue(), SDValue());
123
239
  }
124
125
  /// Emit target-specific code that performs a strcmp, in cases where that is
126
  /// faster than a libcall.
127
  /// The first returned SDValue is the result of the strcmp and the second is
128
  /// the chain. Both SDValues can be null if a normal libcall should be used.
129
  virtual std::pair<SDValue, SDValue>
130
  EmitTargetCodeForStrcmp(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain,
131
                          SDValue Op1, SDValue Op2,
132
                          MachinePointerInfo Op1PtrInfo,
133
5.19k
                          MachinePointerInfo Op2PtrInfo) const {
134
5.19k
    return std::make_pair(SDValue(), SDValue());
135
5.19k
  }
136
137
  virtual std::pair<SDValue, SDValue>
138
  EmitTargetCodeForStrlen(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain,
139
553
                          SDValue Src, MachinePointerInfo SrcPtrInfo) const {
140
553
    return std::make_pair(SDValue(), SDValue());
141
553
  }
142
143
  virtual std::pair<SDValue, SDValue>
144
  EmitTargetCodeForStrnlen(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain,
145
                           SDValue Src, SDValue MaxLength,
146
1
                           MachinePointerInfo SrcPtrInfo) const {
147
1
    return std::make_pair(SDValue(), SDValue());
148
1
  }
149
150
  // Return true when the decision to generate FMA's (or FMS, FMLA etc) rather
151
  // than FMUL and ADD is delegated to the machine combiner.
152
9.56k
  virtual bool generateFMAsInMachineCombiner(CodeGenOpt::Level OptLevel) const {
153
9.56k
    return false;
154
9.56k
  }
155
};
156
157
} // end namespace llvm
158
159
#endif // LLVM_CODEGEN_SELECTIONDAGTARGETINFO_H