1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02: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.

llvm-svn: 114401
This commit is contained in:
Chris Lattner 2010-09-21 05:40:29 +00:00
parent b6d15db75c
commit f94de5bf46
12 changed files with 102 additions and 76 deletions

View File

@ -542,17 +542,17 @@ public:
SDValue getMemcpy(SDValue Chain, DebugLoc dl, SDValue Dst, SDValue Src, SDValue getMemcpy(SDValue Chain, DebugLoc dl, SDValue Dst, SDValue Src,
SDValue Size, unsigned Align, bool isVol, bool AlwaysInline, SDValue Size, unsigned Align, bool isVol, bool AlwaysInline,
const Value *DstSV, uint64_t DstSVOff, MachinePointerInfo DstPtrInfo,
const Value *SrcSV, uint64_t SrcSVOff); MachinePointerInfo SrcPtrInfo);
SDValue getMemmove(SDValue Chain, DebugLoc dl, SDValue Dst, SDValue Src, SDValue getMemmove(SDValue Chain, DebugLoc dl, SDValue Dst, SDValue Src,
SDValue Size, unsigned Align, bool isVol, SDValue Size, unsigned Align, bool isVol,
const Value *DstSV, uint64_t DstOSVff, MachinePointerInfo DstPtrInfo,
const Value *SrcSV, uint64_t SrcSVOff); MachinePointerInfo SrcPtrInfo);
SDValue getMemset(SDValue Chain, DebugLoc dl, SDValue Dst, SDValue Src, SDValue getMemset(SDValue Chain, DebugLoc dl, SDValue Dst, SDValue Src,
SDValue Size, unsigned Align, bool isVol, 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 /// getSetCC - Helper function to make it easier to build SetCC's if you just
/// have an ISD::CondCode instead of an SDValue. /// 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 /// 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. /// 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, SDValue getLoad(EVT VT, DebugLoc dl, SDValue Chain, SDValue Ptr,
const Value *SV, int SVOffset, bool isVolatile, const Value *SV, int SVOffset, bool isVolatile,
bool isNonTemporal, unsigned Alignment); 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 getExtLoad(ISD::LoadExtType ExtType, EVT VT, DebugLoc dl,
SDValue Chain, SDValue Ptr, const Value *SV, SDValue Chain, SDValue Ptr, const Value *SV,
int SVOffset, EVT MemVT, bool isVolatile, int SVOffset, EVT MemVT, bool isVolatile,

View File

@ -59,8 +59,8 @@ public:
SDValue Op1, SDValue Op2, SDValue Op1, SDValue Op2,
SDValue Op3, unsigned Align, bool isVolatile, SDValue Op3, unsigned Align, bool isVolatile,
bool AlwaysInline, bool AlwaysInline,
const Value *DstSV, uint64_t DstOff, MachinePointerInfo DstPtrInfo,
const Value *SrcSV, uint64_t SrcOff) const { MachinePointerInfo SrcPtrInfo) const {
return SDValue(); return SDValue();
} }
@ -75,8 +75,8 @@ public:
SDValue Chain, SDValue Chain,
SDValue Op1, SDValue Op2, SDValue Op1, SDValue Op2,
SDValue Op3, unsigned Align, bool isVolatile, SDValue Op3, unsigned Align, bool isVolatile,
const Value *DstSV, uint64_t DstOff, MachinePointerInfo DstPtrInfo,
const Value *SrcSV, uint64_t SrcOff) const { MachinePointerInfo SrcPtrInfo) const {
return SDValue(); return SDValue();
} }
@ -91,7 +91,7 @@ public:
SDValue Chain, SDValue Chain,
SDValue Op1, SDValue Op2, SDValue Op1, SDValue Op2,
SDValue Op3, unsigned Align, bool isVolatile, SDValue Op3, unsigned Align, bool isVolatile,
const Value *DstSV, uint64_t DstOff) const { MachinePointerInfo DstPtrInfo) const {
return SDValue(); return SDValue();
} }
}; };

View File

