LLVM  3.7.0
TargetSelectionDAGInfo.h
Go to the documentation of this file.
1 //==-- llvm/Target/TargetSelectionDAGInfo.h - SelectionDAG Info --*- C++ -*-==//
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 declares the TargetSelectionDAGInfo class, which targets can
11 // subclass to parameterize the SelectionDAG lowering and instruction
12 // selection process.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_TARGET_TARGETSELECTIONDAGINFO_H
17 #define LLVM_TARGET_TARGETSELECTIONDAGINFO_H
18 
20 
21 namespace llvm {
22 
23 //===----------------------------------------------------------------------===//
24 /// TargetSelectionDAGInfo - Targets can subclass this to parameterize the
25 /// SelectionDAG lowering and instruction selection process.
26 ///
29  void operator=(const TargetSelectionDAGInfo &) = delete;
30 
31 public:
32  explicit TargetSelectionDAGInfo() = default;
33  virtual ~TargetSelectionDAGInfo();
34 
35  /// EmitTargetCodeForMemcpy - Emit target-specific code that performs a
36  /// memcpy. This can be used by targets to provide code sequences for cases
37  /// that don't fit the target's parameters for simple loads/stores and can be
38  /// more efficient than using a library call. This function can return a null
39  /// SDValue if the target declines to use custom code and a different
40  /// lowering strategy should be used.
41  ///
42  /// If AlwaysInline is true, the size is constant and the target should not
43  /// emit any calls and is strongly encouraged to attempt to emit inline code
44  /// even if it is beyond the usual threshold because this intrinsic is being
45  /// expanded in a place where calls are not feasible (e.g. within the prologue
46  /// for another call). If the target chooses to decline an AlwaysInline
47  /// request here, legalize will resort to using simple loads and stores.
48  virtual SDValue
50  SDValue Chain,
51  SDValue Op1, SDValue Op2,
52  SDValue Op3, unsigned Align, bool isVolatile,
53  bool AlwaysInline,
54  MachinePointerInfo DstPtrInfo,
55  MachinePointerInfo SrcPtrInfo) const {
56  return SDValue();
57  }
58 
59  /// EmitTargetCodeForMemmove - Emit target-specific code that performs a
60  /// memmove. This can be used by targets to provide code sequences for cases
61  /// that don't fit the target's parameters for simple loads/stores and can be
62  /// more efficient than using a library call. This function can return a null
63  /// SDValue if the target declines to use custom code and a different
64  /// lowering strategy should be used.
65  virtual SDValue
67  SDValue Chain,
68  SDValue Op1, SDValue Op2,
69  SDValue Op3, unsigned Align, bool isVolatile,
70  MachinePointerInfo DstPtrInfo,
71  MachinePointerInfo SrcPtrInfo) const {
72  return SDValue();
73  }
74 
75  /// EmitTargetCodeForMemset - Emit target-specific code that performs a
76  /// memset. This can be used by targets to provide code sequences for cases
77  /// that don't fit the target's parameters for simple stores and can be more
78  /// efficient than using a library call. This function can return a null
79  /// SDValue if the target declines to use custom code and a different
80  /// lowering strategy should be used.
81  virtual SDValue
83  SDValue Chain,
84  SDValue Op1, SDValue Op2,
85  SDValue Op3, unsigned Align, bool isVolatile,
86  MachinePointerInfo DstPtrInfo) const {
87  return SDValue();
88  }
89 
90  /// EmitTargetCodeForMemcmp - Emit target-specific code that performs a
91  /// memcmp, in cases where that is faster than a libcall. The first
92  /// returned SDValue is the result of the memcmp and the second is
93  /// the chain. Both SDValues can be null if a normal libcall should
94  /// be used.
95  virtual std::pair<SDValue, SDValue>
97  SDValue Chain,
98  SDValue Op1, SDValue Op2,
99  SDValue Op3, MachinePointerInfo Op1PtrInfo,
100  MachinePointerInfo Op2PtrInfo) const {
101  return std::make_pair(SDValue(), SDValue());
102  }
103 
104  /// EmitTargetCodeForMemchr - Emit target-specific code that performs a
105  /// memchr, in cases where that is faster than a libcall. The first
106  /// returned SDValue is the result of the memchr and the second is
107  /// the chain. Both SDValues can be null if a normal libcall should
108  /// be used.
109  virtual std::pair<SDValue, SDValue>
111  SDValue Src, SDValue Char, SDValue Length,
112  MachinePointerInfo SrcPtrInfo) const {
113  return std::make_pair(SDValue(), SDValue());
114  }
115 
116  /// EmitTargetCodeForStrcpy - Emit target-specific code that performs a
117  /// strcpy or stpcpy, in cases where that is faster than a libcall.
118  /// The first returned SDValue is the result of the copy (the start
119  /// of the destination string for strcpy, a pointer to the null terminator
120  /// for stpcpy) and the second is the chain. Both SDValues can be null
121  /// if a normal libcall should be used.
122  virtual std::pair<SDValue, SDValue>
124  SDValue Dest, SDValue Src,
125  MachinePointerInfo DestPtrInfo,
126  MachinePointerInfo SrcPtrInfo,
127  bool isStpcpy) const {
128  return std::make_pair(SDValue(), SDValue());
129  }
130 
131  /// EmitTargetCodeForStrcmp - Emit target-specific code that performs a
132  /// strcmp, in cases where that is faster than a libcall. The first
133  /// returned SDValue is the result of the strcmp and the second is
134  /// the chain. Both SDValues can be null if a normal libcall should
135  /// be used.
136  virtual std::pair<SDValue, SDValue>
138  SDValue Chain,
139  SDValue Op1, SDValue Op2,
140  MachinePointerInfo Op1PtrInfo,
141  MachinePointerInfo Op2PtrInfo) const {
142  return std::make_pair(SDValue(), SDValue());
143  }
144 
145  virtual std::pair<SDValue, SDValue>
147  SDValue Src, MachinePointerInfo SrcPtrInfo) const {
148  return std::make_pair(SDValue(), SDValue());
149  }
150 
151  virtual std::pair<SDValue, SDValue>
153  SDValue Src, SDValue MaxLength,
154  MachinePointerInfo SrcPtrInfo) const {
155  return std::make_pair(SDValue(), SDValue());
156  }
157 };
158 
159 } // end llvm namespace
160 
161 #endif
virtual std::pair< SDValue, SDValue > EmitTargetCodeForStrcpy(SelectionDAG &DAG, SDLoc DL, SDValue Chain, SDValue Dest, SDValue Src, MachinePointerInfo DestPtrInfo, MachinePointerInfo SrcPtrInfo, bool isStpcpy) const
EmitTargetCodeForStrcpy - Emit target-specific code that performs a strcpy or stpcpy, in cases where that is faster than a libcall.
virtual SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, SDLoc dl, SDValue Chain, SDValue Op1, SDValue Op2, SDValue Op3, unsigned Align, bool isVolatile, MachinePointerInfo DstPtrInfo) const
EmitTargetCodeForMemset - Emit target-specific code that performs a memset.
virtual SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, SDLoc dl, SDValue Chain, SDValue Op1, SDValue Op2, SDValue Op3, unsigned Align, bool isVolatile, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const
EmitTargetCodeForMemcpy - Emit target-specific code that performs a memcpy.
TargetSelectionDAGInfo - Targets can subclass this to parameterize the SelectionDAG lowering and inst...
virtual std::pair< SDValue, SDValue > EmitTargetCodeForStrlen(SelectionDAG &DAG, SDLoc DL, SDValue Chain, SDValue Src, MachinePointerInfo SrcPtrInfo) const
virtual std::pair< SDValue, SDValue > EmitTargetCodeForMemchr(SelectionDAG &DAG, SDLoc dl, SDValue Chain, SDValue Src, SDValue Char, SDValue Length, MachinePointerInfo SrcPtrInfo) const
EmitTargetCodeForMemchr - Emit target-specific code that performs a memchr, in cases where that is fa...
virtual std::pair< SDValue, SDValue > EmitTargetCodeForStrnlen(SelectionDAG &DAG, SDLoc DL, SDValue Chain, SDValue Src, SDValue MaxLength, MachinePointerInfo SrcPtrInfo) const
MachinePointerInfo - This class contains a discriminated union of information about pointers in memor...
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
Definition: SelectionDAG.h:179
virtual std::pair< SDValue, SDValue > EmitTargetCodeForMemcmp(SelectionDAG &DAG, SDLoc dl, SDValue Chain, SDValue Op1, SDValue Op2, SDValue Op3, MachinePointerInfo Op1PtrInfo, MachinePointerInfo Op2PtrInfo) const
EmitTargetCodeForMemcmp - Emit target-specific code that performs a memcmp, in cases where that is fa...
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(NoStrictAlign), cl::values(clEnumValN(StrictAlign,"aarch64-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"aarch64-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
virtual std::pair< SDValue, SDValue > EmitTargetCodeForStrcmp(SelectionDAG &DAG, SDLoc dl, SDValue Chain, SDValue Op1, SDValue Op2, MachinePointerInfo Op1PtrInfo, MachinePointerInfo Op2PtrInfo) const
EmitTargetCodeForStrcmp - Emit target-specific code that performs a strcmp, in cases where that is fa...
static bool isVolatile(Instruction *Inst)
virtual SDValue EmitTargetCodeForMemmove(SelectionDAG &DAG, SDLoc dl, SDValue Chain, SDValue Op1, SDValue Op2, SDValue Op3, unsigned Align, bool isVolatile, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const
EmitTargetCodeForMemmove - Emit target-specific code that performs a memmove.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...