From 0a14060ce2e73a8d8820a3d6d4d27c1744f6f675 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 14 Dec 2003 04:52:11 +0000 Subject: [PATCH] Finegrainify namespacification Add capability to represent volatile AliasSet's Propagate this information from loads&stores into the aliassets llvm-svn: 10457 --- llvm/lib/Analysis/AliasSetTracker.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/llvm/lib/Analysis/AliasSetTracker.cpp b/llvm/lib/Analysis/AliasSetTracker.cpp index 4a293448ed32..a3d58d90e9fa 100644 --- a/llvm/lib/Analysis/AliasSetTracker.cpp +++ b/llvm/lib/Analysis/AliasSetTracker.cpp @@ -20,8 +20,7 @@ #include "llvm/Target/TargetData.h" #include "llvm/Assembly/Writer.h" #include "llvm/Support/InstIterator.h" - -namespace llvm { +using namespace llvm; /// mergeSetIn - Merge the specified alias set into this alias set... /// @@ -190,16 +189,21 @@ AliasSet &AliasSetTracker::getAliasSetForPointer(Value *Pointer, unsigned Size){ } void AliasSetTracker::add(LoadInst *LI) { - addPointer(LI->getOperand(0), - AA.getTargetData().getTypeSize(LI->getType()), AliasSet::Refs); + AliasSet &AS = + addPointer(LI->getOperand(0), + AA.getTargetData().getTypeSize(LI->getType()), AliasSet::Refs); + if (LI->isVolatile()) AS.setVolatile(); } void AliasSetTracker::add(StoreInst *SI) { - addPointer(SI->getOperand(1), - AA.getTargetData().getTypeSize(SI->getOperand(0)->getType()), - AliasSet::Mods); + AliasSet &AS = + addPointer(SI->getOperand(1), + AA.getTargetData().getTypeSize(SI->getOperand(0)->getType()), + AliasSet::Mods); + if (SI->isVolatile()) AS.setVolatile(); } + void AliasSetTracker::add(CallSite CS) { AliasSet *AS = findAliasSetForCallSite(CS); if (!AS) { @@ -263,6 +267,7 @@ void AliasSet::print(std::ostream &OS) const { case ModRef : OS << "Mod/Ref "; break; default: assert(0 && "Bad value for AccessTy!"); } + if (isVolatile()) OS << "[volatile] "; if (Forward) OS << " forwarding to " << (void*)Forward; @@ -329,5 +334,3 @@ namespace { RegisterPass X("print-alias-sets", "Alias Set Printer", PassInfo::Analysis | PassInfo::Optimization); } - -} // End llvm namespace