LLVM API Documentation
00001 //===- llvm/Analysis/AliasAnalysis.h - Alias Analysis Interface -*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines the generic AliasAnalysis interface, which is used as the 00011 // common interface used by all clients of alias analysis information, and 00012 // implemented by all alias analysis implementations. Mod/Ref information is 00013 // also captured by this interface. 00014 // 00015 // Implementations of this interface must implement the various virtual methods, 00016 // which automatically provides functionality for the entire suite of client 00017 // APIs. 00018 // 00019 // This API identifies memory regions with the Location class. The pointer 00020 // component specifies the base memory address of the region. The Size specifies 00021 // the maximum size (in address units) of the memory region, or UnknownSize if 00022 // the size is not known. The TBAA tag identifies the "type" of the memory 00023 // reference; see the TypeBasedAliasAnalysis class for details. 00024 // 00025 // Some non-obvious details include: 00026 // - Pointers that point to two completely different objects in memory never 00027 // alias, regardless of the value of the Size component. 00028 // - NoAlias doesn't imply inequal pointers. The most obvious example of this 00029 // is two pointers to constant memory. Even if they are equal, constant 00030 // memory is never stored to, so there will never be any dependencies. 00031 // In this and other situations, the pointers may be both NoAlias and 00032 // MustAlias at the same time. The current API can only return one result, 00033 // though this is rarely a problem in practice. 00034 // 00035 //===----------------------------------------------------------------------===// 00036 00037 #ifndef LLVM_ANALYSIS_ALIASANALYSIS_H 00038 #define LLVM_ANALYSIS_ALIASANALYSIS_H 00039 00040 #include "llvm/ADT/DenseMap.h" 00041 #include "llvm/Support/CallSite.h" 00042 00043 namespace llvm { 00044 00045 class LoadInst; 00046 class StoreInst; 00047 class VAArgInst; 00048 class DataLayout; 00049 class TargetLibraryInfo; 00050 class Pass; 00051 class AnalysisUsage; 00052 class MemTransferInst; 00053 class MemIntrinsic; 00054 class DominatorTree; 00055 00056 class AliasAnalysis { 00057 protected: 00058 const DataLayout *TD; 00059 const TargetLibraryInfo *TLI; 00060 00061 private: 00062 AliasAnalysis *AA; // Previous Alias Analysis to chain to. 00063 00064 protected: 00065 /// InitializeAliasAnalysis - Subclasses must call this method to initialize 00066 /// the AliasAnalysis interface before any other methods are called. This is 00067 /// typically called by the run* methods of these subclasses. This may be 00068 /// called multiple times. 00069 /// 00070 void InitializeAliasAnalysis(Pass *P); 00071 00072 /// getAnalysisUsage - All alias analysis implementations should invoke this 00073 /// directly (using AliasAnalysis::getAnalysisUsage(AU)). 00074 virtual void getAnalysisUsage(AnalysisUsage &AU) const; 00075 00076 public: 00077 static char ID; // Class identification, replacement for typeinfo 00078 AliasAnalysis() : TD(0), TLI(0), AA(0) {} 00079 virtual ~AliasAnalysis(); // We want to be subclassed 00080 00081 /// UnknownSize - This is a special value which can be used with the 00082 /// size arguments in alias queries to indicate that the caller does not 00083 /// know the sizes of the potential memory references. 00084 static uint64_t const UnknownSize = ~UINT64_C(0); 00085 00086 /// getDataLayout - Return a pointer to the current DataLayout object, or 00087 /// null if no DataLayout object is available. 00088 /// 00089 const DataLayout *getDataLayout() const { return TD; } 00090 00091 /// getTargetLibraryInfo - Return a pointer to the current TargetLibraryInfo 00092 /// object, or null if no TargetLibraryInfo object is available. 00093 /// 00094 const TargetLibraryInfo *getTargetLibraryInfo() const { return TLI; } 00095 00096 /// getTypeStoreSize - Return the DataLayout store size for the given type, 00097 /// if known, or a conservative value otherwise. 00098 /// 00099 uint64_t getTypeStoreSize(Type *Ty); 00100 00101 //===--------------------------------------------------------------------===// 00102 /// Alias Queries... 00103 /// 00104 00105 /// Location - A description of a memory location. 00106 struct Location { 00107 /// Ptr - The address of the start of the location. 00108 const Value *Ptr; 00109 /// Size - The maximum size of the location, in address-units, or 00110 /// UnknownSize if the size is not known. Note that an unknown size does 00111 /// not mean the pointer aliases the entire virtual address space, because 00112 /// there are restrictions on stepping out of one object and into another. 00113 /// See http://llvm.org/docs/LangRef.html#pointeraliasing 00114 uint64_t Size; 00115 /// TBAATag - The metadata node which describes the TBAA type of 00116 /// the location, or null if there is no known unique tag. 00117 const MDNode *TBAATag; 00118 00119 explicit Location(const Value *P = 0, uint64_t S = UnknownSize, 00120 const MDNode *N = 0) 00121 : Ptr(P), Size(S), TBAATag(N) {} 00122 00123 Location getWithNewPtr(const Value *NewPtr) const { 00124 Location Copy(*this); 00125 Copy.Ptr = NewPtr; 00126 return Copy; 00127 } 00128 00129 Location getWithNewSize(uint64_t NewSize) const { 00130 Location Copy(*this); 00131 Copy.Size = NewSize; 00132 return Copy; 00133 } 00134 00135 Location getWithoutTBAATag() const { 00136 Location Copy(*this); 00137 Copy.TBAATag = 0; 00138 return Copy; 00139 } 00140 }; 00141 00142 /// getLocation - Fill in Loc with information about the memory reference by 00143 /// the given instruction. 00144 Location getLocation(const LoadInst *LI); 00145 Location getLocation(const StoreInst *SI); 00146 Location getLocation(const VAArgInst *VI); 00147 Location getLocation(const AtomicCmpXchgInst *CXI); 00148 Location getLocation(const AtomicRMWInst *RMWI); 00149 static Location getLocationForSource(const MemTransferInst *MTI); 00150 static Location getLocationForDest(const MemIntrinsic *MI); 00151 00152 /// Alias analysis result - Either we know for sure that it does not alias, we 00153 /// know for sure it must alias, or we don't know anything: The two pointers 00154 /// _might_ alias. This enum is designed so you can do things like: 00155 /// if (AA.alias(P1, P2)) { ... } 00156 /// to check to see if two pointers might alias. 00157 /// 00158 /// See docs/AliasAnalysis.html for more information on the specific meanings 00159 /// of these values. 00160 /// 00161 enum AliasResult { 00162 NoAlias = 0, ///< No dependencies. 00163 MayAlias, ///< Anything goes. 00164 PartialAlias, ///< Pointers differ, but pointees overlap. 00165 MustAlias ///< Pointers are equal. 00166 }; 00167 00168 /// alias - The main low level interface to the alias analysis implementation. 00169 /// Returns an AliasResult indicating whether the two pointers are aliased to 00170 /// each other. This is the interface that must be implemented by specific 00171 /// alias analysis implementations. 00172 virtual AliasResult alias(const Location &LocA, const Location &LocB); 00173 00174 /// alias - A convenience wrapper. 00175 AliasResult alias(const Value *V1, uint64_t V1Size, 00176 const Value *V2, uint64_t V2Size) { 00177 return alias(Location(V1, V1Size), Location(V2, V2Size)); 00178 } 00179 00180 /// alias - A convenience wrapper. 00181 AliasResult alias(const Value *V1, const Value *V2) { 00182 return alias(V1, UnknownSize, V2, UnknownSize); 00183 } 00184 00185 /// isNoAlias - A trivial helper function to check to see if the specified 00186 /// pointers are no-alias. 00187 bool isNoAlias(const Location &LocA, const Location &LocB) { 00188 return alias(LocA, LocB) == NoAlias; 00189 } 00190 00191 /// isNoAlias - A convenience wrapper. 00192 bool isNoAlias(const Value *V1, uint64_t V1Size, 00193 const Value *V2, uint64_t V2Size) { 00194 return isNoAlias(Location(V1, V1Size), Location(V2, V2Size)); 00195 } 00196 00197 /// isNoAlias - A convenience wrapper. 00198 bool isNoAlias(const Value *V1, const Value *V2) { 00199 return isNoAlias(Location(V1), Location(V2)); 00200 } 00201 00202 /// isMustAlias - A convenience wrapper. 00203 bool isMustAlias(const Location &LocA, const Location &LocB) { 00204 return alias(LocA, LocB) == MustAlias; 00205 } 00206 00207 /// isMustAlias - A convenience wrapper. 00208 bool isMustAlias(const Value *V1, const Value *V2) { 00209 return alias(V1, 1, V2, 1) == MustAlias; 00210 } 00211 00212 /// pointsToConstantMemory - If the specified memory location is 00213 /// known to be constant, return true. If OrLocal is true and the 00214 /// specified memory location is known to be "local" (derived from 00215 /// an alloca), return true. Otherwise return false. 00216 virtual bool pointsToConstantMemory(const Location &Loc, 00217 bool OrLocal = false); 00218 00219 /// pointsToConstantMemory - A convenient wrapper. 00220 bool pointsToConstantMemory(const Value *P, bool OrLocal = false) { 00221 return pointsToConstantMemory(Location(P), OrLocal); 00222 } 00223 00224 //===--------------------------------------------------------------------===// 00225 /// Simple mod/ref information... 00226 /// 00227 00228 /// ModRefResult - Represent the result of a mod/ref query. Mod and Ref are 00229 /// bits which may be or'd together. 00230 /// 00231 enum ModRefResult { NoModRef = 0, Ref = 1, Mod = 2, ModRef = 3 }; 00232 00233 /// These values define additional bits used to define the 00234 /// ModRefBehavior values. 00235 enum { Nowhere = 0, ArgumentPointees = 4, Anywhere = 8 | ArgumentPointees }; 00236 00237 /// ModRefBehavior - Summary of how a function affects memory in the program. 00238 /// Loads from constant globals are not considered memory accesses for this 00239 /// interface. Also, functions may freely modify stack space local to their 00240 /// invocation without having to report it through these interfaces. 00241 enum ModRefBehavior { 00242 /// DoesNotAccessMemory - This function does not perform any non-local loads 00243 /// or stores to memory. 00244 /// 00245 /// This property corresponds to the GCC 'const' attribute. 00246 /// This property corresponds to the LLVM IR 'readnone' attribute. 00247 /// This property corresponds to the IntrNoMem LLVM intrinsic flag. 00248 DoesNotAccessMemory = Nowhere | NoModRef, 00249 00250 /// OnlyReadsArgumentPointees - The only memory references in this function 00251 /// (if it has any) are non-volatile loads from objects pointed to by its 00252 /// pointer-typed arguments, with arbitrary offsets. 00253 /// 00254 /// This property corresponds to the IntrReadArgMem LLVM intrinsic flag. 00255 OnlyReadsArgumentPointees = ArgumentPointees | Ref, 00256 00257 /// OnlyAccessesArgumentPointees - The only memory references in this 00258 /// function (if it has any) are non-volatile loads and stores from objects 00259 /// pointed to by its pointer-typed arguments, with arbitrary offsets. 00260 /// 00261 /// This property corresponds to the IntrReadWriteArgMem LLVM intrinsic flag. 00262 OnlyAccessesArgumentPointees = ArgumentPointees | ModRef, 00263 00264 /// OnlyReadsMemory - This function does not perform any non-local stores or 00265 /// volatile loads, but may read from any memory location. 00266 /// 00267 /// This property corresponds to the GCC 'pure' attribute. 00268 /// This property corresponds to the LLVM IR 'readonly' attribute. 00269 /// This property corresponds to the IntrReadMem LLVM intrinsic flag. 00270 OnlyReadsMemory = Anywhere | Ref, 00271 00272 /// UnknownModRefBehavior - This indicates that the function could not be 00273 /// classified into one of the behaviors above. 00274 UnknownModRefBehavior = Anywhere | ModRef 00275 }; 00276 00277 /// getModRefBehavior - Return the behavior when calling the given call site. 00278 virtual ModRefBehavior getModRefBehavior(ImmutableCallSite CS); 00279 00280 /// getModRefBehavior - Return the behavior when calling the given function. 00281 /// For use when the call site is not known. 00282 virtual ModRefBehavior getModRefBehavior(const Function *F); 00283 00284 /// doesNotAccessMemory - If the specified call is known to never read or 00285 /// write memory, return true. If the call only reads from known-constant 00286 /// memory, it is also legal to return true. Calls that unwind the stack 00287 /// are legal for this predicate. 00288 /// 00289 /// Many optimizations (such as CSE and LICM) can be performed on such calls 00290 /// without worrying about aliasing properties, and many calls have this 00291 /// property (e.g. calls to 'sin' and 'cos'). 00292 /// 00293 /// This property corresponds to the GCC 'const' attribute. 00294 /// 00295 bool doesNotAccessMemory(ImmutableCallSite CS) { 00296 return getModRefBehavior(CS) == DoesNotAccessMemory; 00297 } 00298 00299 /// doesNotAccessMemory - If the specified function is known to never read or 00300 /// write memory, return true. For use when the call site is not known. 00301 /// 00302 bool doesNotAccessMemory(const Function *F) { 00303 return getModRefBehavior(F) == DoesNotAccessMemory; 00304 } 00305 00306 /// onlyReadsMemory - If the specified call is known to only read from 00307 /// non-volatile memory (or not access memory at all), return true. Calls 00308 /// that unwind the stack are legal for this predicate. 00309 /// 00310 /// This property allows many common optimizations to be performed in the 00311 /// absence of interfering store instructions, such as CSE of strlen calls. 00312 /// 00313 /// This property corresponds to the GCC 'pure' attribute. 00314 /// 00315 bool onlyReadsMemory(ImmutableCallSite CS) { 00316 return onlyReadsMemory(getModRefBehavior(CS)); 00317 } 00318 00319 /// onlyReadsMemory - If the specified function is known to only read from 00320 /// non-volatile memory (or not access memory at all), return true. For use 00321 /// when the call site is not known. 00322 /// 00323 bool onlyReadsMemory(const Function *F) { 00324 return onlyReadsMemory(getModRefBehavior(F)); 00325 } 00326 00327 /// onlyReadsMemory - Return true if functions with the specified behavior are 00328 /// known to only read from non-volatile memory (or not access memory at all). 00329 /// 00330 static bool onlyReadsMemory(ModRefBehavior MRB) { 00331 return !(MRB & Mod); 00332 } 00333 00334 /// onlyAccessesArgPointees - Return true if functions with the specified 00335 /// behavior are known to read and write at most from objects pointed to by 00336 /// their pointer-typed arguments (with arbitrary offsets). 00337 /// 00338 static bool onlyAccessesArgPointees(ModRefBehavior MRB) { 00339 return !(MRB & Anywhere & ~ArgumentPointees); 00340 } 00341 00342 /// doesAccessArgPointees - Return true if functions with the specified 00343 /// behavior are known to potentially read or write from objects pointed 00344 /// to be their pointer-typed arguments (with arbitrary offsets). 00345 /// 00346 static bool doesAccessArgPointees(ModRefBehavior MRB) { 00347 return (MRB & ModRef) && (MRB & ArgumentPointees); 00348 } 00349 00350 /// getModRefInfo - Return information about whether or not an instruction may 00351 /// read or write the specified memory location. An instruction 00352 /// that doesn't read or write memory may be trivially LICM'd for example. 00353 ModRefResult getModRefInfo(const Instruction *I, 00354 const Location &Loc) { 00355 switch (I->getOpcode()) { 00356 case Instruction::VAArg: return getModRefInfo((const VAArgInst*)I, Loc); 00357 case Instruction::Load: return getModRefInfo((const LoadInst*)I, Loc); 00358 case Instruction::Store: return getModRefInfo((const StoreInst*)I, Loc); 00359 case Instruction::Fence: return getModRefInfo((const FenceInst*)I, Loc); 00360 case Instruction::AtomicCmpXchg: 00361 return getModRefInfo((const AtomicCmpXchgInst*)I, Loc); 00362 case Instruction::AtomicRMW: 00363 return getModRefInfo((const AtomicRMWInst*)I, Loc); 00364 case Instruction::Call: return getModRefInfo((const CallInst*)I, Loc); 00365 case Instruction::Invoke: return getModRefInfo((const InvokeInst*)I,Loc); 00366 default: return NoModRef; 00367 } 00368 } 00369 00370 /// getModRefInfo - A convenience wrapper. 00371 ModRefResult getModRefInfo(const Instruction *I, 00372 const Value *P, uint64_t Size) { 00373 return getModRefInfo(I, Location(P, Size)); 00374 } 00375 00376 /// getModRefInfo (for call sites) - Return information about whether 00377 /// a particular call site modifies or reads the specified memory location. 00378 virtual ModRefResult getModRefInfo(ImmutableCallSite CS, 00379 const Location &Loc); 00380 00381 /// getModRefInfo (for call sites) - A convenience wrapper. 00382 ModRefResult getModRefInfo(ImmutableCallSite CS, 00383 const Value *P, uint64_t Size) { 00384 return getModRefInfo(CS, Location(P, Size)); 00385 } 00386 00387 /// getModRefInfo (for calls) - Return information about whether 00388 /// a particular call modifies or reads the specified memory location. 00389 ModRefResult getModRefInfo(const CallInst *C, const Location &Loc) { 00390 return getModRefInfo(ImmutableCallSite(C), Loc); 00391 } 00392 00393 /// getModRefInfo (for calls) - A convenience wrapper. 00394 ModRefResult getModRefInfo(const CallInst *C, const Value *P, uint64_t Size) { 00395 return getModRefInfo(C, Location(P, Size)); 00396 } 00397 00398 /// getModRefInfo (for invokes) - Return information about whether 00399 /// a particular invoke modifies or reads the specified memory location. 00400 ModRefResult getModRefInfo(const InvokeInst *I, 00401 const Location &Loc) { 00402 return getModRefInfo(ImmutableCallSite(I), Loc); 00403 } 00404 00405 /// getModRefInfo (for invokes) - A convenience wrapper. 00406 ModRefResult getModRefInfo(const InvokeInst *I, 00407 const Value *P, uint64_t Size) { 00408 return getModRefInfo(I, Location(P, Size)); 00409 } 00410 00411 /// getModRefInfo (for loads) - Return information about whether 00412 /// a particular load modifies or reads the specified memory location. 00413 ModRefResult getModRefInfo(const LoadInst *L, const Location &Loc); 00414 00415 /// getModRefInfo (for loads) - A convenience wrapper. 00416 ModRefResult getModRefInfo(const LoadInst *L, const Value *P, uint64_t Size) { 00417 return getModRefInfo(L, Location(P, Size)); 00418 } 00419 00420 /// getModRefInfo (for stores) - Return information about whether 00421 /// a particular store modifies or reads the specified memory location. 00422 ModRefResult getModRefInfo(const StoreInst *S, const Location &Loc); 00423 00424 /// getModRefInfo (for stores) - A convenience wrapper. 00425 ModRefResult getModRefInfo(const StoreInst *S, const Value *P, uint64_t Size){ 00426 return getModRefInfo(S, Location(P, Size)); 00427 } 00428 00429 /// getModRefInfo (for fences) - Return information about whether 00430 /// a particular store modifies or reads the specified memory location. 00431 ModRefResult getModRefInfo(const FenceInst *S, const Location &Loc) { 00432 // Conservatively correct. (We could possibly be a bit smarter if 00433 // Loc is a alloca that doesn't escape.) 00434 return ModRef; 00435 } 00436 00437 /// getModRefInfo (for fences) - A convenience wrapper. 00438 ModRefResult getModRefInfo(const FenceInst *S, const Value *P, uint64_t Size){ 00439 return getModRefInfo(S, Location(P, Size)); 00440 } 00441 00442 /// getModRefInfo (for cmpxchges) - Return information about whether 00443 /// a particular cmpxchg modifies or reads the specified memory location. 00444 ModRefResult getModRefInfo(const AtomicCmpXchgInst *CX, const Location &Loc); 00445 00446 /// getModRefInfo (for cmpxchges) - A convenience wrapper. 00447 ModRefResult getModRefInfo(const AtomicCmpXchgInst *CX, 00448 const Value *P, unsigned Size) { 00449 return getModRefInfo(CX, Location(P, Size)); 00450 } 00451 00452 /// getModRefInfo (for atomicrmws) - Return information about whether 00453 /// a particular atomicrmw modifies or reads the specified memory location. 00454 ModRefResult getModRefInfo(const AtomicRMWInst *RMW, const Location &Loc); 00455 00456 /// getModRefInfo (for atomicrmws) - A convenience wrapper. 00457 ModRefResult getModRefInfo(const AtomicRMWInst *RMW, 00458 const Value *P, unsigned Size) { 00459 return getModRefInfo(RMW, Location(P, Size)); 00460 } 00461 00462 /// getModRefInfo (for va_args) - Return information about whether 00463 /// a particular va_arg modifies or reads the specified memory location. 00464 ModRefResult getModRefInfo(const VAArgInst* I, const Location &Loc); 00465 00466 /// getModRefInfo (for va_args) - A convenience wrapper. 00467 ModRefResult getModRefInfo(const VAArgInst* I, const Value* P, uint64_t Size){ 00468 return getModRefInfo(I, Location(P, Size)); 00469 } 00470 00471 /// getModRefInfo - Return information about whether two call sites may refer 00472 /// to the same set of memory locations. See 00473 /// http://llvm.org/docs/AliasAnalysis.html#ModRefInfo 00474 /// for details. 00475 virtual ModRefResult getModRefInfo(ImmutableCallSite CS1, 00476 ImmutableCallSite CS2); 00477 00478 /// callCapturesBefore - Return information about whether a particular call 00479 /// site modifies or reads the specified memory location. 00480 ModRefResult callCapturesBefore(const Instruction *I, 00481 const AliasAnalysis::Location &MemLoc, 00482 DominatorTree *DT); 00483 00484 /// callCapturesBefore - A convenience wrapper. 00485 ModRefResult callCapturesBefore(const Instruction *I, const Value *P, 00486 uint64_t Size, DominatorTree *DT) { 00487 return callCapturesBefore(I, Location(P, Size), DT); 00488 } 00489 00490 //===--------------------------------------------------------------------===// 00491 /// Higher level methods for querying mod/ref information. 00492 /// 00493 00494 /// canBasicBlockModify - Return true if it is possible for execution of the 00495 /// specified basic block to modify the value pointed to by Ptr. 00496 bool canBasicBlockModify(const BasicBlock &BB, const Location &Loc); 00497 00498 /// canBasicBlockModify - A convenience wrapper. 00499 bool canBasicBlockModify(const BasicBlock &BB, const Value *P, uint64_t Size){ 00500 return canBasicBlockModify(BB, Location(P, Size)); 00501 } 00502 00503 /// canInstructionRangeModify - Return true if it is possible for the 00504 /// execution of the specified instructions to modify the value pointed to by 00505 /// Ptr. The instructions to consider are all of the instructions in the 00506 /// range of [I1,I2] INCLUSIVE. I1 and I2 must be in the same basic block. 00507 bool canInstructionRangeModify(const Instruction &I1, const Instruction &I2, 00508 const Location &Loc); 00509 00510 /// canInstructionRangeModify - A convenience wrapper. 00511 bool canInstructionRangeModify(const Instruction &I1, const Instruction &I2, 00512 const Value *Ptr, uint64_t Size) { 00513 return canInstructionRangeModify(I1, I2, Location(Ptr, Size)); 00514 } 00515 00516 //===--------------------------------------------------------------------===// 00517 /// Methods that clients should call when they transform the program to allow 00518 /// alias analyses to update their internal data structures. Note that these 00519 /// methods may be called on any instruction, regardless of whether or not 00520 /// they have pointer-analysis implications. 00521 /// 00522 00523 /// deleteValue - This method should be called whenever an LLVM Value is 00524 /// deleted from the program, for example when an instruction is found to be 00525 /// redundant and is eliminated. 00526 /// 00527 virtual void deleteValue(Value *V); 00528 00529 /// copyValue - This method should be used whenever a preexisting value in the 00530 /// program is copied or cloned, introducing a new value. Note that analysis 00531 /// implementations should tolerate clients that use this method to introduce 00532 /// the same value multiple times: if the analysis already knows about a 00533 /// value, it should ignore the request. 00534 /// 00535 virtual void copyValue(Value *From, Value *To); 00536 00537 /// addEscapingUse - This method should be used whenever an escaping use is 00538 /// added to a pointer value. Analysis implementations may either return 00539 /// conservative responses for that value in the future, or may recompute 00540 /// some or all internal state to continue providing precise responses. 00541 /// 00542 /// Escaping uses are considered by anything _except_ the following: 00543 /// - GEPs or bitcasts of the pointer 00544 /// - Loads through the pointer 00545 /// - Stores through (but not of) the pointer 00546 virtual void addEscapingUse(Use &U); 00547 00548 /// replaceWithNewValue - This method is the obvious combination of the two 00549 /// above, and it provided as a helper to simplify client code. 00550 /// 00551 void replaceWithNewValue(Value *Old, Value *New) { 00552 copyValue(Old, New); 00553 deleteValue(Old); 00554 } 00555 }; 00556 00557 // Specialize DenseMapInfo for Location. 00558 template<> 00559 struct DenseMapInfo<AliasAnalysis::Location> { 00560 static inline AliasAnalysis::Location getEmptyKey() { 00561 return 00562 AliasAnalysis::Location(DenseMapInfo<const Value *>::getEmptyKey(), 00563 0, 0); 00564 } 00565 static inline AliasAnalysis::Location getTombstoneKey() { 00566 return 00567 AliasAnalysis::Location(DenseMapInfo<const Value *>::getTombstoneKey(), 00568 0, 0); 00569 } 00570 static unsigned getHashValue(const AliasAnalysis::Location &Val) { 00571 return DenseMapInfo<const Value *>::getHashValue(Val.Ptr) ^ 00572 DenseMapInfo<uint64_t>::getHashValue(Val.Size) ^ 00573 DenseMapInfo<const MDNode *>::getHashValue(Val.TBAATag); 00574 } 00575 static bool isEqual(const AliasAnalysis::Location &LHS, 00576 const AliasAnalysis::Location &RHS) { 00577 return LHS.Ptr == RHS.Ptr && 00578 LHS.Size == RHS.Size && 00579 LHS.TBAATag == RHS.TBAATag; 00580 } 00581 }; 00582 00583 /// isNoAliasCall - Return true if this pointer is returned by a noalias 00584 /// function. 00585 bool isNoAliasCall(const Value *V); 00586 00587 /// isIdentifiedObject - Return true if this pointer refers to a distinct and 00588 /// identifiable object. This returns true for: 00589 /// Global Variables and Functions (but not Global Aliases) 00590 /// Allocas 00591 /// ByVal and NoAlias Arguments 00592 /// NoAlias returns (e.g. calls to malloc) 00593 /// 00594 bool isIdentifiedObject(const Value *V); 00595 00596 } // End llvm namespace 00597 00598 #endif