Properties |= 1 << SDNPOptInFlag;
} else if (PropList[i]->getName() == "SDNPMayStore") {
Properties |= 1 << SDNPMayStore;
+ } else if (PropList[i]->getName() == "SDNPMayLoad") {
+ Properties |= 1 << SDNPMayLoad;
} else {
cerr << "Unknown SD Node property '" << PropList[i]->getName()
<< "' on node '" << R->getName() << "'!\n";
const SDNodeInfo &OpInfo = CDP.getSDNodeInfo(N->getOperator());
// If node writes to memory, it obviously stores to memory.
- if (OpInfo.hasProperty(SDNPMayStore)) {
+ if (OpInfo.hasProperty(SDNPMayStore))
mayStore = true;
- } else if (const CodeGenIntrinsic *IntInfo = N->getIntrinsicInfo(CDP)) {
+
+ // If it reads memory, remember this.
+ if (OpInfo.hasProperty(SDNPMayLoad))
+ mayLoad = true;
+
+ if (const CodeGenIntrinsic *IntInfo = N->getIntrinsicInfo(CDP)) {
// If this is an intrinsic, analyze it.
- if (IntInfo->ModRef >= CodeGenIntrinsic::WriteArgMem)
+ if (IntInfo->ModRef >= CodeGenIntrinsic::WriteArgMem) {
mayStore = true;// Intrinsics that can write to memory are 'mayStore'.
+ }
+
+ if (IntInfo->ModRef >= CodeGenIntrinsic::ReadArgMem)
+ mayLoad = true;// These may also load memory.
}
}