LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 class DataLayout;
24 class TargetMachine;
25 
26 //===----------------------------------------------------------------------===//
27 /// TargetSelectionDAGInfo - Targets can subclass this to parameterize the
28 /// SelectionDAG lowering and instruction selection process.
29 ///
32  void operator=(const TargetSelectionDAGInfo &) LLVM_DELETED_FUNCTION;
33 
34  const DataLayout *TD;
35 
36 protected:
37  const DataLayout *getDataLayout() const { return TD; }
38 
39 public:
40  explicit TargetSelectionDAGInfo(const TargetMachine &TM);
41  virtual ~TargetSelectionDAGInfo();
42 
43  /// EmitTargetCodeForMemcpy - Emit target-specific code that performs a
44  /// memcpy. This can be used by targets to provide code sequences for cases
45  /// that don't fit the target's parameters for simple loads/stores and can be
46  /// more efficient than using a library call. This function can return a null
47  /// SDValue if the target declines to use custom code and a different
48  /// lowering strategy should be used.
49  ///
50  /// If AlwaysInline is true, the size is constant and the target should not
51  /// emit any calls and is strongly encouraged to attempt to emit inline code
52  /// even if it is beyond the usual threshold because this intrinsic is being
53  /// expanded in a place where calls are not feasible (e.g. within the prologue
54  /// for another call). If the target chooses to decline an AlwaysInline
55  /// request here, legalize will resort to using simple loads and stores.
56  virtual SDValue
58  SDValue Chain,
59  SDValue Op1, SDValue Op2,
60  SDValue Op3, unsigned Align, bool isVolatile,
61  bool AlwaysInline,
62  MachinePointerInfo DstPtrInfo,
63  MachinePointerInfo SrcPtrInfo) const {
64  return SDValue();
65  }
66 
67  /// EmitTargetCodeForMemmove - Emit target-specific code that performs a
68  /// memmove. This can be used by targets to provide code sequences for cases
69  /// that don't fit the target's parameters for simple loads/stores and can be
70  /// more efficient than using a library call. This function can return a null
71  /// SDValue if the target declines to use custom code and a different
72  /// lowering strategy should be used.
73  virtual SDValue
75  SDValue Chain,
76  SDValue Op1, SDValue Op2,
77  SDValue Op3, unsigned Align, bool isVolatile,
78  MachinePointerInfo DstPtrInfo,
79  MachinePointerInfo SrcPtrInfo) const {
80  return SDValue();
81  }
82 
83  /// EmitTargetCodeForMemset - Emit target-specific code that performs a
84  /// memset. This can be used by targets to provide code sequences for cases
85  /// that don't fit the target's parameters for simple stores and can be more
86  /// efficient than using a library call. This function can return a null
87  /// SDValue if the target declines to use custom code and a different
88  /// lowering strategy should be used.
89  virtual SDValue
91  SDValue Chain,
92  SDValue Op1, SDValue Op2,
93  SDValue Op3, unsigned Align, bool isVolatile,
94  MachinePointerInfo DstPtrInfo) const {
95  return SDValue();
96  }
97 
98  /// EmitTargetCodeForMemcmp - Emit target-specific code that performs a
99  /// memcmp, in cases where that is faster than a libcall. The first
100  /// returned SDValue is the result of the memcmp and the second is
101  /// the chain. Both SDValues can be null if a normal libcall should
102  /// be used.
103  virtual std::pair<SDValue, SDValue>
105  SDValue Chain,
106  SDValue Op1, SDValue Op2,
107  SDValue Op3, MachinePointerInfo Op1PtrInfo,
108  MachinePointerInfo Op2PtrInfo) const {
109  return std::make_pair(SDValue(), SDValue());
110  }
111 
112  /// EmitTargetCodeForMemchr - Emit target-specific code that performs a
113  /// memchr, in cases where that is faster than a libcall. The first
114  /// returned SDValue is the result of the memchr and the second is
115  /// the chain. Both SDValues can be null if a normal libcall should
116  /// be used.
117  virtual std::pair<SDValue, SDValue>
119  SDValue Src, SDValue Char, SDValue Length,
120  MachinePointerInfo SrcPtrInfo) const {
121  return std::make_pair(SDValue(), SDValue());
122  }
123 
124  /// EmitTargetCodeForStrcpy - Emit target-specific code that performs a
125  /// strcpy or stpcpy, in cases where that is faster than a libcall.
126  /// The first returned SDValue is the result of the copy (the start
127  /// of the destination string for strcpy, a pointer to the null terminator
128  /// for stpcpy) and the second is the chain. Both SDValues can be null
129  /// if a normal libcall should be used.
130  virtual std::pair<SDValue, SDValue>
132  SDValue Dest, SDValue Src,
133  MachinePointerInfo DestPtrInfo,
134  MachinePointerInfo SrcPtrInfo,
135  bool isStpcpy) const {
136  return std::make_pair(SDValue(), SDValue());
137  }
138 
139  /// EmitTargetCodeForStrcmp - Emit target-specific code that performs a
140  /// strcmp, in cases where that is faster than a libcall. The first
141  /// returned SDValue is the result of the strcmp and the second is
142  /// the chain. Both SDValues can be null if a normal libcall should
143  /// be used.
144  virtual std::pair<SDValue, SDValue>
146  SDValue Chain,
147  SDValue Op1, SDValue Op2,
148  MachinePointerInfo Op1PtrInfo,
149  MachinePointerInfo Op2PtrInfo) const {
150  return std::make_pair(SDValue(), SDValue());
151  }
152 
153  virtual std::pair<SDValue, SDValue>
155  SDValue Src, MachinePointerInfo SrcPtrInfo) const {
156  return std::make_pair(SDValue(), SDValue());
157  }
158 
159  virtual std::pair<SDValue, SDValue>
161  SDValue Src, SDValue MaxLength,
162  MachinePointerInfo SrcPtrInfo) const {
163  return std::make_pair(SDValue(), SDValue());
164  }
165 };
166 
167 } // end llvm namespace
168 
169 #endif
virtual std::pair< SDValue, SDValue > EmitTargetCodeForStrcpy(SelectionDAG &DAG, SDLoc DL, SDValue Chain, SDValue Dest, SDValue Src, MachinePointerInfo DestPtrInfo, MachinePointerInfo SrcPtrInfo, bool isStpcpy) const
virtual SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, SDLoc dl, SDValue Chain, SDValue Op1, SDValue Op2, SDValue Op3, unsigned Align, bool isVolatile, MachinePointerInfo DstPtrInfo) const
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
const DataLayout * getDataLayout() const
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
virtual std::pair< SDValue, SDValue > EmitTargetCodeForStrnlen(SelectionDAG &DAG, SDLoc DL, SDValue Chain, SDValue Src, SDValue MaxLength, MachinePointerInfo SrcPtrInfo) const
virtual std::pair< SDValue, SDValue > EmitTargetCodeForMemcmp(SelectionDAG &DAG, SDLoc dl, SDValue Chain, SDValue Op1, SDValue Op2, SDValue Op3, MachinePointerInfo Op1PtrInfo, MachinePointerInfo Op2PtrInfo) const
#define LLVM_DELETED_FUNCTION
Definition: Compiler.h:137
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(DefaultAlign), cl::values(clEnumValN(DefaultAlign,"arm-default-align","Generate unaligned accesses only on hardware/OS ""combinations that are known to support them"), clEnumValN(StrictAlign,"arm-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"arm-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
virtual SDValue EmitTargetCodeForMemmove(SelectionDAG &DAG, SDLoc dl, SDValue Chain, SDValue Op1, SDValue Op2, SDValue Op3, unsigned Align, bool isVolatile, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const