19 #define DEBUG_TYPE "arm-selectiondag-info" 33 if (std::strncmp(TLI->getLibcallName(LC),
"__aeabi", 7) != 0)
47 AEABILibcall = AEABI_MEMCPY;
50 AEABILibcall = AEABI_MEMMOVE;
53 AEABILibcall = AEABI_MEMSET;
55 if (ConstantSrc->getZExtValue() == 0)
56 AEABILibcall = AEABI_MEMCLR;
69 AlignVariant = ALIGN8;
70 else if ((Align & 3) == 0)
71 AlignVariant = ALIGN4;
73 AlignVariant = ALIGN1;
79 Args.push_back(Entry);
80 if (AEABILibcall == AEABI_MEMCLR) {
82 Args.push_back(Entry);
83 }
else if (AEABILibcall == AEABI_MEMSET) {
88 Args.push_back(Entry);
99 Args.push_back(Entry);
102 Args.push_back(Entry);
105 Args.push_back(Entry);
108 char const *FunctionNames[4][3] = {
109 {
"__aeabi_memcpy",
"__aeabi_memcpy4",
"__aeabi_memcpy8" },
110 {
"__aeabi_memmove",
"__aeabi_memmove4",
"__aeabi_memmove8" },
111 {
"__aeabi_memset",
"__aeabi_memset4",
"__aeabi_memset8" },
112 {
"__aeabi_memclr",
"__aeabi_memclr4",
"__aeabi_memclr8" }
123 std::pair<SDValue,SDValue> CallResult = TLI->LowerCallTo(CLI);
125 return CallResult.second;
136 if ((Align & 3) != 0)
149 unsigned BytesLeft = SizeVal & 3;
150 unsigned NumMemOps = SizeVal >> 2;
151 unsigned EmittedNumMemOps = 0;
156 const unsigned MaxLoadsInLDM = Subtarget.
isThumb1Only() ? 4 : 6;
159 uint64_t SrcOff = 0, DstOff = 0;
170 unsigned NumMEMCPYs = (NumMemOps + MaxLoadsInLDM - 1) / MaxLoadsInLDM;
180 for (
unsigned I = 0;
I != NumMEMCPYs; ++
I) {
183 unsigned NextEmittedNumMemOps = NumMemOps * (
I + 1) / NumMEMCPYs;
184 unsigned NumRegs = NextEmittedNumMemOps - EmittedNumMemOps;
194 EmittedNumMemOps = NextEmittedNumMemOps;
201 auto getRemainingValueType = [](
unsigned BytesLeft) {
204 auto getRemainingSize = [](
unsigned BytesLeft) {
205 return (BytesLeft >= 2) ? 2 : 1;
208 unsigned BytesLeftSave = BytesLeft;
211 VT = getRemainingValueType(BytesLeft);
212 VTSize = getRemainingSize(BytesLeft);
213 Loads[i] = DAG.
getLoad(VT, dl, Chain,
226 BytesLeft = BytesLeftSave;
228 VT = getRemainingValueType(BytesLeft);
229 VTSize = getRemainingSize(BytesLeft);
230 TFOps[i] = DAG.
getStore(Chain, dl, Loads[i],
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
EVT getValueType() const
Return the ValueType of the referenced return value.
This class represents lattice values for constants.
const ARMTargetLowering * getTargetLowering() const override
Libcall
RTLIB::Libcall enum - This enum defines all of the runtime library calls the backend can emit...
SDValue EmitTargetCodeForMemmove(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVolatile, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const override
Emit target-specific code that performs a memmove.
CallLoweringInfo & setDebugLoc(const SDLoc &dl)
bool isThumb1Only() const
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
SDValue getExternalSymbol(const char *Sym, EVT VT)
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
CallLoweringInfo & setChain(SDValue InChain)
const DataLayout & getDataLayout() const
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
MachineFunction & getMachineFunction() const
unsigned getMaxInlineSizeThreshold() const
getMaxInlineSizeThreshold - Returns the maximum memset / memcpy size that still makes it profitable t...
Simple integer binary arithmetic operators.
bool bitsGT(EVT VT) const
Return true if this has more bits than VT.
IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns an integer type with size at least as big as that of a pointer in the given address space...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
static Type * getVoidTy(LLVMContext &C)
SDValue EmitSpecializedLibcall(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, RTLIB::Libcall LC) const
std::vector< ArgListEntry > ArgListTy
This structure contains all information that is necessary for lowering calls.
This class contains a discriminated union of information about pointers in memory operands...
SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, unsigned Alignment=0, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
Loads are not normal binary operators: their result type is not determined by their operands...
TokenFactor - This node takes multiple tokens as input and produces a single token result...
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
const Function & getFunction() const
Return the LLVM function that this machine code represents.
MachinePointerInfo getWithOffset(int64_t O) const
bool bitsLT(EVT VT) const
Return true if this has less bits than VT.
ZERO_EXTEND - Used for integer types, zeroing the new bits.
SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVolatile, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const override
Emit target-specific code that performs a memcpy.
static IntegerType * getInt32Ty(LLVMContext &C)
bool optForMinSize() const
Optimize this function for minimum size (-Oz).
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
SDValue getValue(unsigned R) const
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
static bool isVolatile(Instruction *Inst)
uint64_t getZExtValue() const
TRUNCATE - Completely drop the high bits.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
LLVMContext * getContext() const
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
CallLoweringInfo & setLibCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList)
SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Op1, SDValue Op2, SDValue Op3, unsigned Align, bool isVolatile, MachinePointerInfo DstPtrInfo) const override
Emit target-specific code that performs a memset.