summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-02-15 01:54:51 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-02-15 01:54:51 +0000
commite2038bdeee488a9aa163929fac5214f6f749de5a (patch)
tree2c8a33ba0dd6056769396ece0c84a567c8b1b59f /llvm/lib/CodeGen/SelectionDAG
parent01db04efb0d8666689572aae7832b0088d27195e (diff)
downloadbcm5719-llvm-e2038bdeee488a9aa163929fac5214f6f749de5a.tar.gz
bcm5719-llvm-e2038bdeee488a9aa163929fac5214f6f749de5a.zip
Lower memcpy with small constant size operand into a series of load / store
ops. llvm-svn: 26195
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp42
1 files changed, 34 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 8caa5c32bcd..0c52edaf88f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -1641,19 +1641,45 @@ void SelectionDAGLowering::visitMemIntrinsic(CallInst &I, unsigned Op) {
MVT::ValueType VT = MemOps[i];
unsigned VTSize = getSizeInBits(VT) / 8;
SDOperand Value = getMemsetValue(Op2, VT, DAG);
- OutChains.
- push_back(DAG.getNode(ISD::STORE, MVT::Other, getRoot(),
- Value,
- getMemBasePlusOffset(Op1, Offset, DAG, TLI),
- DAG.getSrcValue(NULL)));
+ SDOperand Store = DAG.getNode(ISD::STORE, MVT::Other, getRoot(),
+ Value,
+ getMemBasePlusOffset(Op1, Offset, DAG, TLI),
+ DAG.getSrcValue(I.getOperand(1), Offset));
+ OutChains.push_back(Store);
+ Offset += VTSize;
+ }
+ }
+ break;
+ }
+ case ISD::MEMCPY: {
+ if (MeetsMaxMemopRequirement(MemOps, TLI.getMaxStoresPerMemcpy(),
+ Size->getValue(), Align, TLI)) {
+ unsigned NumMemOps = MemOps.size();
+ unsigned Offset = 0;
+ for (unsigned i = 0; i < NumMemOps; i++) {
+ MVT::ValueType VT = MemOps[i];
+ unsigned VTSize = getSizeInBits(VT) / 8;
+ SDOperand Value =
+ DAG.getLoad(VT, getRoot(),
+ getMemBasePlusOffset(Op2, Offset, DAG, TLI),
+ DAG.getSrcValue(I.getOperand(2), Offset));
+ SDOperand Store =
+ DAG.getNode(ISD::STORE, MVT::Other, Value.getValue(1),
+ Value,
+ getMemBasePlusOffset(Op1, Offset, DAG, TLI),
+ DAG.getSrcValue(I.getOperand(1), Offset));
+ OutChains.push_back(Store);
Offset += VTSize;
}
-
- DAG.setRoot(DAG.getNode(ISD::TokenFactor, MVT::Other, OutChains));
- return;
}
+ break;
}
}
+
+ if (!OutChains.empty()) {
+ DAG.setRoot(DAG.getNode(ISD::TokenFactor, MVT::Other, OutChains));
+ return;
+ }
}
std::vector<SDOperand> Ops;
OpenPOWER on IntegriCloud