TargetSelectionDAGInfo.h 7.3 KB

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