@ -3276,8 +3276,8 @@ static SDValue getMemcpyLoadsAndStores(SelectionDAG &DAG, DebugLoc dl,
SDValue Src, uint64_t Size, SDValue Src, uint64_t Size,
unsigned Align, bool isVol, unsigned Align, bool isVol,
bool AlwaysInline, bool AlwaysInline,
const Value *DstSV, uint64_t DstSVOff, MachinePointerInfo DstPtrInfo,
const Value *SrcSV, uint64_t SrcSVOff) { MachinePointerInfo SrcPtrInfo) {
// Turn a memcpy of undef to nop. // Turn a memcpy of undef to nop.
if (Src.getOpcode() == ISD::UNDEF) if (Src.getOpcode() == ISD::UNDEF)
return Chain; return Chain;
@ -3334,7 +3334,8 @@ static SDValue getMemcpyLoadsAndStores(SelectionDAG &DAG, DebugLoc dl,
Value = getMemsetStringVal(VT, dl, DAG, TLI, Str, SrcOff); Value = getMemsetStringVal(VT, dl, DAG, TLI, Str, SrcOff);
Store = DAG.getStore(Chain, dl, Value, Store = DAG.getStore(Chain, dl, Value,
getMemBasePlusOffset(Dst, DstOff, DAG), getMemBasePlusOffset(Dst, DstOff, DAG),
DstSV, DstSVOff + DstOff, isVol, false, Align); DstPtrInfo.getWithOffset(DstOff), isVol,
false, Align);
} else { } else {
// The type might not be legal for the target. This should only happen // 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 // 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)); assert(NVT.bitsGE(VT));
Value = DAG.getExtLoad(ISD::EXTLOAD, NVT, dl, Chain, Value = DAG.getExtLoad(ISD::EXTLOAD, NVT, dl, Chain,
getMemBasePlusOffset(Src, SrcOff, DAG), getMemBasePlusOffset(Src, SrcOff, DAG),
SrcSV, SrcSVOff + SrcOff, VT, isVol, false, SrcPtrInfo.getWithOffset(SrcOff), VT, isVol, false,
MinAlign(SrcAlign, SrcOff)); MinAlign(SrcAlign, SrcOff));
Store = DAG.getTruncStore(Chain, dl, Value, Store = DAG.getTruncStore(Chain, dl, Value,
getMemBasePlusOffset(Dst, DstOff, DAG), getMemBasePlusOffset(Dst, DstOff, DAG),
DstSV, DstSVOff + DstOff, VT, isVol, false, DstPtrInfo.getWithOffset(DstOff), VT, isVol,
Align); false, Align);
} }
OutChains.push_back(Store); OutChains.push_back(Store);
SrcOff += VTSize; SrcOff += VTSize;
@ -3366,8 +3367,8 @@ static SDValue getMemmoveLoadsAndStores(SelectionDAG &DAG, DebugLoc dl,
SDValue Src, uint64_t Size, SDValue Src, uint64_t Size,
unsigned Align, bool isVol, unsigned Align, bool isVol,
bool AlwaysInline, bool AlwaysInline,
const Value *DstSV, uint64_t DstSVOff, MachinePointerInfo DstPtrInfo,
const Value *SrcSV, uint64_t SrcSVOff) { MachinePointerInfo SrcPtrInfo) {
// Turn a memmove of undef to nop. // Turn a memmove of undef to nop.
if (Src.getOpcode() == ISD::UNDEF) if (Src.getOpcode() == ISD::UNDEF)
return Chain; return Chain;
@ -3414,7 +3415,8 @@ static SDValue getMemmoveLoadsAndStores(SelectionDAG &DAG, DebugLoc dl,
Value = DAG.getLoad(VT, dl, Chain, Value = DAG.getLoad(VT, dl, Chain,
getMemBasePlusOffset(Src, SrcOff, DAG), getMemBasePlusOffset(Src, SrcOff, DAG),
SrcSV, SrcSVOff + SrcOff, isVol, false, SrcAlign); SrcPtrInfo.getWithOffset(SrcOff), isVol,
false, SrcAlign);
LoadValues.push_back(Value); LoadValues.push_back(Value);
LoadChains.push_back(Value.getValue(1)); LoadChains.push_back(Value.getValue(1));
SrcOff += VTSize; SrcOff += VTSize;
@ -3429,7 +3431,7 @@ static SDValue getMemmoveLoadsAndStores(SelectionDAG &DAG, DebugLoc dl,
Store = DAG.getStore(Chain, dl, LoadValues[i], Store = DAG.getStore(Chain, dl, LoadValues[i],
getMemBasePlusOffset(Dst, DstOff, DAG), getMemBasePlusOffset(Dst, DstOff, DAG),
DstSV, DstSVOff + DstOff, isVol, false, Align); DstPtrInfo.getWithOffset(DstOff), isVol, false, Align);
OutChains.push_back(Store); OutChains.push_back(Store);
DstOff += VTSize; DstOff += VTSize;
} }
@ -3442,7 +3444,7 @@ static SDValue getMemsetStores(SelectionDAG &DAG, DebugLoc dl,
SDValue Chain, SDValue Dst, SDValue Chain, SDValue Dst,
SDValue Src, uint64_t Size, SDValue Src, uint64_t Size,
unsigned Align, bool isVol, unsigned Align, bool isVol,
const Value *DstSV, uint64_t DstSVOff) { MachinePointerInfo DstPtrInfo) {
// Turn a memset of undef to nop. // Turn a memset of undef to nop.
if (Src.getOpcode() == ISD::UNDEF) if (Src.getOpcode() == ISD::UNDEF)
return Chain; return Chain;
@ -3483,7 +3485,8 @@ static SDValue getMemsetStores(SelectionDAG &DAG, DebugLoc dl,
SDValue Value = getMemsetValue(Src, VT, DAG, dl); SDValue Value = getMemsetValue(Src, VT, DAG, dl);
SDValue Store = DAG.getStore(Chain, dl, Value, SDValue Store = DAG.getStore(Chain, dl, Value,
getMemBasePlusOffset(Dst, DstOff, DAG), getMemBasePlusOffset(Dst, DstOff, DAG),
DstSV, DstSVOff + DstOff, isVol, false, 0); DstPtrInfo.getWithOffset(DstOff),
isVol, false, 0);
OutChains.push_back(Store); OutChains.push_back(Store);
DstOff += VTSize; DstOff += VTSize;
} }
@ -3495,8 +3498,8 @@ static SDValue getMemsetStores(SelectionDAG &DAG, DebugLoc dl,
SDValue SelectionDAG::getMemcpy(SDValue Chain, DebugLoc dl, SDValue Dst, SDValue SelectionDAG::getMemcpy(SDValue Chain, DebugLoc dl, SDValue Dst,
SDValue Src, SDValue Size, SDValue Src, SDValue Size,
unsigned Align, bool isVol, bool AlwaysInline, unsigned Align, bool isVol, bool AlwaysInline,
const Value *DstSV, uint64_t DstSVOff, MachinePointerInfo DstPtrInfo,
const Value *SrcSV, uint64_t SrcSVOff) { MachinePointerInfo SrcPtrInfo) {
// Check to see if we should lower the memcpy to loads and stores first. // 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. // 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, SDValue Result = getMemcpyLoadsAndStores(*this, dl, Chain, Dst, Src,
ConstantSize->getZExtValue(),Align, ConstantSize->getZExtValue(),Align,
isVol, false, DstSV, DstSVOff, SrcSV, SrcSVOff); isVol, false, DstPtrInfo, SrcPtrInfo);
if (Result.getNode()) if (Result.getNode())
return Result; return Result;
} }
@ -3518,7 +3521,7 @@ SDValue SelectionDAG::getMemcpy(SDValue Chain, DebugLoc dl, SDValue Dst,
SDValue Result = SDValue Result =
TSI.EmitTargetCodeForMemcpy(*this, dl, Chain, Dst, Src, Size, Align, TSI.EmitTargetCodeForMemcpy(*this, dl, Chain, Dst, Src, Size, Align,
isVol, AlwaysInline, isVol, AlwaysInline,
DstSV, DstSVOff, SrcSV, SrcSVOff); DstPtrInfo, SrcPtrInfo);
if (Result.getNode()) if (Result.getNode())
return Result; return Result;
@ -3528,7 +3531,7 @@ SDValue SelectionDAG::getMemcpy(SDValue Chain, DebugLoc dl, SDValue Dst,
assert(ConstantSize && "AlwaysInline requires a constant size!"); assert(ConstantSize && "AlwaysInline requires a constant size!");
return getMemcpyLoadsAndStores(*this, dl, Chain, Dst, Src, return getMemcpyLoadsAndStores(*this, dl, Chain, Dst, Src,
ConstantSize->getZExtValue(), Align, isVol, 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 // 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 SelectionDAG::getMemmove(SDValue Chain, DebugLoc dl, SDValue Dst,
SDValue Src, SDValue Size, SDValue Src, SDValue Size,
unsigned Align, bool isVol, unsigned Align, bool isVol,
const Value *DstSV, uint64_t DstSVOff, MachinePointerInfo DstPtrInfo,
const Value *SrcSV, uint64_t SrcSVOff) { MachinePointerInfo SrcPtrInfo) {
// Check to see if we should lower the memmove to loads and stores first. // 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. // 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 = SDValue Result =
getMemmoveLoadsAndStores(*this, dl, Chain, Dst, Src, getMemmoveLoadsAndStores(*this, dl, Chain, Dst, Src,
ConstantSize->getZExtValue(), Align, isVol, ConstantSize->getZExtValue(), Align, isVol,
false, DstSV, DstSVOff, SrcSV, SrcSVOff); false, DstPtrInfo, SrcPtrInfo);
if (Result.getNode()) if (Result.getNode())
return Result; 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. // code. If the target chooses to do this, this is the next best.
SDValue Result = SDValue Result =
TSI.EmitTargetCodeForMemmove(*this, dl, Chain, Dst, Src, Size, Align, isVol, TSI.EmitTargetCodeForMemmove(*this, dl, Chain, Dst, Src, Size, Align, isVol,
DstSV, DstSVOff, SrcSV, SrcSVOff); DstPtrInfo, SrcPtrInfo);
if (Result.getNode()) if (Result.getNode())
return Result; 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 SelectionDAG::getMemset(SDValue Chain, DebugLoc dl, SDValue Dst,
SDValue Src, SDValue Size, SDValue Src, SDValue Size,
unsigned Align, bool isVol, unsigned Align, bool isVol,
const Value *DstSV, uint64_t DstSVOff) { MachinePointerInfo DstPtrInfo) {
// Check to see if we should lower the memset to stores first. // Check to see if we should lower the memset to stores first.
// For cases within the target-specified limits, this is the best choice. // 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 = SDValue Result =
getMemsetStores(*this, dl, Chain, Dst, Src, ConstantSize->getZExtValue(), getMemsetStores(*this, dl, Chain, Dst, Src, ConstantSize->getZExtValue(),
Align, isVol, DstSV, DstSVOff); Align, isVol, DstPtrInfo);
if (Result.getNode()) if (Result.getNode())
return Result; 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. // code. If the target chooses to do this, this is the next best.
SDValue Result = SDValue Result =
TSI.EmitTargetCodeForMemset(*this, dl, Chain, Dst, Src, Size, Align, isVol, TSI.EmitTargetCodeForMemset(*this, dl, Chain, Dst, Src, Size, Align, isVol,
DstSV, DstSVOff); DstPtrInfo);
if (Result.getNode()) if (Result.getNode())
return Result; return Result;
@ -3954,6 +3957,15 @@ SDValue SelectionDAG::getLoad(EVT VT, DebugLoc dl,
SV, SVOffset, VT, isVolatile, isNonTemporal, Alignment); 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 SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, EVT VT, DebugLoc dl,
SDValue Chain, SDValue Ptr, SDValue Chain, SDValue Ptr,
const Value *SV, const Value *SV,
@ -3965,6 +3977,17 @@ SDValue SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, EVT VT, DebugLoc dl,
SV, SVOffset, MemVT, isVolatile, isNonTemporal, Alignment); 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 SDValue
SelectionDAG::getIndexedLoad(SDValue OrigLoad, DebugLoc dl, SDValue Base, SelectionDAG::getIndexedLoad(SDValue OrigLoad, DebugLoc dl, SDValue Base,
SDValue Offset, ISD::MemIndexedMode AM) { SDValue Offset, ISD::MemIndexedMode AM) {

View File

@ -4014,7 +4014,8 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
unsigned Align = cast<ConstantInt>(I.getArgOperand(3))->getZExtValue(); unsigned Align = cast<ConstantInt>(I.getArgOperand(3))->getZExtValue();
bool isVol = cast<ConstantInt>(I.getArgOperand(4))->getZExtValue(); bool isVol = cast<ConstantInt>(I.getArgOperand(4))->getZExtValue();
DAG.setRoot(DAG.getMemcpy(getRoot(), dl, Op1, Op2, Op3, Align, isVol, false, 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; return 0;
} }
case Intrinsic::memset: { case Intrinsic::memset: {
@ -4029,7 +4030,7 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
unsigned Align = cast<ConstantInt>(I.getArgOperand(3))->getZExtValue(); unsigned Align = cast<ConstantInt>(I.getArgOperand(3))->getZExtValue();
bool isVol = cast<ConstantInt>(I.getArgOperand(4))->getZExtValue(); bool isVol = cast<ConstantInt>(I.getArgOperand(4))->getZExtValue();
DAG.setRoot(DAG.getMemset(getRoot(), dl, Op1, Op2, Op3, Align, isVol, DAG.setRoot(DAG.getMemset(getRoot(), dl, Op1, Op2, Op3, Align, isVol,
I.getArgOperand(0), 0)); MachinePointerInfo(I.getArgOperand(0))));
return 0; return 0;
} }
case Intrinsic::memmove: { 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) == if (AA->alias(I.getArgOperand(0), Size, I.getArgOperand(1), Size) ==
AliasAnalysis::NoAlias) { AliasAnalysis::NoAlias) {
DAG.setRoot(DAG.getMemcpy(getRoot(), dl, Op1, Op2, Op3, Align, isVol, DAG.setRoot(DAG.getMemcpy(getRoot(), dl, Op1, Op2, Op3, Align, isVol,
false, I.getArgOperand(0), 0, false, MachinePointerInfo(I.getArgOperand(0)),
I.getArgOperand(1), 0)); MachinePointerInfo(I.getArgOperand(1))));
return 0; return 0;
} }
DAG.setRoot(DAG.getMemmove(getRoot(), dl, Op1, Op2, Op3, Align, isVol, 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; return 0;
} }
case Intrinsic::dbg_declare: { case Intrinsic::dbg_declare: {

View File

@ -928,7 +928,7 @@ CreateCopyOfByValArgument(SDValue Src, SDValue Dst, SDValue Chain,
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(), return DAG.getMemcpy(Chain, dl, Dst, Src, SizeNode, Flags.getByValAlign(),
/*isVolatile=*/false, /*AlwaysInline=*/false, /*isVolatile=*/false, /*AlwaysInline=*/false,
NULL, 0, NULL, 0); MachinePointerInfo(0), MachinePointerInfo(0));
} }
/// LowerMemOpCallTo - Store the argument to the stack. /// LowerMemOpCallTo - Store the argument to the stack.

View File

@ -29,10 +29,8 @@ ARMSelectionDAGInfo::EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
SDValue Dst, SDValue Src, SDValue Dst, SDValue Src,
SDValue Size, unsigned Align, SDValue Size, unsigned Align,
bool isVolatile, bool AlwaysInline, bool isVolatile, bool AlwaysInline,
const Value *DstSV, MachinePointerInfo DstPtrInfo,
uint64_t DstSVOff, MachinePointerInfo SrcPtrInfo) const {
const Value *SrcSV,
uint64_t SrcSVOff) const {
// Do repeated 4-byte loads and stores. To be improved. // Do repeated 4-byte loads and stores. To be improved.
// This requires 4-byte alignment. // This requires 4-byte alignment.
if ((Align & 3) != 0) if ((Align & 3) != 0)
@ -66,7 +64,8 @@ ARMSelectionDAGInfo::EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
Loads[i] = DAG.getLoad(VT, dl, Chain, Loads[i] = DAG.getLoad(VT, dl, Chain,
DAG.getNode(ISD::ADD, dl, MVT::i32, Src, DAG.getNode(ISD::ADD, dl, MVT::i32, Src,
DAG.getConstant(SrcOff, MVT::i32)), DAG.getConstant(SrcOff, MVT::i32)),
SrcSV, SrcSVOff + SrcOff, isVolatile, false, 0); SrcPtrInfo.getWithOffset(SrcOff), isVolatile,
false, 0);
TFOps[i] = Loads[i].getValue(1); TFOps[i] = Loads[i].getValue(1);
SrcOff += VTSize; SrcOff += VTSize;
} }
@ -77,7 +76,8 @@ ARMSelectionDAGInfo::EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
TFOps[i] = DAG.getStore(Chain, dl, Loads[i], TFOps[i] = DAG.getStore(Chain, dl, Loads[i],
DAG.getNode(ISD::ADD, dl, MVT::i32, Dst, DAG.getNode(ISD::ADD, dl, MVT::i32, Dst,
DAG.getConstant(DstOff, MVT::i32)), DAG.getConstant(DstOff, MVT::i32)),
DstSV, DstSVOff + DstOff, isVolatile, false, 0); DstPtrInfo.getWithOffset(DstOff),
isVolatile, false, 0);
DstOff += VTSize; DstOff += VTSize;
} }
Chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other, &TFOps[0], i); 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, Loads[i] = DAG.getLoad(VT, dl, Chain,
DAG.getNode(ISD::ADD, dl, MVT::i32, Src, DAG.getNode(ISD::ADD, dl, MVT::i32, Src,
DAG.getConstant(SrcOff, MVT::i32)), DAG.getConstant(SrcOff, MVT::i32)),
SrcSV, SrcSVOff + SrcOff, false, false, 0); SrcPtrInfo.getWithOffset(SrcOff), false, false, 0);
TFOps[i] = Loads[i].getValue(1); TFOps[i] = Loads[i].getValue(1);
++i; ++i;
SrcOff += VTSize; SrcOff += VTSize;
@ -125,7 +125,7 @@ ARMSelectionDAGInfo::EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
TFOps[i] = DAG.getStore(Chain, dl, Loads[i], TFOps[i] = DAG.getStore(Chain, dl, Loads[i],
DAG.getNode(ISD::ADD, dl, MVT::i32, Dst, DAG.getNode(ISD::ADD, dl, MVT::i32, Dst,
DAG.getConstant(DstOff, MVT::i32)), DAG.getConstant(DstOff, MVT::i32)),
DstSV, DstSVOff + DstOff, false, false, 0); DstPtrInfo.getWithOffset(DstOff), false, false, 0);
++i; ++i;
DstOff += VTSize; DstOff += VTSize;
BytesLeft -= VTSize; BytesLeft -= VTSize;

