mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-15 07:39:31 +00:00
[ARM] Reduce code duplication by factoring out in a lambda. NFCI.
llvm-svn: 298572
This commit is contained in:
parent
7702500e41
commit
f899257b4f
@ -198,17 +198,18 @@ SDValue ARMSelectionDAGInfo::EmitTargetCodeForMemcpy(
|
||||
return Chain;
|
||||
|
||||
// Issue loads / stores for the trailing (1 - 3) bytes.
|
||||
auto getRemainingValueType = [](unsigned BytesLeft) {
|
||||
return (BytesLeft >= 2) ? MVT::i16 : MVT::i8;
|
||||
};
|
||||
auto getRemainingSize = [](unsigned BytesLeft) {
|
||||
return (BytesLeft >= 2) ? 2 : 1;
|
||||
};
|
||||
|
||||
unsigned BytesLeftSave = BytesLeft;
|
||||
i = 0;
|
||||
while (BytesLeft) {
|
||||
if (BytesLeft >= 2) {
|
||||
VT = MVT::i16;
|
||||
VTSize = 2;
|
||||
} else {
|
||||
VT = MVT::i8;
|
||||
VTSize = 1;
|
||||
}
|
||||
|
||||
VT = getRemainingValueType(BytesLeft);
|
||||
VTSize = getRemainingSize(BytesLeft);
|
||||
Loads[i] = DAG.getLoad(VT, dl, Chain,
|
||||
DAG.getNode(ISD::ADD, dl, MVT::i32, Src,
|
||||
DAG.getConstant(SrcOff, dl, MVT::i32)),
|
||||
@ -224,14 +225,8 @@ SDValue ARMSelectionDAGInfo::EmitTargetCodeForMemcpy(
|
||||
i = 0;
|
||||
BytesLeft = BytesLeftSave;
|
||||
while (BytesLeft) {
|
||||
if (BytesLeft >= 2) {
|
||||
VT = MVT::i16;
|
||||
VTSize = 2;
|
||||
} else {
|
||||
VT = MVT::i8;
|
||||
VTSize = 1;
|
||||
}
|
||||
|
||||
VT = getRemainingValueType(BytesLeft);
|
||||
VTSize = getRemainingSize(BytesLeft);
|
||||
TFOps[i] = DAG.getStore(Chain, dl, Loads[i],
|
||||
DAG.getNode(ISD::ADD, dl, MVT::i32, Dst,
|
||||
DAG.getConstant(DstOff, dl, MVT::i32)),
|
||||
|
Loading…
Reference in New Issue
Block a user