18 #define DEBUG_TYPE "arm-selectiondag-info" 32 if (std::strncmp(TLI->getLibcallName(LC),
"__aeabi", 7) != 0)
46 AEABILibcall = AEABI_MEMCPY;
49 AEABILibcall = AEABI_MEMMOVE;
52 AEABILibcall = AEABI_MEMSET;
54 if (ConstantSrc->getZExtValue() == 0)
55 AEABILibcall = AEABI_MEMCLR;
68 AlignVariant = ALIGN8;
69 else if ((Align & 3) == 0)
70 AlignVariant = ALIGN4;
72 AlignVariant = ALIGN1;
78 Args.push_back(Entry);
79 if (AEABILibcall == AEABI_MEMCLR) {
81 Args.push_back(Entry);
82 }
else if (AEABILibcall == AEABI_MEMSET) {
87 Args.push_back(Entry);
98 Args.push_back(Entry);
101 Args.push_back(Entry);
104 Args.push_back(Entry);
107 char const *FunctionNames[4][3] = {
108 {
"__aeabi_memcpy",
"__aeabi_memcpy4",
"__aeabi_memcpy8" },
109 {
"__aeabi_memmove",
"__aeabi_memmove4",
"__aeabi_memmove8" },
110 {
"__aeabi_memset",
"__aeabi_memset4",
"__aeabi_memset8" },
111 {
"__aeabi_memclr",
"__aeabi_memclr4",
"__aeabi_memclr8" }
122 std::pair<SDValue,SDValue> CallResult = TLI->LowerCallTo(CLI);
124 return CallResult.second;
135 if ((Align & 3) != 0)
148 unsigned BytesLeft = SizeVal & 3;
149 unsigned NumMemOps = SizeVal >> 2;
150 unsigned EmittedNumMemOps = 0;
155 const unsigned MaxLoadsInLDM = Subtarget.
isThumb1Only() ? 4 : 6;
158 uint64_t SrcOff = 0, DstOff = 0;
169 unsigned NumMEMCPYs = (NumMemOps + MaxLoadsInLDM - 1) / MaxLoadsInLDM;
173 if (NumMEMCPYs > 1 && Subtarget.
hasMinSize()) {
179 for (
unsigned I = 0;
I != NumMEMCPYs; ++
I) {
182 unsigned NextEmittedNumMemOps = NumMemOps * (
I + 1) / NumMEMCPYs;
183 unsigned NumRegs = NextEmittedNumMemOps - EmittedNumMemOps;
193 EmittedNumMemOps = NextEmittedNumMemOps;
200 auto getRemainingValueType = [](
unsigned BytesLeft) {
203 auto getRemainingSize = [](
unsigned BytesLeft) {
204 return (BytesLeft >= 2) ? 2 : 1;
207 unsigned BytesLeftSave = BytesLeft;
210 VT = getRemainingValueType(BytesLeft);
211 VTSize = getRemainingSize(BytesLeft);
212 Loads[i] = DAG.
getLoad(VT, dl, Chain,
225 BytesLeft = BytesLeftSave;
227 VT = getRemainingValueType(BytesLeft);
228 VTSize = getRemainingSize(BytesLeft);
229 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.
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...
This struct is a compact representation of a valid (non-zero power of two) alignment.
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...
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)
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.