1 //==-- llvm/Target/TargetSelectionDAGInfo.h - SelectionDAG Info --*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the TargetSelectionDAGInfo class, which targets can
11 // subclass to parameterize the SelectionDAG lowering and instruction
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_TARGET_TARGETSELECTIONDAGINFO_H
17 #define LLVM_TARGET_TARGETSELECTIONDAGINFO_H
19 #include "llvm/CodeGen/SelectionDAGNodes.h"
23 //===----------------------------------------------------------------------===//
24 /// TargetSelectionDAGInfo - Targets can subclass this to parameterize the
25 /// SelectionDAG lowering and instruction selection process.
27 class TargetSelectionDAGInfo {
28 TargetSelectionDAGInfo(const TargetSelectionDAGInfo &) = delete;
29 void operator=(const TargetSelectionDAGInfo &) = delete;
32 explicit TargetSelectionDAGInfo() = default;
33 virtual ~TargetSelectionDAGInfo();
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.
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.
49 EmitTargetCodeForMemcpy(SelectionDAG &DAG, SDLoc dl,
51 SDValue Op1, SDValue Op2,
52 SDValue Op3, unsigned Align, bool isVolatile,
54 MachinePointerInfo DstPtrInfo,
55 MachinePointerInfo SrcPtrInfo) const {
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.
66 EmitTargetCodeForMemmove(SelectionDAG &DAG, SDLoc dl,
68 SDValue Op1, SDValue Op2,
69 SDValue Op3, unsigned Align, bool isVolatile,
70 MachinePointerInfo DstPtrInfo,
71 MachinePointerInfo SrcPtrInfo) const {
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.
82 EmitTargetCodeForMemset(SelectionDAG &DAG, SDLoc dl,
84 SDValue Op1, SDValue Op2,
85 SDValue Op3, unsigned Align, bool isVolatile,
86 MachinePointerInfo DstPtrInfo) const {
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
95 virtual std::pair<SDValue, SDValue>
96 EmitTargetCodeForMemcmp(SelectionDAG &DAG, SDLoc dl,
98 SDValue Op1, SDValue Op2,
99 SDValue Op3, MachinePointerInfo Op1PtrInfo,
100 MachinePointerInfo Op2PtrInfo) const {
101 return std::make_pair(SDValue(), SDValue());
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
109 virtual std::pair<SDValue, SDValue>
110 EmitTargetCodeForMemchr(SelectionDAG &DAG, SDLoc dl, SDValue Chain,
111 SDValue Src, SDValue Char, SDValue Length,
112 MachinePointerInfo SrcPtrInfo) const {
113 return std::make_pair(SDValue(), SDValue());
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>
123 EmitTargetCodeForStrcpy(SelectionDAG &DAG, SDLoc DL, SDValue Chain,
124 SDValue Dest, SDValue Src,
125 MachinePointerInfo DestPtrInfo,
126 MachinePointerInfo SrcPtrInfo,
127 bool isStpcpy) const {
128 return std::make_pair(SDValue(), SDValue());
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
136 virtual std::pair<SDValue, SDValue>
137 EmitTargetCodeForStrcmp(SelectionDAG &DAG, SDLoc dl,
139 SDValue Op1, SDValue Op2,
140 MachinePointerInfo Op1PtrInfo,
141 MachinePointerInfo Op2PtrInfo) const {
142 return std::make_pair(SDValue(), SDValue());
145 virtual std::pair<SDValue, SDValue>
146 EmitTargetCodeForStrlen(SelectionDAG &DAG, SDLoc DL, SDValue Chain,
147 SDValue Src, MachinePointerInfo SrcPtrInfo) const {
148 return std::make_pair(SDValue(), SDValue());
151 virtual std::pair<SDValue, SDValue>
152 EmitTargetCodeForStrnlen(SelectionDAG &DAG, SDLoc DL, SDValue Chain,
153 SDValue Src, SDValue MaxLength,
154 MachinePointerInfo SrcPtrInfo) const {
155 return std::make_pair(SDValue(), SDValue());
159 } // end llvm namespace