View File

@ -33,10 +33,8 @@ public:
SDValue Dst, SDValue Src, SDValue Dst, SDValue Src,
SDValue Size, unsigned Align, SDValue Size, unsigned Align,
bool isVolatile, bool AlwaysInline, bool isVolatile, bool AlwaysInline,
const Value *DstSV, MachinePointerInfo DstPtrInfo,
uint64_t DstSVOff, MachinePointerInfo SrcPtrInfo) const;
const Value *SrcSV,
uint64_t SrcSVOff) const;
}; };
} }

View File

@ -2397,7 +2397,8 @@ CreateCopyOfByValArgument(SDValue Src, SDValue Dst, SDValue Chain,
DebugLoc dl) { 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(), 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 /// LowerMemOpCallTo - Store the argument to the stack or remember it in case of

View File

@ -1534,10 +1534,11 @@ static SDValue
CreateCopyOfByValArgument(SDValue Src, SDValue Dst, SDValue Chain, CreateCopyOfByValArgument(SDValue Src, SDValue Dst, SDValue Chain,
ISD::ArgFlagsTy Flags, SelectionDAG &DAG, ISD::ArgFlagsTy Flags, SelectionDAG &DAG,
DebugLoc dl) { 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(), return DAG.getMemcpy(Chain, dl, Dst, Src, SizeNode, Flags.getByValAlign(),
/*isVolatile*/false, /*AlwaysInline=*/true, /*isVolatile*/false, /*AlwaysInline=*/true,
NULL, 0, NULL, 0); MachinePointerInfo(0), MachinePointerInfo(0));
} }
/// IsTailCallConvention - Return true if the calling convention is one that /// 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); SDValue SrcPtr = Op.getOperand(2);
const Value *DstSV = cast<SrcValueSDNode>(Op.getOperand(3))->getValue(); const Value *DstSV = cast<SrcValueSDNode>(Op.getOperand(3))->getValue();
const Value *SrcSV = cast<SrcValueSDNode>(Op.getOperand(4))->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, DAG.getIntPtrConstant(24), 8, /*isVolatile*/false,
false, DstSV, 0, SrcSV, 0); false,
MachinePointerInfo(DstSV), MachinePointerInfo(SrcSV));
} }
SDValue SDValue

