LLVM API Documentation

TargetSelectionDAGInfo.h
Go to the documentation of this file.
00001 //==-- llvm/Target/TargetSelectionDAGInfo.h - SelectionDAG Info --*- C++ -*-==//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file declares the TargetSelectionDAGInfo class, which targets can
00011 // subclass to parameterize the SelectionDAG lowering and instruction
00012 // selection process.
00013 //
00014 //===----------------------------------------------------------------------===//
00015 
00016 #ifndef LLVM_TARGET_TARGETSELECTIONDAGINFO_H
00017 #define LLVM_TARGET_TARGETSELECTIONDAGINFO_H
00018 
00019 #include "llvm/CodeGen/SelectionDAGNodes.h"
00020 
00021 namespace llvm {
00022 
00023 class DataLayout;
00024 class TargetMachine;
00025 
00026 //===----------------------------------------------------------------------===//
00027 /// TargetSelectionDAGInfo - Targets can subclass this to parameterize the
00028 /// SelectionDAG lowering and instruction selection process.
00029 ///
00030 class TargetSelectionDAGInfo {
00031   TargetSelectionDAGInfo(const TargetSelectionDAGInfo &) LLVM_DELETED_FUNCTION;
00032   void operator=(const TargetSelectionDAGInfo &) LLVM_DELETED_FUNCTION;
00033 
00034   const DataLayout *DL;
00035 
00036 protected:
00037   const DataLayout *getDataLayout() const { return DL; }
00038 
00039 public:
00040   explicit TargetSelectionDAGInfo(const DataLayout *DL);
00041   virtual ~TargetSelectionDAGInfo();
00042 
00043   /// EmitTargetCodeForMemcpy - Emit target-specific code that performs a
00044   /// memcpy. This can be used by targets to provide code sequences for cases
00045   /// that don't fit the target's parameters for simple loads/stores and can be
00046   /// more efficient than using a library call. This function can return a null
00047   /// SDValue if the target declines to use custom code and a different
00048   /// lowering strategy should be used.
00049   ///
00050   /// If AlwaysInline is true, the size is constant and the target should not
00051   /// emit any calls and is strongly encouraged to attempt to emit inline code
00052   /// even if it is beyond the usual threshold because this intrinsic is being
00053   /// expanded in a place where calls are not feasible (e.g. within the prologue
00054   /// for another call). If the target chooses to decline an AlwaysInline
00055   /// request here, legalize will resort to using simple loads and stores.
00056   virtual SDValue
00057   EmitTargetCodeForMemcpy(SelectionDAG &DAG, SDLoc dl,
00058                           SDValue Chain,
00059                           SDValue Op1, SDValue Op2,
00060                           SDValue Op3, unsigned Align, bool isVolatile,
00061                           bool AlwaysInline,
00062                           MachinePointerInfo DstPtrInfo,
00063                           MachinePointerInfo SrcPtrInfo) const {
00064     return SDValue();
00065   }
00066 
00067   /// EmitTargetCodeForMemmove - Emit target-specific code that performs a
00068   /// memmove. This can be used by targets to provide code sequences for cases
00069   /// that don't fit the target's parameters for simple loads/stores and can be
00070   /// more efficient than using a library call. This function can return a null
00071   /// SDValue if the target declines to use custom code and a different
00072   /// lowering strategy should be used.
00073   virtual SDValue
00074   EmitTargetCodeForMemmove(SelectionDAG &DAG, SDLoc dl,
00075                            SDValue Chain,
00076                            SDValue Op1, SDValue Op2,
00077                            SDValue Op3, unsigned Align, bool isVolatile,
00078                            MachinePointerInfo DstPtrInfo,
00079                            MachinePointerInfo SrcPtrInfo) const {
00080     return SDValue();
00081   }
00082 
00083   /// EmitTargetCodeForMemset - Emit target-specific code that performs a
00084   /// memset. This can be used by targets to provide code sequences for cases
00085   /// that don't fit the target's parameters for simple stores and can be more
00086   /// efficient than using a library call. This function can return a null
00087   /// SDValue if the target declines to use custom code and a different
00088   /// lowering strategy should be used.
00089   virtual SDValue
00090   EmitTargetCodeForMemset(SelectionDAG &DAG, SDLoc dl,
00091                           SDValue Chain,
00092                           SDValue Op1, SDValue Op2,
00093                           SDValue Op3, unsigned Align, bool isVolatile,
00094                           MachinePointerInfo DstPtrInfo) const {
00095     return SDValue();
00096   }
00097 
00098   /// EmitTargetCodeForMemcmp - Emit target-specific code that performs a
00099   /// memcmp, in cases where that is faster than a libcall.  The first
00100   /// returned SDValue is the result of the memcmp and the second is
00101   /// the chain.  Both SDValues can be null if a normal libcall should
00102   /// be used.
00103   virtual std::pair<SDValue, SDValue>
00104   EmitTargetCodeForMemcmp(SelectionDAG &DAG, SDLoc dl,
00105                           SDValue Chain,
00106                           SDValue Op1, SDValue Op2,
00107                           SDValue Op3, MachinePointerInfo Op1PtrInfo,
00108                           MachinePointerInfo Op2PtrInfo) const {
00109     return std::make_pair(SDValue(), SDValue());
00110   }
00111 
00112   /// EmitTargetCodeForMemchr - Emit target-specific code that performs a
00113   /// memchr, in cases where that is faster than a libcall.  The first
00114   /// returned SDValue is the result of the memchr and the second is
00115   /// the chain.  Both SDValues can be null if a normal libcall should
00116   /// be used.
00117   virtual std::pair<SDValue, SDValue>
00118   EmitTargetCodeForMemchr(SelectionDAG &DAG, SDLoc dl, SDValue Chain,
00119                           SDValue Src, SDValue Char, SDValue Length,
00120                           MachinePointerInfo SrcPtrInfo) const {
00121     return std::make_pair(SDValue(), SDValue());
00122   }
00123 
00124   /// EmitTargetCodeForStrcpy - Emit target-specific code that performs a
00125   /// strcpy or stpcpy, in cases where that is faster than a libcall.
00126   /// The first returned SDValue is the result of the copy (the start
00127   /// of the destination string for strcpy, a pointer to the null terminator
00128   /// for stpcpy) and the second is the chain.  Both SDValues can be null
00129   /// if a normal libcall should be used.
00130   virtual std::pair<SDValue, SDValue>
00131   EmitTargetCodeForStrcpy(SelectionDAG &DAG, SDLoc DL, SDValue Chain,
00132                           SDValue Dest, SDValue Src,
00133                           MachinePointerInfo DestPtrInfo,
00134                           MachinePointerInfo SrcPtrInfo,
00135                           bool isStpcpy) const {
00136     return std::make_pair(SDValue(), SDValue());
00137   }
00138 
00139   /// EmitTargetCodeForStrcmp - Emit target-specific code that performs a
00140   /// strcmp, in cases where that is faster than a libcall.  The first
00141   /// returned SDValue is the result of the strcmp and the second is
00142   /// the chain.  Both SDValues can be null if a normal libcall should
00143   /// be used.
00144   virtual std::pair<SDValue, SDValue>
00145   EmitTargetCodeForStrcmp(SelectionDAG &DAG, SDLoc dl,
00146                           SDValue Chain,
00147                           SDValue Op1, SDValue Op2,
00148                           MachinePointerInfo Op1PtrInfo,
00149                           MachinePointerInfo Op2PtrInfo) const {
00150     return std::make_pair(SDValue(), SDValue());
00151   }
00152 
00153   virtual std::pair<SDValue, SDValue>
00154   EmitTargetCodeForStrlen(SelectionDAG &DAG, SDLoc DL, SDValue Chain,
00155                           SDValue Src, MachinePointerInfo SrcPtrInfo) const {
00156     return std::make_pair(SDValue(), SDValue());
00157   }
00158 
00159   virtual std::pair<SDValue, SDValue>
00160   EmitTargetCodeForStrnlen(SelectionDAG &DAG, SDLoc DL, SDValue Chain,
00161                            SDValue Src, SDValue MaxLength,
00162                            MachinePointerInfo SrcPtrInfo) const {
00163     return std::make_pair(SDValue(), SDValue());
00164   }
00165 };
00166 
00167 } // end llvm namespace
00168 
00169 #endif