1207618Srdivacky//==-- llvm/Target/TargetSelectionDAGInfo.h - SelectionDAG Info --*- C++ -*-==// 2207618Srdivacky// 3207618Srdivacky// The LLVM Compiler Infrastructure 4207618Srdivacky// 5207618Srdivacky// This file is distributed under the University of Illinois Open Source 6207618Srdivacky// License. See LICENSE.TXT for details. 7207618Srdivacky// 8207618Srdivacky//===----------------------------------------------------------------------===// 9207618Srdivacky// 10207618Srdivacky// This file declares the TargetSelectionDAGInfo class, which targets can 11207618Srdivacky// subclass to parameterize the SelectionDAG lowering and instruction 12207618Srdivacky// selection process. 13207618Srdivacky// 14207618Srdivacky//===----------------------------------------------------------------------===// 15207618Srdivacky 16207618Srdivacky#ifndef LLVM_TARGET_TARGETSELECTIONDAGINFO_H 17207618Srdivacky#define LLVM_TARGET_TARGETSELECTIONDAGINFO_H 18207618Srdivacky 19208599Srdivacky#include "llvm/CodeGen/SelectionDAGNodes.h" 20208599Srdivacky 21207618Srdivackynamespace llvm { 22207618Srdivacky 23243830Sdimclass DataLayout; 24208599Srdivackyclass TargetMachine; 25208599Srdivacky 26207618Srdivacky//===----------------------------------------------------------------------===// 27208599Srdivacky/// TargetSelectionDAGInfo - Targets can subclass this to parameterize the 28207618Srdivacky/// SelectionDAG lowering and instruction selection process. 29207618Srdivacky/// 30207618Srdivackyclass TargetSelectionDAGInfo { 31243830Sdim TargetSelectionDAGInfo(const TargetSelectionDAGInfo &) LLVM_DELETED_FUNCTION; 32243830Sdim void operator=(const TargetSelectionDAGInfo &) LLVM_DELETED_FUNCTION; 33207618Srdivacky 34243830Sdim const DataLayout *TD; 35208599Srdivacky 36208599Srdivackyprotected: 37243830Sdim const DataLayout *getDataLayout() const { return TD; } 38208599Srdivacky 39207618Srdivackypublic: 40208599Srdivacky explicit TargetSelectionDAGInfo(const TargetMachine &TM); 41207618Srdivacky virtual ~TargetSelectionDAGInfo(); 42208599Srdivacky 43208599Srdivacky /// EmitTargetCodeForMemcpy - Emit target-specific code that performs a 44208599Srdivacky /// memcpy. This can be used by targets to provide code sequences for cases 45208599Srdivacky /// that don't fit the target's parameters for simple loads/stores and can be 46208599Srdivacky /// more efficient than using a library call. This function can return a null 47208599Srdivacky /// SDValue if the target declines to use custom code and a different 48208599Srdivacky /// lowering strategy should be used. 49208599Srdivacky /// 50208599Srdivacky /// If AlwaysInline is true, the size is constant and the target should not 51208599Srdivacky /// emit any calls and is strongly encouraged to attempt to emit inline code 52208599Srdivacky /// even if it is beyond the usual threshold because this intrinsic is being 53208599Srdivacky /// expanded in a place where calls are not feasible (e.g. within the prologue 54208599Srdivacky /// for another call). If the target chooses to decline an AlwaysInline 55208599Srdivacky /// request here, legalize will resort to using simple loads and stores. 56208599Srdivacky virtual SDValue 57263508Sdim EmitTargetCodeForMemcpy(SelectionDAG &DAG, SDLoc dl, 58208599Srdivacky SDValue Chain, 59208599Srdivacky SDValue Op1, SDValue Op2, 60208599Srdivacky SDValue Op3, unsigned Align, bool isVolatile, 61208599Srdivacky bool AlwaysInline, 62218893Sdim MachinePointerInfo DstPtrInfo, 63218893Sdim MachinePointerInfo SrcPtrInfo) const { 64208599Srdivacky return SDValue(); 65208599Srdivacky } 66208599Srdivacky 67208599Srdivacky /// EmitTargetCodeForMemmove - Emit target-specific code that performs a 68208599Srdivacky /// memmove. This can be used by targets to provide code sequences for cases 69208599Srdivacky /// that don't fit the target's parameters for simple loads/stores and can be 70208599Srdivacky /// more efficient than using a library call. This function can return a null 71208599Srdivacky /// SDValue if the target declines to use custom code and a different 72208599Srdivacky /// lowering strategy should be used. 73208599Srdivacky virtual SDValue 74263508Sdim EmitTargetCodeForMemmove(SelectionDAG &DAG, SDLoc dl, 75208599Srdivacky SDValue Chain, 76208599Srdivacky SDValue Op1, SDValue Op2, 77208599Srdivacky SDValue Op3, unsigned Align, bool isVolatile, 78218893Sdim MachinePointerInfo DstPtrInfo, 79218893Sdim MachinePointerInfo SrcPtrInfo) const { 80208599Srdivacky return SDValue(); 81208599Srdivacky } 82208599Srdivacky 83208599Srdivacky /// EmitTargetCodeForMemset - Emit target-specific code that performs a 84208599Srdivacky /// memset. This can be used by targets to provide code sequences for cases 85208599Srdivacky /// that don't fit the target's parameters for simple stores and can be more 86208599Srdivacky /// efficient than using a library call. This function can return a null 87208599Srdivacky /// SDValue if the target declines to use custom code and a different 88208599Srdivacky /// lowering strategy should be used. 89208599Srdivacky virtual SDValue 90263508Sdim EmitTargetCodeForMemset(SelectionDAG &DAG, SDLoc dl, 91208599Srdivacky SDValue Chain, 92208599Srdivacky SDValue Op1, SDValue Op2, 93208599Srdivacky SDValue Op3, unsigned Align, bool isVolatile, 94218893Sdim MachinePointerInfo DstPtrInfo) const { 95208599Srdivacky return SDValue(); 96208599Srdivacky } 97263508Sdim 98263508Sdim /// EmitTargetCodeForMemcmp - Emit target-specific code that performs a 99263508Sdim /// memcmp, in cases where that is faster than a libcall. The first 100263508Sdim /// returned SDValue is the result of the memcmp and the second is 101263508Sdim /// the chain. Both SDValues can be null if a normal libcall should 102263508Sdim /// be used. 103263508Sdim virtual std::pair<SDValue, SDValue> 104263508Sdim EmitTargetCodeForMemcmp(SelectionDAG &DAG, SDLoc dl, 105263508Sdim SDValue Chain, 106263508Sdim SDValue Op1, SDValue Op2, 107263508Sdim SDValue Op3, MachinePointerInfo Op1PtrInfo, 108263508Sdim MachinePointerInfo Op2PtrInfo) const { 109263508Sdim return std::make_pair(SDValue(), SDValue()); 110263508Sdim } 111263508Sdim 112263508Sdim /// EmitTargetCodeForMemchr - Emit target-specific code that performs a 113263508Sdim /// memchr, in cases where that is faster than a libcall. The first 114263508Sdim /// returned SDValue is the result of the memchr and the second is 115263508Sdim /// the chain. Both SDValues can be null if a normal libcall should 116263508Sdim /// be used. 117263508Sdim virtual std::pair<SDValue, SDValue> 118263508Sdim EmitTargetCodeForMemchr(SelectionDAG &DAG, SDLoc dl, SDValue Chain, 119263508Sdim SDValue Src, SDValue Char, SDValue Length, 120263508Sdim MachinePointerInfo SrcPtrInfo) const { 121263508Sdim return std::make_pair(SDValue(), SDValue()); 122263508Sdim } 123263508Sdim 124263508Sdim /// EmitTargetCodeForStrcpy - Emit target-specific code that performs a 125263508Sdim /// strcpy or stpcpy, in cases where that is faster than a libcall. 126263508Sdim /// The first returned SDValue is the result of the copy (the start 127263508Sdim /// of the destination string for strcpy, a pointer to the null terminator 128263508Sdim /// for stpcpy) and the second is the chain. Both SDValues can be null 129263508Sdim /// if a normal libcall should be used. 130263508Sdim virtual std::pair<SDValue, SDValue> 131263508Sdim EmitTargetCodeForStrcpy(SelectionDAG &DAG, SDLoc DL, SDValue Chain, 132263508Sdim SDValue Dest, SDValue Src, 133263508Sdim MachinePointerInfo DestPtrInfo, 134263508Sdim MachinePointerInfo SrcPtrInfo, 135263508Sdim bool isStpcpy) const { 136263508Sdim return std::make_pair(SDValue(), SDValue()); 137263508Sdim } 138263508Sdim 139263508Sdim /// EmitTargetCodeForStrcmp - Emit target-specific code that performs a 140263508Sdim /// strcmp, in cases where that is faster than a libcall. The first 141263508Sdim /// returned SDValue is the result of the strcmp and the second is 142263508Sdim /// the chain. Both SDValues can be null if a normal libcall should 143263508Sdim /// be used. 144263508Sdim virtual std::pair<SDValue, SDValue> 145263508Sdim EmitTargetCodeForStrcmp(SelectionDAG &DAG, SDLoc dl, 146263508Sdim SDValue Chain, 147263508Sdim SDValue Op1, SDValue Op2, 148263508Sdim MachinePointerInfo Op1PtrInfo, 149263508Sdim MachinePointerInfo Op2PtrInfo) const { 150263508Sdim return std::make_pair(SDValue(), SDValue()); 151263508Sdim } 152263508Sdim 153263508Sdim virtual std::pair<SDValue, SDValue> 154263508Sdim EmitTargetCodeForStrlen(SelectionDAG &DAG, SDLoc DL, SDValue Chain, 155263508Sdim SDValue Src, MachinePointerInfo SrcPtrInfo) const { 156263508Sdim return std::make_pair(SDValue(), SDValue()); 157263508Sdim } 158263508Sdim 159263508Sdim virtual std::pair<SDValue, SDValue> 160263508Sdim EmitTargetCodeForStrnlen(SelectionDAG &DAG, SDLoc DL, SDValue Chain, 161263508Sdim SDValue Src, SDValue MaxLength, 162263508Sdim MachinePointerInfo SrcPtrInfo) const { 163263508Sdim return std::make_pair(SDValue(), SDValue()); 164263508Sdim } 165207618Srdivacky}; 166207618Srdivacky 167207618Srdivacky} // end llvm namespace 168207618Srdivacky 169207618Srdivacky#endif 170