19 #define DEBUG_TYPE "arm-selectiondag-info"
36 if (std::strncmp(TLI->getLibcallName(LC),
"__aeabi", 7) != 0)
50 AEABILibcall = AEABI_MEMCPY;
53 AEABILibcall = AEABI_MEMMOVE;
56 AEABILibcall = AEABI_MEMSET;
58 if (ConstantSrc->getZExtValue() == 0)
59 AEABILibcall = AEABI_MEMCLR;
72 AlignVariant = ALIGN8;
73 else if ((Align & 3) == 0)
74 AlignVariant = ALIGN4;
76 AlignVariant = ALIGN1;
82 Args.push_back(Entry);
83 if (AEABILibcall == AEABI_MEMCLR) {
85 Args.push_back(Entry);
86 }
else if (AEABILibcall == AEABI_MEMSET) {
91 Args.push_back(Entry);
102 Args.push_back(Entry);
105 Args.push_back(Entry);
108 Args.push_back(Entry);
111 char const *FunctionNames[4][3] = {
112 {
"__aeabi_memcpy",
"__aeabi_memcpy4",
"__aeabi_memcpy8" },
113 {
"__aeabi_memmove",
"__aeabi_memmove4",
"__aeabi_memmove8" },
114 {
"__aeabi_memset",
"__aeabi_memset4",
"__aeabi_memset8" },
115 {
"__aeabi_memclr",
"__aeabi_memclr4",
"__aeabi_memclr8" }
126 std::pair<SDValue,SDValue> CallResult = TLI->LowerCallTo(CLI);
128 return CallResult.second;
143 if ((Align & 3) != 0)
156 unsigned BytesLeft = SizeVal & 3;
157 unsigned NumMemOps = SizeVal >> 2;
158 unsigned EmittedNumMemOps = 0;
163 const unsigned MAX_LOADS_IN_LDM = Subtarget.
isThumb1Only() ? 4 : 6;
166 uint64_t SrcOff = 0, DstOff = 0;
171 while (EmittedNumMemOps < NumMemOps) {
173 i < MAX_LOADS_IN_LDM && EmittedNumMemOps + i < NumMemOps; ++i) {
174 Loads[i] = DAG.
getLoad(VT, dl, Chain,
186 i < MAX_LOADS_IN_LDM && EmittedNumMemOps + i < NumMemOps; ++i) {
187 TFOps[i] = DAG.
getStore(Chain, dl, Loads[i],
197 EmittedNumMemOps += i;
204 unsigned BytesLeftSave = BytesLeft;
207 if (BytesLeft >= 2) {
215 Loads[i] = DAG.
getLoad(VT, dl, Chain,
219 false,
false,
false, 0);
229 BytesLeft = BytesLeftSave;
231 if (BytesLeft >= 2) {
239 TFOps[i] = DAG.
getStore(Chain, dl, Loads[i],
CallLoweringInfo & setCallee(CallingConv::ID CC, Type *ResultType, SDValue Target, ArgListTy &&ArgsList, unsigned FixedArgs=-1)
SDValue getValue(unsigned R) const
LLVMContext * getContext() const
SDValue EmitTargetCodeForMemmove(SelectionDAG &DAG, SDLoc dl, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVolatile, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const override
EmitTargetCodeForMemmove - Emit target-specific code that performs a memmove.
CallLoweringInfo & setDebugLoc(SDLoc dl)
const ARMTargetLowering * getTargetLowering() const override
Libcall
RTLIB::Libcall enum - This enum defines all of the runtime library calls the backend can emit...
SDValue getLoad(EVT VT, SDLoc dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, bool isVolatile, bool isNonTemporal, bool isInvariant, unsigned Alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
Loads are not normal binary operators: their result type is not determined by their operands...
SDValue EmitSpecializedLibcall(SelectionDAG &DAG, SDLoc dl, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, RTLIB::Libcall LC) const
bool isThumb1Only() const
bool bitsLT(EVT VT) const
bitsLT - Return true if this has less bits than VT.
SDValue getExternalSymbol(const char *Sym, EVT VT)
SDValue getStore(SDValue Chain, SDLoc dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, bool isVolatile, bool isNonTemporal, unsigned Alignment, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
MachineFunction & getMachineFunction() const
CallLoweringInfo & setChain(SDValue InChain)
MachinePointerInfo getWithOffset(int64_t O) const
load Combine Adjacent Loads
Simple integer binary arithmetic operators.
const DataLayout & getDataLayout() const
static Type * getVoidTy(LLVMContext &C)
EVT - Extended Value Type.
std::vector< ArgListEntry > ArgListTy
This structure contains all information that is necessary for lowering calls.
MachinePointerInfo - This class contains a discriminated union of information about pointers in memor...
bool bitsGT(EVT VT) const
bitsGT - 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...
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...
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(NoStrictAlign), cl::values(clEnumValN(StrictAlign,"aarch64-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"aarch64-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
unsigned getMaxInlineSizeThreshold() const
getMaxInlineSizeThreshold - Returns the maximum memset / memcpy size that still makes it profitable t...
ZERO_EXTEND - Used for integer types, zeroing the new bits.
LLVM_ATTRIBUTE_UNUSED_RESULT std::enable_if< !is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
SDValue getNode(unsigned Opcode, SDLoc DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
static IntegerType * getInt32Ty(LLVMContext &C)
SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, SDLoc dl, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, unsigned Align, bool isVolatile, bool AlwaysInline, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const override
EmitTargetCodeForMemcpy - Emit target-specific code that performs a memcpy.
SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, SDLoc dl, SDValue Chain, SDValue Op1, SDValue Op2, SDValue Op3, unsigned Align, bool isVolatile, MachinePointerInfo DstPtrInfo) const override
EmitTargetCodeForMemset - Emit target-specific code that performs a memset.
EVT getValueType() const
Return the ValueType of the referenced return value.
SDValue getConstant(uint64_t Val, SDLoc DL, EVT VT, bool isTarget=false, bool isOpaque=false)
static bool isVolatile(Instruction *Inst)
TRUNCATE - Completely drop the high bits.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
uint64_t getZExtValue() const