Add a C++11 ThreadPool implementation in LLVM
[oota-llvm.git] / include / llvm / Target / TargetSelectionDAGInfo.h
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
19 #include "llvm/CodeGen/SelectionDAGNodes.h"
20
21 namespace llvm {
22
23 //===----------------------------------------------------------------------===//
24 /// Targets can subclass this to parameterize the
25 /// SelectionDAG lowering and instruction selection process.
26 ///
27 class TargetSelectionDAGInfo {
28   TargetSelectionDAGInfo(const TargetSelectionDAGInfo &) = delete;
29   void operator=(const TargetSelectionDAGInfo &) = delete;
30
31 public:
32   explicit TargetSelectionDAGInfo() = default;
33   virtual ~TargetSelectionDAGInfo();
34
35   /// Emit target-specific code that performs a memcpy.
36   /// 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
49   EmitTargetCodeForMemcpy(SelectionDAG &DAG, SDLoc dl,
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   /// Emit target-specific code that performs a memmove.
60   /// 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
66   EmitTargetCodeForMemmove(SelectionDAG &DAG, SDLoc dl,
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   /// Emit target-specific code that performs a memset.
76   /// 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
82   EmitTargetCodeForMemset(SelectionDAG &DAG, SDLoc dl,
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   /// Emit target-specific code that performs a memcmp, in cases where that is
91   /// faster than a libcall. The first returned SDValue is the result of the
92   /// memcmp and the second is the chain. Both SDValues can be null if a normal
93   /// libcall should be used.
94   virtual std::pair<SDValue, SDValue>
95   EmitTargetCodeForMemcmp(SelectionDAG &DAG, SDLoc dl,
96                           SDValue Chain,
97                           SDValue Op1, SDValue Op2,
98                           SDValue Op3, MachinePointerInfo Op1PtrInfo,
99                           MachinePointerInfo Op2PtrInfo) const {
100     return std::make_pair(SDValue(), SDValue());
101   }
102
103   /// Emit target-specific code that performs a memchr, in cases where that is
104   /// faster than a libcall. The first returned SDValue is the result of the
105   /// memchr and the second is the chain. Both SDValues can be null if a normal
106   /// libcall should be used.
107   virtual std::pair<SDValue, SDValue>
108   EmitTargetCodeForMemchr(SelectionDAG &DAG, SDLoc dl, SDValue Chain,
109                           SDValue Src, SDValue Char, SDValue Length,
110                           MachinePointerInfo SrcPtrInfo) const {
111     return std::make_pair(SDValue(), SDValue());
112   }
113
114   /// Emit target-specific code that performs a strcpy or stpcpy, in cases
115   /// where that is faster than a libcall.
116   /// The first returned SDValue is the result of the copy (the start
117   /// of the destination string for strcpy, a pointer to the null terminator
118   /// for stpcpy) and the second is the chain.  Both SDValues can be null
119   /// if a normal libcall should be used.
120   virtual std::pair<SDValue, SDValue>
121   EmitTargetCodeForStrcpy(SelectionDAG &DAG, SDLoc DL, SDValue Chain,
122                           SDValue Dest, SDValue Src,
123                           MachinePointerInfo DestPtrInfo,
124                           MachinePointerInfo SrcPtrInfo,
125                           bool isStpcpy) const {
126     return std::make_pair(SDValue(), SDValue());
127   }
128
129   /// Emit target-specific code that performs a strcmp, in cases where that is
130   /// faster than a libcall.
131   /// The first returned SDValue is the result of the strcmp and the second is
132   /// the chain. Both SDValues can be null if a normal libcall should be used.
133   virtual std::pair<SDValue, SDValue>
134   EmitTargetCodeForStrcmp(SelectionDAG &DAG, SDLoc dl,
135                           SDValue Chain,
136                           SDValue Op1, SDValue Op2,
137                           MachinePointerInfo Op1PtrInfo,
138                           MachinePointerInfo Op2PtrInfo) const {
139     return std::make_pair(SDValue(), SDValue());
140   }
141
142   virtual std::pair<SDValue, SDValue>
143   EmitTargetCodeForStrlen(SelectionDAG &DAG, SDLoc DL, SDValue Chain,
144                           SDValue Src, MachinePointerInfo SrcPtrInfo) const {
145     return std::make_pair(SDValue(), SDValue());
146   }
147
148   virtual std::pair<SDValue, SDValue>
149   EmitTargetCodeForStrnlen(SelectionDAG &DAG, SDLoc DL, SDValue Chain,
150                            SDValue Src, SDValue MaxLength,
151                            MachinePointerInfo SrcPtrInfo) const {
152     return std::make_pair(SDValue(), SDValue());
153   }
154 };
155
156 } // end llvm namespace
157
158 #endif