realize that instructions who match intrinsics that read memory read memory.

Also, instructions with any nodes that are SDNPMayLoad also read memory.

llvm-svn: 45817
This commit is contained in:
Chris Lattner 2008-01-10 04:38:57 +00:00
parent f171482a66
commit 1ca2068227
3 changed files with 15 additions and 3 deletions

View File

@ -319,6 +319,8 @@ SDNodeInfo::SDNodeInfo(Record *R) : Def(R) {
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";

View File

@ -37,6 +37,7 @@ enum SDNP {
SDNPOutFlag,
SDNPInFlag,
SDNPOptInFlag,
SDNPMayLoad,
SDNPMayStore
};

View File

@ -174,12 +174,21 @@ private:
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.
}
}