mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
reimplement memcpy/memmove/memset lowering to use MachinePointerInfo
instead of srcvalue/offset pairs. This corrects SV info for mem operations whose size is > 32-bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114401 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
40a858f6e7
commit
e72f2027e9
@ -542,17 +542,17 @@ public:
|
||||
|
||||
SDValue getMemcpy(SDValue Chain, DebugLoc dl, SDValue Dst, SDValue Src,
|
||||
SDValue Size, unsigned Align, bool isVol, bool AlwaysInline,
|
||||
const Value *DstSV, uint64_t DstSVOff,
|
||||
const Value *SrcSV, uint64_t SrcSVOff);
|
||||
MachinePointerInfo DstPtrInfo,
|
||||
MachinePointerInfo SrcPtrInfo);
|
||||
|
||||
SDValue getMemmove(SDValue Chain, DebugLoc dl, SDValue Dst, SDValue Src,
|
||||
SDValue Size, unsigned Align, bool isVol,
|
||||
const Value *DstSV, uint64_t DstOSVff,
|
||||
const Value *SrcSV, uint64_t SrcSVOff);
|
||||
MachinePointerInfo DstPtrInfo,
|
||||
MachinePointerInfo SrcPtrInfo);
|
||||
|
||||
SDValue getMemset(SDValue Chain, DebugLoc dl, SDValue Dst, SDValue Src,
|
||||
SDValue Size, unsigned Align, bool isVol,
|
||||
const Value *DstSV, uint64_t DstSVOff);
|
||||
MachinePointerInfo DstPtrInfo);
|
||||
|
||||
/// getSetCC - Helper function to make it easier to build SetCC's if you just
|
||||
/// have an ISD::CondCode instead of an SDValue.
|
||||
@ -629,9 +629,16 @@ public:
|
||||
/// getLoad - Loads are not normal binary operators: their result type is not
|
||||
/// determined by their operands, and they produce a value AND a token chain.
|
||||
///
|
||||
SDValue getLoad(EVT VT, DebugLoc dl, SDValue Chain, SDValue Ptr,
|
||||
MachinePointerInfo PtrInfo, bool isVolatile,
|
||||
bool isNonTemporal, unsigned Alignment);
|
||||
SDValue getLoad(EVT VT, DebugLoc dl, SDValue Chain, SDValue Ptr,
|
||||
const Value *SV, int SVOffset, bool isVolatile,
|
||||
bool isNonTemporal, unsigned Alignment);
|
||||
SDValue getExtLoad(ISD::LoadExtType ExtType, EVT VT, DebugLoc dl,
|
||||
SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo,
|
||||
EVT MemVT, bool isVolatile,
|
||||
bool isNonTemporal, unsigned Alignment);
|
||||
SDValue getExtLoad(ISD::LoadExtType ExtType, EVT VT, DebugLoc dl,
|
||||
SDValue Chain, SDValue Ptr, const Value *SV,
|
||||
int SVOffset, EVT MemVT, bool isVolatile,
|
||||
|
@ -59,8 +59,8 @@ public:
|
||||
SDValue Op1, SDValue Op2,
|
||||
SDValue Op3, unsigned Align, bool isVolatile,
|
||||
bool AlwaysInline,
|
||||
const Value *DstSV, uint64_t DstOff,
|
||||
const Value *SrcSV, uint64_t SrcOff) const {
|
||||
MachinePointerInfo DstPtrInfo,
|
||||
MachinePointerInfo SrcPtrInfo) const {
|
||||
return SDValue();
|
||||
}
|
||||
|
||||
@ -75,8 +75,8 @@ public:
|
||||
SDValue Chain,
|
||||
SDValue Op1, SDValue Op2,
|
||||
SDValue Op3, unsigned Align, bool isVolatile,
|
||||
const Value *DstSV, uint64_t DstOff,
|
||||
const Value *SrcSV, uint64_t SrcOff) const {
|
||||
MachinePointerInfo DstPtrInfo,
|
||||
MachinePointerInfo SrcPtrInfo) const {
|
||||
return SDValue();
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ public:
|
||||
SDValue Chain,
|
||||
SDValue Op1, SDValue Op2,
|
||||
SDValue Op3, unsigned Align, bool isVolatile,
|
||||
const Value *DstSV, uint64_t DstOff) const {
|
||||
MachinePointerInfo DstPtrInfo) const {
|
||||
return SDValue();
|
||||
}
|
||||
};
|
||||
|
@ -3276,8 +3276,8 @@ static SDValue getMemcpyLoadsAndStores(SelectionDAG &DAG, DebugLoc dl,
|
||||
SDValue Src, uint64_t Size,
|
||||
unsigned Align, bool isVol,
|
||||
bool AlwaysInline,
|
||||
const Value *DstSV, uint64_t DstSVOff,
|
||||
const Value *SrcSV, uint64_t SrcSVOff) {
|
||||
MachinePointerInfo DstPtrInfo,
|
||||
MachinePointerInfo SrcPtrInfo) {
|
||||
// Turn a memcpy of undef to nop.
|
||||
if (Src.getOpcode() == ISD::UNDEF)
|
||||
return Chain;
|
||||
@ -3334,7 +3334,8 @@ static SDValue getMemcpyLoadsAndStores(SelectionDAG &DAG, DebugLoc dl,
|
||||
Value = getMemsetStringVal(VT, dl, DAG, TLI, Str, SrcOff);
|
||||
Store = DAG.getStore(Chain, dl, Value,
|
||||
getMemBasePlusOffset(Dst, DstOff, DAG),
|
||||
DstSV, DstSVOff + DstOff, isVol, false, Align);
|
||||
DstPtrInfo.getWithOffset(DstOff), isVol,
|
||||
false, Align);
|
||||
} else {
|
||||
// The type might not be legal for the target. This should only happen
|
||||
// if the type is smaller than a legal type, as on PPC, so the right
|
||||
@ -3345,12 +3346,12 @@ static SDValue getMemcpyLoadsAndStores(SelectionDAG &DAG, DebugLoc dl,
|
||||
assert(NVT.bitsGE(VT));
|
||||
Value = DAG.getExtLoad(ISD::EXTLOAD, NVT, dl, Chain,
|
||||
getMemBasePlusOffset(Src, SrcOff, DAG),
|
||||
SrcSV, SrcSVOff + SrcOff, VT, isVol, false,
|
||||
SrcPtrInfo.getWithOffset(SrcOff), VT, isVol, false,
|
||||
MinAlign(SrcAlign, SrcOff));
|
||||
Store = DAG.getTruncStore(Chain, dl, Value,
|
||||
getMemBasePlusOffset(Dst, DstOff, DAG),
|
||||
DstSV, DstSVOff + DstOff, VT, isVol, false,
|
||||
Align);
|
||||
DstPtrInfo.getWithOffset(DstOff), VT, isVol,
|
||||
false, Align);
|
||||
}
|
||||
OutChains.push_back(Store);
|
||||
SrcOff += VTSize;
|
||||
@ -3366,8 +3367,8 @@ static SDValue getMemmoveLoadsAndStores(SelectionDAG &DAG, DebugLoc dl,
|
||||
SDValue Src, uint64_t Size,
|
||||
unsigned Align, bool isVol,
|
||||
bool AlwaysInline,
|
||||
const Value *DstSV, uint64_t DstSVOff,
|
||||
const Value *SrcSV, uint64_t SrcSVOff) {
|
||||
MachinePointerInfo DstPtrInfo,
|
||||
MachinePointerInfo SrcPtrInfo) {
|
||||
// Turn a memmove of undef to nop.
|
||||
if (Src.getOpcode() == ISD::UNDEF)
|
||||
return Chain;
|
||||
@ -3414,7 +3415,8 @@ static SDValue getMemmoveLoadsAndStores(SelectionDAG &DAG, DebugLoc dl,
|
||||
|
||||
Value = DAG.getLoad(VT, dl, Chain,
|
||||
getMemBasePlusOffset(Src, SrcOff, DAG),
|
||||
SrcSV, SrcSVOff + SrcOff, isVol, false, SrcAlign);
|
||||
SrcPtrInfo.getWithOffset(SrcOff), isVol,
|
||||
false, SrcAlign);
|
||||
LoadValues.push_back(Value);
|
||||
LoadChains.push_back(Value.getValue(1));
|
||||
SrcOff += VTSize;
|
||||
@ -3429,7 +3431,7 @@ static SDValue getMemmoveLoadsAndStores(SelectionDAG &DAG, DebugLoc dl,
|
||||
|
||||
Store = DAG.getStore(Chain, dl, LoadValues[i],
|
||||
getMemBasePlusOffset(Dst, DstOff, DAG),
|
||||
DstSV, DstSVOff + DstOff, isVol, false, Align);
|
||||
DstPtrInfo.getWithOffset(DstOff), isVol, false, Align);
|
||||
OutChains.push_back(Store);
|
||||
DstOff += VTSize;
|
||||
}
|
||||
@ -3442,7 +3444,7 @@ static SDValue getMemsetStores(SelectionDAG &DAG, DebugLoc dl,
|
||||
SDValue Chain, SDValue Dst,
|
||||
SDValue Src, uint64_t Size,
|
||||
unsigned Align, bool isVol,
|
||||
const Value *DstSV, uint64_t DstSVOff) {
|
||||
MachinePointerInfo DstPtrInfo) {
|
||||
// Turn a memset of undef to nop.
|
||||
if (Src.getOpcode() == ISD::UNDEF)
|
||||
return Chain;
|
||||
@ -3483,7 +3485,8 @@ static SDValue getMemsetStores(SelectionDAG &DAG, DebugLoc dl,
|
||||
SDValue Value = getMemsetValue(Src, VT, DAG, dl);
|
||||
SDValue Store = DAG.getStore(Chain, dl, Value,
|
||||
getMemBasePlusOffset(Dst, DstOff, DAG),
|
||||
DstSV, DstSVOff + DstOff, isVol, false, 0);
|
||||
DstPtrInfo.getWithOffset(DstOff),
|
||||
isVol, false, 0);
|
||||
OutChains.push_back(Store);
|
||||
DstOff += VTSize;
|
||||
}
|
||||
@ -3495,8 +3498,8 @@ static SDValue getMemsetStores(SelectionDAG &DAG, DebugLoc dl,
|
||||
SDValue SelectionDAG::getMemcpy(SDValue Chain, DebugLoc dl, SDValue Dst,
|
||||
SDValue Src, SDValue Size,
|
||||
unsigned Align, bool isVol, bool AlwaysInline,
|
||||
const Value *DstSV, uint64_t DstSVOff,
|
||||
const Value *SrcSV, uint64_t SrcSVOff) {
|
||||
MachinePointerInfo DstPtrInfo,
|
||||
MachinePointerInfo SrcPtrInfo) {
|
||||
|
||||
// Check to see if we should lower the memcpy to loads and stores first.
|
||||
// For cases within the target-specified limits, this is the best choice.
|
||||
@ -3508,7 +3511,7 @@ SDValue SelectionDAG::getMemcpy(SDValue Chain, DebugLoc dl, SDValue Dst,
|
||||
|
||||
SDValue Result = getMemcpyLoadsAndStores(*this, dl, Chain, Dst, Src,
|
||||
ConstantSize->getZExtValue(),Align,
|
||||
isVol, false, DstSV, DstSVOff, SrcSV, SrcSVOff);
|
||||
isVol, false, DstPtrInfo, SrcPtrInfo);
|
||||
if (Result.getNode())
|
||||
return Result;
|
||||
}
|
||||
@ -3518,7 +3521,7 @@ SDValue SelectionDAG::getMemcpy(SDValue Chain, DebugLoc dl, SDValue Dst,
|
||||
SDValue Result =
|
||||
TSI.EmitTargetCodeForMemcpy(*this, dl, Chain, Dst, Src, Size, Align,
|
||||
isVol, AlwaysInline,
|
||||
DstSV, DstSVOff, SrcSV, SrcSVOff);
|
||||
DstPtrInfo, SrcPtrInfo);
|
||||
if (Result.getNode())
|
||||
return Result;
|
||||
|
||||
@ -3528,7 +3531,7 @@ SDValue SelectionDAG::getMemcpy(SDValue Chain, DebugLoc dl, SDValue Dst,
|
||||
assert(ConstantSize && "AlwaysInline requires a constant size!");
|
||||
return getMemcpyLoadsAndStores(*this, dl, Chain, Dst, Src,
|
||||
ConstantSize->getZExtValue(), Align, isVol,
|
||||
true, DstSV, DstSVOff, SrcSV, SrcSVOff);
|
||||
true, DstPtrInfo, SrcPtrInfo);
|
||||
}
|
||||
|
||||
// FIXME: If the memcpy is volatile (isVol), lowering it to a plain libc
|
||||
@ -3559,8 +3562,8 @@ SDValue SelectionDAG::getMemcpy(SDValue Chain, DebugLoc dl, SDValue Dst,
|
||||
SDValue SelectionDAG::getMemmove(SDValue Chain, DebugLoc dl, SDValue Dst,
|
||||
SDValue Src, SDValue Size,
|
||||
unsigned Align, bool isVol,
|
||||
const Value *DstSV, uint64_t DstSVOff,
|
||||
const Value *SrcSV, uint64_t SrcSVOff) {
|
||||
MachinePointerInfo DstPtrInfo,
|
||||
MachinePointerInfo SrcPtrInfo) {
|
||||
|
||||
// Check to see if we should lower the memmove to loads and stores first.
|
||||
// For cases within the target-specified limits, this is the best choice.
|
||||
@ -3573,7 +3576,7 @@ SDValue SelectionDAG::getMemmove(SDValue Chain, DebugLoc dl, SDValue Dst,
|
||||
SDValue Result =
|
||||
getMemmoveLoadsAndStores(*this, dl, Chain, Dst, Src,
|
||||
ConstantSize->getZExtValue(), Align, isVol,
|
||||
false, DstSV, DstSVOff, SrcSV, SrcSVOff);
|
||||
false, DstPtrInfo, SrcPtrInfo);
|
||||
if (Result.getNode())
|
||||
return Result;
|
||||
}
|
||||
@ -3582,7 +3585,7 @@ SDValue SelectionDAG::getMemmove(SDValue Chain, DebugLoc dl, SDValue Dst,
|
||||
// code. If the target chooses to do this, this is the next best.
|
||||
SDValue Result =
|
||||
TSI.EmitTargetCodeForMemmove(*this, dl, Chain, Dst, Src, Size, Align, isVol,
|
||||
DstSV, DstSVOff, SrcSV, SrcSVOff);
|
||||
DstPtrInfo, SrcPtrInfo);
|
||||
if (Result.getNode())
|
||||
return Result;
|
||||
|
||||
@ -3611,7 +3614,7 @@ SDValue SelectionDAG::getMemmove(SDValue Chain, DebugLoc dl, SDValue Dst,
|
||||
SDValue SelectionDAG::getMemset(SDValue Chain, DebugLoc dl, SDValue Dst,
|
||||
SDValue Src, SDValue Size,
|
||||
unsigned Align, bool isVol,
|
||||
const Value *DstSV, uint64_t DstSVOff) {
|
||||
MachinePointerInfo DstPtrInfo) {
|
||||
|
||||
// Check to see if we should lower the memset to stores first.
|
||||
// For cases within the target-specified limits, this is the best choice.
|
||||
@ -3623,7 +3626,7 @@ SDValue SelectionDAG::getMemset(SDValue Chain, DebugLoc dl, SDValue Dst,
|
||||
|
||||
SDValue Result =
|
||||
getMemsetStores(*this, dl, Chain, Dst, Src, ConstantSize->getZExtValue(),
|
||||
Align, isVol, DstSV, DstSVOff);
|
||||
Align, isVol, DstPtrInfo);
|
||||
|
||||
if (Result.getNode())
|
||||
return Result;
|
||||
@ -3633,7 +3636,7 @@ SDValue SelectionDAG::getMemset(SDValue Chain, DebugLoc dl, SDValue Dst,
|
||||
// code. If the target chooses to do this, this is the next best.
|
||||
SDValue Result =
|
||||
TSI.EmitTargetCodeForMemset(*this, dl, Chain, Dst, Src, Size, Align, isVol,
|
||||
DstSV, DstSVOff);
|
||||
DstPtrInfo);
|
||||
if (Result.getNode())
|
||||
return Result;
|
||||
|
||||
@ -3954,6 +3957,15 @@ SDValue SelectionDAG::getLoad(EVT VT, DebugLoc dl,
|
||||
SV, SVOffset, VT, isVolatile, isNonTemporal, Alignment);
|
||||
}
|
||||
|
||||
SDValue SelectionDAG::getLoad(EVT VT, DebugLoc dl,
|
||||
SDValue Chain, SDValue Ptr,
|
||||
MachinePointerInfo PtrInfo,
|
||||
bool isVolatile, bool isNonTemporal,
|
||||
unsigned Alignment) {
|
||||
SDValue Undef = getUNDEF(Ptr.getValueType());
|
||||
return getLoad(ISD::UNINDEXED, ISD::NON_EXTLOAD, VT, dl, Chain, Ptr, Undef,
|
||||
PtrInfo, VT, isVolatile, isNonTemporal, Alignment);
|
||||
}
|
||||
SDValue SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, EVT VT, DebugLoc dl,
|
||||
SDValue Chain, SDValue Ptr,
|
||||
const Value *SV,
|
||||
@ -3965,6 +3977,17 @@ SDValue SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, EVT VT, DebugLoc dl,
|
||||
SV, SVOffset, MemVT, isVolatile, isNonTemporal, Alignment);
|
||||
}
|
||||
|
||||
SDValue SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, EVT VT, DebugLoc dl,
|
||||
SDValue Chain, SDValue Ptr,
|
||||
MachinePointerInfo PtrInfo, EVT MemVT,
|
||||
bool isVolatile, bool isNonTemporal,
|
||||
unsigned Alignment) {
|
||||
SDValue Undef = getUNDEF(Ptr.getValueType());
|
||||
return getLoad(ISD::UNINDEXED, ExtType, VT, dl, Chain, Ptr, Undef,
|
||||
PtrInfo, MemVT, isVolatile, isNonTemporal, Alignment);
|
||||
}
|
||||
|
||||
|
||||
SDValue
|
||||
SelectionDAG::getIndexedLoad(SDValue OrigLoad, DebugLoc dl, SDValue Base,
|
||||
SDValue Offset, ISD::MemIndexedMode AM) {
|
||||
|
@ -4014,7 +4014,8 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
|
||||
unsigned Align = cast<ConstantInt>(I.getArgOperand(3))->getZExtValue();
|
||||
bool isVol = cast<ConstantInt>(I.getArgOperand(4))->getZExtValue();
|
||||
DAG.setRoot(DAG.getMemcpy(getRoot(), dl, Op1, Op2, Op3, Align, isVol, false,
|
||||
I.getArgOperand(0), 0, I.getArgOperand(1), 0));
|
||||
MachinePointerInfo(I.getArgOperand(0)),
|
||||
MachinePointerInfo(I.getArgOperand(1))));
|
||||
return 0;
|
||||
}
|
||||
case Intrinsic::memset: {
|
||||
@ -4029,7 +4030,7 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
|
||||
unsigned Align = cast<ConstantInt>(I.getArgOperand(3))->getZExtValue();
|
||||
bool isVol = cast<ConstantInt>(I.getArgOperand(4))->getZExtValue();
|
||||
DAG.setRoot(DAG.getMemset(getRoot(), dl, Op1, Op2, Op3, Align, isVol,
|
||||
I.getArgOperand(0), 0));
|
||||
MachinePointerInfo(I.getArgOperand(0))));
|
||||
return 0;
|
||||
}
|
||||
case Intrinsic::memmove: {
|
||||
@ -4054,13 +4055,14 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
|
||||
if (AA->alias(I.getArgOperand(0), Size, I.getArgOperand(1), Size) ==
|
||||
AliasAnalysis::NoAlias) {
|
||||
DAG.setRoot(DAG.getMemcpy(getRoot(), dl, Op1, Op2, Op3, Align, isVol,
|
||||
false, I.getArgOperand(0), 0,
|
||||
I.getArgOperand(1), 0));
|
||||
false, MachinePointerInfo(I.getArgOperand(0)),
|
||||
MachinePointerInfo(I.getArgOperand(1))));
|
||||
return 0;
|
||||
}
|
||||
|
||||
DAG.setRoot(DAG.getMemmove(getRoot(), dl, Op1, Op2, Op3, Align, isVol,
|
||||
I.getArgOperand(0), 0, I.getArgOperand(1), 0));
|
||||
MachinePointerInfo(I.getArgOperand(0)),
|
||||
MachinePointerInfo(I.getArgOperand(1))));
|
||||
return 0;
|
||||
}
|
||||
case Intrinsic::dbg_declare: {
|
||||
|
@ -928,7 +928,7 @@ CreateCopyOfByValArgument(SDValue Src, SDValue Dst, SDValue Chain,
|
||||
SDValue SizeNode = DAG.getConstant(Flags.getByValSize(), MVT::i32);
|
||||
return DAG.getMemcpy(Chain, dl, Dst, Src, SizeNode, Flags.getByValAlign(),
|
||||
/*isVolatile=*/false, /*AlwaysInline=*/false,
|
||||
NULL, 0, NULL, 0);
|
||||
MachinePointerInfo(0), MachinePointerInfo(0));
|
||||
}
|
||||
|
||||
/// LowerMemOpCallTo - Store the argument to the stack.
|
||||
|
@ -29,10 +29,8 @@ ARMSelectionDAGInfo::EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
|
||||
SDValue Dst, SDValue Src,
|
||||
SDValue Size, unsigned Align,
|
||||
bool isVolatile, bool AlwaysInline,
|
||||
const Value *DstSV,
|
||||
uint64_t DstSVOff,
|
||||
const Value *SrcSV,
|
||||
uint64_t SrcSVOff) const {
|
||||
MachinePointerInfo DstPtrInfo,
|
||||
MachinePointerInfo SrcPtrInfo) const {
|
||||
// Do repeated 4-byte loads and stores. To be improved.
|
||||
// This requires 4-byte alignment.
|
||||
if ((Align & 3) != 0)
|
||||
@ -66,7 +64,8 @@ ARMSelectionDAGInfo::EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
|
||||
Loads[i] = DAG.getLoad(VT, dl, Chain,
|
||||
DAG.getNode(ISD::ADD, dl, MVT::i32, Src,
|
||||
DAG.getConstant(SrcOff, MVT::i32)),
|
||||
SrcSV, SrcSVOff + SrcOff, isVolatile, false, 0);
|
||||
SrcPtrInfo.getWithOffset(SrcOff), isVolatile,
|
||||
false, 0);
|
||||
TFOps[i] = Loads[i].getValue(1);
|
||||
SrcOff += VTSize;
|
||||
}
|
||||
@ -77,7 +76,8 @@ ARMSelectionDAGInfo::EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
|
||||
TFOps[i] = DAG.getStore(Chain, dl, Loads[i],
|
||||
DAG.getNode(ISD::ADD, dl, MVT::i32, Dst,
|
||||
DAG.getConstant(DstOff, MVT::i32)),
|
||||
DstSV, DstSVOff + DstOff, isVolatile, false, 0);
|
||||
DstPtrInfo.getWithOffset(DstOff),
|
||||
isVolatile, false, 0);
|
||||
DstOff += VTSize;
|
||||
}
|
||||
Chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other, &TFOps[0], i);
|
||||
@ -103,7 +103,7 @@ ARMSelectionDAGInfo::EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
|
||||
Loads[i] = DAG.getLoad(VT, dl, Chain,
|
||||
DAG.getNode(ISD::ADD, dl, MVT::i32, Src,
|
||||
DAG.getConstant(SrcOff, MVT::i32)),
|
||||
SrcSV, SrcSVOff + SrcOff, false, false, 0);
|
||||
SrcPtrInfo.getWithOffset(SrcOff), false, false, 0);
|
||||
TFOps[i] = Loads[i].getValue(1);
|
||||
++i;
|
||||
SrcOff += VTSize;
|
||||
@ -125,7 +125,7 @@ ARMSelectionDAGInfo::EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
|
||||
TFOps[i] = DAG.getStore(Chain, dl, Loads[i],
|
||||
DAG.getNode(ISD::ADD, dl, MVT::i32, Dst,
|
||||
DAG.getConstant(DstOff, MVT::i32)),
|
||||
DstSV, DstSVOff + DstOff, false, false, 0);
|
||||
DstPtrInfo.getWithOffset(DstOff), false, false, 0);
|
||||
++i;
|
||||
DstOff += VTSize;
|
||||
BytesLeft -= VTSize;
|
||||
|
@ -33,10 +33,8 @@ public:
|
||||
SDValue Dst, SDValue Src,
|
||||
SDValue Size, unsigned Align,
|
||||
bool isVolatile, bool AlwaysInline,
|
||||
const Value *DstSV,
|
||||
uint64_t DstSVOff,
|
||||
const Value *SrcSV,
|
||||
uint64_t SrcSVOff) const;
|
||||
MachinePointerInfo DstPtrInfo,
|
||||
MachinePointerInfo SrcPtrInfo) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -2397,7 +2397,8 @@ CreateCopyOfByValArgument(SDValue Src, SDValue Dst, SDValue Chain,
|
||||
DebugLoc dl) {
|
||||
SDValue SizeNode = DAG.getConstant(Flags.getByValSize(), MVT::i32);
|
||||
return DAG.getMemcpy(Chain, dl, Dst, Src, SizeNode, Flags.getByValAlign(),
|
||||
false, false, NULL, 0, NULL, 0);
|
||||
false, false, MachinePointerInfo(0),
|
||||
MachinePointerInfo(0));
|
||||
}
|
||||
|
||||
/// LowerMemOpCallTo - Store the argument to the stack or remember it in case of
|
||||
|
@ -1534,10 +1534,11 @@ static SDValue
|
||||
CreateCopyOfByValArgument(SDValue Src, SDValue Dst, SDValue Chain,
|
||||
ISD::ArgFlagsTy Flags, SelectionDAG &DAG,
|
||||
DebugLoc dl) {
|
||||
SDValue SizeNode = DAG.getConstant(Flags.getByValSize(), MVT::i32);
|
||||
SDValue SizeNode = DAG.getConstant(Flags.getByValSize(), MVT::i32);
|
||||
|
||||
return DAG.getMemcpy(Chain, dl, Dst, Src, SizeNode, Flags.getByValAlign(),
|
||||
/*isVolatile*/false, /*AlwaysInline=*/true,
|
||||
NULL, 0, NULL, 0);
|
||||
MachinePointerInfo(0), MachinePointerInfo(0));
|
||||
}
|
||||
|
||||
/// IsTailCallConvention - Return true if the calling convention is one that
|
||||
@ -7607,11 +7608,12 @@ SDValue X86TargetLowering::LowerVACOPY(SDValue Op, SelectionDAG &DAG) const {
|
||||
SDValue SrcPtr = Op.getOperand(2);
|
||||
const Value *DstSV = cast<SrcValueSDNode>(Op.getOperand(3))->getValue();
|
||||
const Value *SrcSV = cast<SrcValueSDNode>(Op.getOperand(4))->getValue();
|
||||
DebugLoc dl = Op.getDebugLoc();
|
||||
DebugLoc DL = Op.getDebugLoc();
|
||||
|
||||
return DAG.getMemcpy(Chain, dl, DstPtr, SrcPtr,
|
||||
return DAG.getMemcpy(Chain, DL, DstPtr, SrcPtr,
|
||||
DAG.getIntPtrConstant(24), 8, /*isVolatile*/false,
|
||||
false, DstSV, 0, SrcSV, 0);
|
||||
false,
|
||||
MachinePointerInfo(DstSV), MachinePointerInfo(SrcSV));
|
||||
}
|
||||
|
||||
SDValue
|
||||
|
@ -32,8 +32,7 @@ X86SelectionDAGInfo::EmitTargetCodeForMemset(SelectionDAG &DAG, DebugLoc dl,
|
||||
SDValue Dst, SDValue Src,
|
||||
SDValue Size, unsigned Align,
|
||||
bool isVolatile,
|
||||
const Value *DstSV,
|
||||
uint64_t DstSVOff) const {
|
||||
MachinePointerInfo DstPtrInfo) const {
|
||||
ConstantSDNode *ConstantSize = dyn_cast<ConstantSDNode>(Size);
|
||||
|
||||
// If not DWORD aligned or size is more than the threshold, call the library.
|
||||
@ -161,7 +160,7 @@ X86SelectionDAGInfo::EmitTargetCodeForMemset(SelectionDAG &DAG, DebugLoc dl,
|
||||
DAG.getConstant(Offset, AddrVT)),
|
||||
Src,
|
||||
DAG.getConstant(BytesLeft, SizeVT),
|
||||
Align, isVolatile, DstSV, DstSVOff + Offset);
|
||||
Align, isVolatile, DstPtrInfo.getWithOffset(Offset));
|
||||
}
|
||||
|
||||
// TODO: Use a Tokenfactor, as in memcpy, instead of a single chain.
|
||||
@ -173,10 +172,8 @@ X86SelectionDAGInfo::EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
|
||||
SDValue Chain, SDValue Dst, SDValue Src,
|
||||
SDValue Size, unsigned Align,
|
||||
bool isVolatile, bool AlwaysInline,
|
||||
const Value *DstSV,
|
||||
uint64_t DstSVOff,
|
||||
const Value *SrcSV,
|
||||
uint64_t SrcSVOff) const {
|
||||
MachinePointerInfo DstPtrInfo,
|
||||
MachinePointerInfo SrcPtrInfo) const {
|
||||
// This requires the copy size to be a constant, preferrably
|
||||
// within a subtarget-specific limit.
|
||||
ConstantSDNode *ConstantSize = dyn_cast<ConstantSDNode>(Size);
|
||||
@ -234,8 +231,8 @@ X86SelectionDAGInfo::EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
|
||||
DAG.getConstant(Offset, SrcVT)),
|
||||
DAG.getConstant(BytesLeft, SizeVT),
|
||||
Align, isVolatile, AlwaysInline,
|
||||
DstSV, DstSVOff + Offset,
|
||||
SrcSV, SrcSVOff + Offset));
|
||||
DstPtrInfo.getWithOffset(Offset),
|
||||
SrcPtrInfo.getWithOffset(Offset)));
|
||||
}
|
||||
|
||||
return DAG.getNode(ISD::TokenFactor, dl, MVT::Other,
|
||||
|
@ -39,8 +39,7 @@ public:
|
||||
SDValue Dst, SDValue Src,
|
||||
SDValue Size, unsigned Align,
|
||||
bool isVolatile,
|
||||
const Value *DstSV,
|
||||
uint64_t DstSVOff) const;
|
||||
MachinePointerInfo DstPtrInfo) const;
|
||||
|
||||
virtual
|
||||
SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
|
||||
@ -48,10 +47,8 @@ public:
|
||||
SDValue Dst, SDValue Src,
|
||||
SDValue Size, unsigned Align,
|
||||
bool isVolatile, bool AlwaysInline,
|
||||
const Value *DstSV,
|
||||
uint64_t DstSVOff,
|
||||
const Value *SrcSV,
|
||||
uint64_t SrcSVOff) const;
|
||||
MachinePointerInfo DstPtrInfo,
|
||||
MachinePointerInfo SrcPtrInfo) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1443,9 +1443,8 @@ SDValue XCoreTargetLowering::PerformDAGCombine(SDNode *N,
|
||||
return DAG.getMemmove(Chain, dl, ST->getBasePtr(),
|
||||
LD->getBasePtr(),
|
||||
DAG.getConstant(StoreBits/8, MVT::i32),
|
||||
Alignment, false, ST->getSrcValue(),
|
||||
ST->getSrcValueOffset(), LD->getSrcValue(),
|
||||
LD->getSrcValueOffset());
|
||||
Alignment, false, ST->getPointerInfo(),
|
||||
LD->getPointerInfo());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user