View File

@ -32,8 +32,7 @@ X86SelectionDAGInfo::EmitTargetCodeForMemset(SelectionDAG &DAG, DebugLoc dl,
SDValue Dst, SDValue Src, SDValue Dst, SDValue Src,
SDValue Size, unsigned Align, SDValue Size, unsigned Align,
bool isVolatile, bool isVolatile,
const Value *DstSV, MachinePointerInfo DstPtrInfo) const {
uint64_t DstSVOff) const {
ConstantSDNode *ConstantSize = dyn_cast<ConstantSDNode>(Size); ConstantSDNode *ConstantSize = dyn_cast<ConstantSDNode>(Size);
// If not DWORD aligned or size is more than the threshold, call the library. // 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)), DAG.getConstant(Offset, AddrVT)),
Src, Src,
DAG.getConstant(BytesLeft, SizeVT), 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. // 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 Chain, SDValue Dst, SDValue Src,
SDValue Size, unsigned Align, SDValue Size, unsigned Align,
bool isVolatile, bool AlwaysInline, bool isVolatile, bool AlwaysInline,
const Value *DstSV, MachinePointerInfo DstPtrInfo,
uint64_t DstSVOff, MachinePointerInfo SrcPtrInfo) const {
const Value *SrcSV,
uint64_t SrcSVOff) const {
// This requires the copy size to be a constant, preferrably // This requires the copy size to be a constant, preferrably
// within a subtarget-specific limit. // within a subtarget-specific limit.
ConstantSDNode *ConstantSize = dyn_cast<ConstantSDNode>(Size); ConstantSDNode *ConstantSize = dyn_cast<ConstantSDNode>(Size);
@ -234,8 +231,8 @@ X86SelectionDAGInfo::EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
DAG.getConstant(Offset, SrcVT)), DAG.getConstant(Offset, SrcVT)),
DAG.getConstant(BytesLeft, SizeVT), DAG.getConstant(BytesLeft, SizeVT),
Align, isVolatile, AlwaysInline, Align, isVolatile, AlwaysInline,
DstSV, DstSVOff + Offset, DstPtrInfo.getWithOffset(Offset),
SrcSV, SrcSVOff + Offset)); SrcPtrInfo.getWithOffset(Offset)));
} }
return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, return DAG.getNode(ISD::TokenFactor, dl, MVT::Other,

View File

@ -39,8 +39,7 @@ public:
SDValue Dst, SDValue Src, SDValue Dst, SDValue Src,
SDValue Size, unsigned Align, SDValue Size, unsigned Align,
bool isVolatile, bool isVolatile,
const Value *DstSV, MachinePointerInfo DstPtrInfo) const;
uint64_t DstSVOff) const;
virtual virtual
SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl, SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
@ -48,10 +47,8 @@ public:
SDValue Dst, SDValue Src, SDValue Dst, SDValue Src,
SDValue Size, unsigned Align, SDValue Size, unsigned Align,
bool isVolatile, bool AlwaysInline, bool isVolatile, bool AlwaysInline,
const Value *DstSV, MachinePointerInfo DstPtrInfo,
uint64_t DstSVOff, MachinePointerInfo SrcPtrInfo) const;
const Value *SrcSV,
uint64_t SrcSVOff) const;
}; };
} }

View File

@ -1443,9 +1443,8 @@ SDValue XCoreTargetLowering::PerformDAGCombine(SDNode *N,
return DAG.getMemmove(Chain, dl, ST->getBasePtr(), return DAG.getMemmove(Chain, dl, ST->getBasePtr(),
LD->getBasePtr(), LD->getBasePtr(),
DAG.getConstant(StoreBits/8, MVT::i32), DAG.getConstant(StoreBits/8, MVT::i32),
Alignment, false, ST->getSrcValue(), Alignment, false, ST->getPointerInfo(),
ST->getSrcValueOffset(), LD->getSrcValue(), LD->getPointerInfo());
LD->getSrcValueOffset());
} }
} }
break; break;