Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 1 | //===- AliasSetTracker.cpp - Alias Sets Tracker implementation-------------===// |
John Criswell | b576c94 | 2003-10-20 19:43:21 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by the LLVM research group and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 9 | // |
| 10 | // This file implements the AliasSetTracker and AliasSet classes. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "llvm/Analysis/AliasSetTracker.h" |
| 15 | #include "llvm/Analysis/AliasAnalysis.h" |
| 16 | #include "llvm/iMemory.h" |
| 17 | #include "llvm/iOther.h" |
| 18 | #include "llvm/iTerminators.h" |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 19 | #include "llvm/Pass.h" |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 20 | #include "llvm/Target/TargetData.h" |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 21 | #include "llvm/Assembly/Writer.h" |
| 22 | #include "llvm/Support/InstIterator.h" |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 23 | |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 24 | namespace llvm { |
| 25 | |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 26 | /// mergeSetIn - Merge the specified alias set into this alias set... |
| 27 | /// |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 28 | void AliasSet::mergeSetIn(AliasSet &AS) { |
| 29 | assert(!AS.Forward && "Alias set is already forwarding!"); |
| 30 | assert(!Forward && "This set is a forwarding set!!"); |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 31 | |
| 32 | // Update the alias and access types of this set... |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 33 | AccessTy |= AS.AccessTy; |
| 34 | AliasTy |= AS.AliasTy; |
| 35 | |
| 36 | if (CallSites.empty()) { // Merge call sites... |
| 37 | if (!AS.CallSites.empty()) |
| 38 | std::swap(CallSites, AS.CallSites); |
| 39 | } else if (!AS.CallSites.empty()) { |
| 40 | CallSites.insert(CallSites.end(), AS.CallSites.begin(), AS.CallSites.end()); |
| 41 | AS.CallSites.clear(); |
| 42 | } |
| 43 | |
| 44 | // FIXME: If AS's refcount is zero, nuke it now... |
| 45 | assert(RefCount != 0); |
| 46 | |
| 47 | AS.Forward = this; // Forward across AS now... |
| 48 | RefCount++; // AS is now pointing to us... |
| 49 | |
| 50 | // Merge the list of constituent pointers... |
| 51 | PtrListTail->second.setTail(AS.PtrListHead); |
| 52 | PtrListTail = AS.PtrListTail; |
| 53 | AS.PtrListHead = AS.PtrListTail = 0; |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 54 | } |
| 55 | |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 56 | void AliasSetTracker::removeAliasSet(AliasSet *AS) { |
| 57 | AliasSets.erase(AS); |
| 58 | } |
| 59 | |
| 60 | void AliasSet::removeFromTracker(AliasSetTracker &AST) { |
| 61 | assert(RefCount == 0 && "Cannot remove non-dead alias set from tracker!"); |
| 62 | AST.removeAliasSet(this); |
| 63 | } |
| 64 | |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 65 | void AliasSet::addPointer(AliasSetTracker &AST, HashNodePair &Entry, |
| 66 | unsigned Size) { |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 67 | assert(!Entry.second.hasAliasSet() && "Entry already in set!"); |
| 68 | |
| 69 | AliasAnalysis &AA = AST.getAliasAnalysis(); |
| 70 | |
| 71 | if (isMustAlias()) // Check to see if we have to downgrade to _may_ alias |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 72 | if (HashNodePair *P = getSomePointer()) { |
| 73 | AliasAnalysis::AliasResult Result = |
| 74 | AA.alias(P->first, P->second.getSize(), Entry.first, Size); |
| 75 | if (Result == AliasAnalysis::MayAlias) |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 76 | AliasTy = MayAlias; |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 77 | else // First entry of must alias must have maximum size! |
| 78 | P->second.updateSize(Size); |
| 79 | assert(Result != AliasAnalysis::NoAlias && "Cannot be part of must set!"); |
| 80 | } |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 81 | |
| 82 | Entry.second.setAliasSet(this); |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 83 | Entry.second.updateSize(Size); |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 84 | |
| 85 | // Add it to the end of the list... |
| 86 | if (PtrListTail) |
| 87 | PtrListTail->second.setTail(&Entry); |
| 88 | else |
| 89 | PtrListHead = &Entry; |
| 90 | PtrListTail = &Entry; |
| 91 | RefCount++; // Entry points to alias set... |
| 92 | } |
| 93 | |
| 94 | void AliasSet::addCallSite(CallSite CS) { |
| 95 | CallSites.push_back(CS); |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 96 | AliasTy = MayAlias; // FIXME: Too conservative? |
Chris Lattner | 577385e | 2003-05-03 03:42:08 +0000 | [diff] [blame] | 97 | AccessTy = ModRef; |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 98 | } |
| 99 | |
| 100 | /// aliasesPointer - Return true if the specified pointer "may" (or must) |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 101 | /// alias one of the members in the set. |
| 102 | /// |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 103 | bool AliasSet::aliasesPointer(const Value *Ptr, unsigned Size, |
| 104 | AliasAnalysis &AA) const { |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 105 | if (AliasTy == MustAlias) { |
| 106 | assert(CallSites.empty() && "Illegal must alias set!"); |
| 107 | |
| 108 | // If this is a set of MustAliases, only check to see if the pointer aliases |
| 109 | // SOME value in the set... |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 110 | HashNodePair *SomePtr = getSomePointer(); |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 111 | assert(SomePtr && "Empty must-alias set??"); |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 112 | return AA.alias(SomePtr->first, SomePtr->second.getSize(), Ptr, Size); |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | // If this is a may-alias set, we have to check all of the pointers in the set |
| 116 | // to be sure it doesn't alias the set... |
| 117 | for (iterator I = begin(), E = end(); I != E; ++I) |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 118 | if (AA.alias(Ptr, Size, I->first, I->second.getSize())) |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 119 | return true; |
| 120 | |
| 121 | // Check the call sites list and invoke list... |
| 122 | if (!CallSites.empty()) |
| 123 | // FIXME: this is pessimistic! |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 124 | return true; |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 125 | |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 126 | return false; |
| 127 | } |
| 128 | |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 129 | bool AliasSet::aliasesCallSite(CallSite CS, AliasAnalysis &AA) const { |
| 130 | // FIXME: Too conservative! |
| 131 | return true; |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 135 | /// findAliasSetForPointer - Given a pointer, find the one alias set to put the |
| 136 | /// instruction referring to the pointer into. If there are multiple alias sets |
| 137 | /// that may alias the pointer, merge them together and return the unified set. |
| 138 | /// |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 139 | AliasSet *AliasSetTracker::findAliasSetForPointer(const Value *Ptr, |
| 140 | unsigned Size) { |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 141 | AliasSet *FoundSet = 0; |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 142 | for (iterator I = begin(), E = end(); I != E; ++I) |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 143 | if (!I->Forward && I->aliasesPointer(Ptr, Size, AA)) { |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 144 | if (FoundSet == 0) { // If this is the first alias set ptr can go into... |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 145 | FoundSet = I; // Remember it. |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 146 | } else { // Otherwise, we must merge the sets... |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 147 | FoundSet->mergeSetIn(*I); // Merge in contents... |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 148 | } |
| 149 | } |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 150 | |
| 151 | return FoundSet; |
| 152 | } |
| 153 | |
| 154 | AliasSet *AliasSetTracker::findAliasSetForCallSite(CallSite CS) { |
| 155 | AliasSet *FoundSet = 0; |
| 156 | for (iterator I = begin(), E = end(); I != E; ++I) |
Chris Lattner | 2d0a4a4 | 2003-02-26 19:28:57 +0000 | [diff] [blame] | 157 | if (!I->Forward && I->aliasesCallSite(CS, AA)) { |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 158 | if (FoundSet == 0) { // If this is the first alias set ptr can go into... |
| 159 | FoundSet = I; // Remember it. |
Chris Lattner | 2d0a4a4 | 2003-02-26 19:28:57 +0000 | [diff] [blame] | 160 | } else if (!I->Forward) { // Otherwise, we must merge the sets... |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 161 | FoundSet->mergeSetIn(*I); // Merge in contents... |
| 162 | } |
| 163 | } |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 164 | |
| 165 | return FoundSet; |
| 166 | } |
| 167 | |
| 168 | |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 169 | |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 170 | |
| 171 | /// getAliasSetForPointer - Return the alias set that the specified pointer |
| 172 | /// lives in... |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 173 | AliasSet &AliasSetTracker::getAliasSetForPointer(Value *Pointer, unsigned Size){ |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 174 | AliasSet::HashNodePair &Entry = getEntryFor(Pointer); |
| 175 | |
| 176 | // Check to see if the pointer is already known... |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 177 | if (Entry.second.hasAliasSet() && Size <= Entry.second.getSize()) { |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 178 | // Return the set! |
| 179 | return *Entry.second.getAliasSet(*this)->getForwardedTarget(*this); |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 180 | } else if (AliasSet *AS = findAliasSetForPointer(Pointer, Size)) { |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 181 | // Add it to the alias set it aliases... |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 182 | AS->addPointer(*this, Entry, Size); |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 183 | return *AS; |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 184 | } else { |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 185 | // Otherwise create a new alias set to hold the loaded pointer... |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 186 | AliasSets.push_back(AliasSet()); |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 187 | AliasSets.back().addPointer(*this, Entry, Size); |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 188 | return AliasSets.back(); |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 189 | } |
| 190 | } |
| 191 | |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 192 | void AliasSetTracker::add(LoadInst *LI) { |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 193 | addPointer(LI->getOperand(0), |
| 194 | AA.getTargetData().getTypeSize(LI->getType()), AliasSet::Refs); |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 195 | } |
| 196 | |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 197 | void AliasSetTracker::add(StoreInst *SI) { |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 198 | addPointer(SI->getOperand(1), |
| 199 | AA.getTargetData().getTypeSize(SI->getOperand(0)->getType()), |
| 200 | AliasSet::Mods); |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 201 | } |
| 202 | |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 203 | void AliasSetTracker::add(CallSite CS) { |
| 204 | AliasSet *AS = findAliasSetForCallSite(CS); |
| 205 | if (!AS) { |
| 206 | AliasSets.push_back(AliasSet()); |
| 207 | AS = &AliasSets.back(); |
| 208 | } |
| 209 | AS->addCallSite(CS); |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 210 | } |
| 211 | |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 212 | void AliasSetTracker::add(Instruction *I) { |
| 213 | // Dispatch to one of the other add methods... |
| 214 | if (LoadInst *LI = dyn_cast<LoadInst>(I)) |
| 215 | add(LI); |
| 216 | else if (StoreInst *SI = dyn_cast<StoreInst>(I)) |
| 217 | add(SI); |
| 218 | else if (CallInst *CI = dyn_cast<CallInst>(I)) |
| 219 | add(CI); |
| 220 | else if (InvokeInst *II = dyn_cast<InvokeInst>(I)) |
| 221 | add(II); |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 222 | } |
| 223 | |
Chris Lattner | 319d05b | 2003-03-03 23:28:05 +0000 | [diff] [blame] | 224 | void AliasSetTracker::add(BasicBlock &BB) { |
| 225 | for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I) |
| 226 | add(I); |
| 227 | } |
| 228 | |
| 229 | void AliasSetTracker::add(const AliasSetTracker &AST) { |
| 230 | assert(&AA == &AST.AA && |
| 231 | "Merging AliasSetTracker objects with different Alias Analyses!"); |
| 232 | |
| 233 | // Loop over all of the alias sets in AST, adding the pointers contained |
| 234 | // therein into the current alias sets. This can cause alias sets to be |
| 235 | // merged together in the current AST. |
| 236 | for (const_iterator I = AST.begin(), E = AST.end(); I != E; ++I) |
| 237 | if (!I->Forward) { // Ignore forwarding alias sets |
| 238 | AliasSet &AS = const_cast<AliasSet&>(*I); |
| 239 | |
| 240 | // If there are any call sites in the alias set, add them to this AST. |
| 241 | for (unsigned i = 0, e = AS.CallSites.size(); i != e; ++i) |
| 242 | add(AS.CallSites[i]); |
| 243 | |
| 244 | // Loop over all of the pointers in this alias set... |
| 245 | AliasSet::iterator I = AS.begin(), E = AS.end(); |
| 246 | for (; I != E; ++I) |
| 247 | addPointer(I->first, I->second.getSize(), |
| 248 | (AliasSet::AccessType)AS.AccessTy); |
| 249 | } |
| 250 | } |
| 251 | |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 252 | //===----------------------------------------------------------------------===// |
| 253 | // AliasSet/AliasSetTracker Printing Support |
| 254 | //===----------------------------------------------------------------------===// |
| 255 | |
| 256 | void AliasSet::print(std::ostream &OS) const { |
| 257 | OS << " AliasSet[" << (void*)this << "," << RefCount << "] "; |
| 258 | OS << (AliasTy == MustAlias ? "must" : "may ") << " alias, "; |
| 259 | switch (AccessTy) { |
| 260 | case NoModRef: OS << "No access "; break; |
| 261 | case Refs : OS << "Ref "; break; |
| 262 | case Mods : OS << "Mod "; break; |
| 263 | case ModRef : OS << "Mod/Ref "; break; |
| 264 | default: assert(0 && "Bad value for AccessTy!"); |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 265 | } |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 266 | if (Forward) |
| 267 | OS << " forwarding to " << (void*)Forward; |
| 268 | |
| 269 | |
| 270 | if (begin() != end()) { |
| 271 | OS << "Pointers: "; |
| 272 | for (iterator I = begin(), E = end(); I != E; ++I) { |
| 273 | if (I != begin()) OS << ", "; |
Chris Lattner | 31a9d18 | 2003-02-26 22:11:00 +0000 | [diff] [blame] | 274 | WriteAsOperand(OS << "(", I->first); |
| 275 | OS << ", " << I->second.getSize() << ")"; |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 276 | } |
| 277 | } |
| 278 | if (!CallSites.empty()) { |
| 279 | OS << "\n " << CallSites.size() << " Call Sites: "; |
| 280 | for (unsigned i = 0, e = CallSites.size(); i != e; ++i) { |
| 281 | if (i) OS << ", "; |
| 282 | WriteAsOperand(OS, CallSites[i].getCalledValue()); |
| 283 | } |
| 284 | } |
| 285 | OS << "\n"; |
| 286 | } |
| 287 | |
| 288 | void AliasSetTracker::print(std::ostream &OS) const { |
| 289 | OS << "Alias Set Tracker: " << AliasSets.size() << " alias sets for " |
| 290 | << PointerMap.size() << " pointer values.\n"; |
| 291 | for (const_iterator I = begin(), E = end(); I != E; ++I) |
| 292 | I->print(OS); |
| 293 | OS << "\n"; |
| 294 | } |
| 295 | |
| 296 | void AliasSet::dump() const { print (std::cerr); } |
| 297 | void AliasSetTracker::dump() const { print(std::cerr); } |
| 298 | |
Chris Lattner | 9971ac4 | 2003-02-24 20:37:56 +0000 | [diff] [blame] | 299 | //===----------------------------------------------------------------------===// |
| 300 | // AliasSetPrinter Pass |
| 301 | //===----------------------------------------------------------------------===// |
| 302 | |
| 303 | namespace { |
| 304 | class AliasSetPrinter : public FunctionPass { |
| 305 | AliasSetTracker *Tracker; |
| 306 | public: |
| 307 | virtual void getAnalysisUsage(AnalysisUsage &AU) const { |
| 308 | AU.setPreservesAll(); |
| 309 | AU.addRequired<AliasAnalysis>(); |
| 310 | } |
| 311 | |
| 312 | virtual bool runOnFunction(Function &F) { |
| 313 | Tracker = new AliasSetTracker(getAnalysis<AliasAnalysis>()); |
| 314 | |
| 315 | for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) |
| 316 | Tracker->add(*I); |
| 317 | return false; |
| 318 | } |
| 319 | |
| 320 | /// print - Convert to human readable form |
| 321 | virtual void print(std::ostream &OS) const { |
| 322 | Tracker->print(OS); |
| 323 | } |
| 324 | |
| 325 | virtual void releaseMemory() { |
| 326 | delete Tracker; |
| 327 | } |
| 328 | }; |
| 329 | RegisterPass<AliasSetPrinter> X("print-alias-sets", "Alias Set Printer", |
| 330 | PassInfo::Analysis | PassInfo::Optimization); |
Chris Lattner | 009cc3d | 2002-09-26 21:49:07 +0000 | [diff] [blame] | 331 | } |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 332 | |
| 333 | } // End llvm namespace |