Move the capture analysis from MemoryDependencyAnalysis to a more general place
[oota-llvm.git] / include / llvm / Analysis / AliasAnalysis.h
1 //===- llvm/Analysis/AliasAnalysis.h - Alias Analysis Interface -*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the generic AliasAnalysis interface, which is used as the
11 // common interface used by all clients of alias analysis information, and
12 // implemented by all alias analysis implementations.  Mod/Ref information is
13 // also captured by this interface.
14 //
15 // Implementations of this interface must implement the various virtual methods,
16 // which automatically provides functionality for the entire suite of client
17 // APIs.
18 //
19 // This API identifies memory regions with the Location class. The pointer
20 // component specifies the base memory address of the region. The Size specifies
21 // the maximum size (in address units) of the memory region, or UnknownSize if
22 // the size is not known. The TBAA tag identifies the "type" of the memory
23 // reference; see the TypeBasedAliasAnalysis class for details.
24 //
25 // Some non-obvious details include:
26 //  - Pointers that point to two completely different objects in memory never
27 //    alias, regardless of the value of the Size component.
28 //  - NoAlias doesn't imply inequal pointers. The most obvious example of this
29 //    is two pointers to constant memory. Even if they are equal, constant
30 //    memory is never stored to, so there will never be any dependencies.
31 //    In this and other situations, the pointers may be both NoAlias and
32 //    MustAlias at the same time. The current API can only return one result,
33 //    though this is rarely a problem in practice.
34 //
35 //===----------------------------------------------------------------------===//
36
37 #ifndef LLVM_ANALYSIS_ALIAS_ANALYSIS_H
38 #define LLVM_ANALYSIS_ALIAS_ANALYSIS_H
39
40 #include "llvm/Support/CallSite.h"
41 #include "llvm/ADT/DenseMap.h"
42
43 namespace llvm {
44
45 class LoadInst;
46 class StoreInst;
47 class VAArgInst;
48 class TargetData;
49 class Pass;
50 class AnalysisUsage;
51 class MemTransferInst;
52 class MemIntrinsic;
53 class DominatorTree;
54
55 class AliasAnalysis {
56 protected:
57   const TargetData *TD;
58
59 private:
60   AliasAnalysis *AA;       // Previous Alias Analysis to chain to.
61
62 protected:
63   /// InitializeAliasAnalysis - Subclasses must call this method to initialize
64   /// the AliasAnalysis interface before any other methods are called.  This is
65   /// typically called by the run* methods of these subclasses.  This may be
66   /// called multiple times.
67   ///
68   void InitializeAliasAnalysis(Pass *P);
69
70   /// getAnalysisUsage - All alias analysis implementations should invoke this
71   /// directly (using AliasAnalysis::getAnalysisUsage(AU)).
72   virtual void getAnalysisUsage(AnalysisUsage &AU) const;
73
74 public:
75   static char ID; // Class identification, replacement for typeinfo
76   AliasAnalysis() : TD(0), AA(0) {}
77   virtual ~AliasAnalysis();  // We want to be subclassed
78
79   /// UnknownSize - This is a special value which can be used with the
80   /// size arguments in alias queries to indicate that the caller does not
81   /// know the sizes of the potential memory references.
82   static uint64_t const UnknownSize = ~UINT64_C(0);
83
84   /// getTargetData - Return a pointer to the current TargetData object, or
85   /// null if no TargetData object is available.
86   ///
87   const TargetData *getTargetData() const { return TD; }
88
89   /// getTypeStoreSize - Return the TargetData store size for the given type,
90   /// if known, or a conservative value otherwise.
91   ///
92   uint64_t getTypeStoreSize(Type *Ty);
93
94   //===--------------------------------------------------------------------===//
95   /// Alias Queries...
96   ///
97
98   /// Location - A description of a memory location.
99   struct Location {
100     /// Ptr - The address of the start of the location.
101     const Value *Ptr;
102     /// Size - The maximum size of the location, in address-units, or
103     /// UnknownSize if the size is not known.  Note that an unknown size does
104     /// not mean the pointer aliases the entire virtual address space, because
105     /// there are restrictions on stepping out of one object and into another.
106     /// See http://llvm.org/docs/LangRef.html#pointeraliasing
107     uint64_t Size;
108     /// TBAATag - The metadata node which describes the TBAA type of
109     /// the location, or null if there is no known unique tag.
110     const MDNode *TBAATag;
111
112     explicit Location(const Value *P = 0, uint64_t S = UnknownSize,
113                       const MDNode *N = 0)
114       : Ptr(P), Size(S), TBAATag(N) {}
115
116     Location getWithNewPtr(const Value *NewPtr) const {
117       Location Copy(*this);
118       Copy.Ptr = NewPtr;
119       return Copy;
120     }
121
122     Location getWithNewSize(uint64_t NewSize) const {
123       Location Copy(*this);
124       Copy.Size = NewSize;
125       return Copy;
126     }
127
128     Location getWithoutTBAATag() const {
129       Location Copy(*this);
130       Copy.TBAATag = 0;
131       return Copy;
132     }
133   };
134
135   /// getLocation - Fill in Loc with information about the memory reference by
136   /// the given instruction.
137   Location getLocation(const LoadInst *LI);
138   Location getLocation(const StoreInst *SI);
139   Location getLocation(const VAArgInst *VI);
140   Location getLocation(const AtomicCmpXchgInst *CXI);
141   Location getLocation(const AtomicRMWInst *RMWI);
142   static Location getLocationForSource(const MemTransferInst *MTI);
143   static Location getLocationForDest(const MemIntrinsic *MI);
144
145   /// Alias analysis result - Either we know for sure that it does not alias, we
146   /// know for sure it must alias, or we don't know anything: The two pointers
147   /// _might_ alias.  This enum is designed so you can do things like:
148   ///     if (AA.alias(P1, P2)) { ... }
149   /// to check to see if two pointers might alias.
150   ///
151   /// See docs/AliasAnalysis.html for more information on the specific meanings
152   /// of these values.
153   ///
154   enum AliasResult {
155     NoAlias = 0,        ///< No dependencies.
156     MayAlias,           ///< Anything goes.
157     PartialAlias,       ///< Pointers differ, but pointees overlap.
158     MustAlias           ///< Pointers are equal.
159   };
160
161   /// alias - The main low level interface to the alias analysis implementation.
162   /// Returns an AliasResult indicating whether the two pointers are aliased to
163   /// each other.  This is the interface that must be implemented by specific
164   /// alias analysis implementations.
165   virtual AliasResult alias(const Location &LocA, const Location &LocB);
166
167   /// alias - A convenience wrapper.
168   AliasResult alias(const Value *V1, uint64_t V1Size,
169                     const Value *V2, uint64_t V2Size) {
170     return alias(Location(V1, V1Size), Location(V2, V2Size));
171   }
172
173   /// alias - A convenience wrapper.
174   AliasResult alias(const Value *V1, const Value *V2) {
175     return alias(V1, UnknownSize, V2, UnknownSize);
176   }
177
178   /// isNoAlias - A trivial helper function to check to see if the specified
179   /// pointers are no-alias.
180   bool isNoAlias(const Location &LocA, const Location &LocB) {
181     return alias(LocA, LocB) == NoAlias;
182   }
183
184   /// isNoAlias - A convenience wrapper.
185   bool isNoAlias(const Value *V1, uint64_t V1Size,
186                  const Value *V2, uint64_t V2Size) {
187     return isNoAlias(Location(V1, V1Size), Location(V2, V2Size));
188   }
189   
190   /// isMustAlias - A convenience wrapper.
191   bool isMustAlias(const Location &LocA, const Location &LocB) {
192     return alias(LocA, LocB) == MustAlias;
193   }
194
195   /// isMustAlias - A convenience wrapper.
196   bool isMustAlias(const Value *V1, const Value *V2) {
197     return alias(V1, 1, V2, 1) == MustAlias;
198   }
199   
200   /// pointsToConstantMemory - If the specified memory location is
201   /// known to be constant, return true. If OrLocal is true and the
202   /// specified memory location is known to be "local" (derived from
203   /// an alloca), return true. Otherwise return false.
204   virtual bool pointsToConstantMemory(const Location &Loc,
205                                       bool OrLocal = false);
206
207   /// pointsToConstantMemory - A convenient wrapper.
208   bool pointsToConstantMemory(const Value *P, bool OrLocal = false) {
209     return pointsToConstantMemory(Location(P), OrLocal);
210   }
211
212   //===--------------------------------------------------------------------===//
213   /// Simple mod/ref information...
214   ///
215
216   /// ModRefResult - Represent the result of a mod/ref query.  Mod and Ref are
217   /// bits which may be or'd together.
218   ///
219   enum ModRefResult { NoModRef = 0, Ref = 1, Mod = 2, ModRef = 3 };
220
221   /// These values define additional bits used to define the
222   /// ModRefBehavior values.
223   enum { Nowhere = 0, ArgumentPointees = 4, Anywhere = 8 | ArgumentPointees };
224
225   /// ModRefBehavior - Summary of how a function affects memory in the program.
226   /// Loads from constant globals are not considered memory accesses for this
227   /// interface.  Also, functions may freely modify stack space local to their
228   /// invocation without having to report it through these interfaces.
229   enum ModRefBehavior {
230     /// DoesNotAccessMemory - This function does not perform any non-local loads
231     /// or stores to memory.
232     ///
233     /// This property corresponds to the GCC 'const' attribute.
234     /// This property corresponds to the LLVM IR 'readnone' attribute.
235     /// This property corresponds to the IntrNoMem LLVM intrinsic flag.
236     DoesNotAccessMemory = Nowhere | NoModRef,
237
238     /// OnlyReadsArgumentPointees - The only memory references in this function
239     /// (if it has any) are non-volatile loads from objects pointed to by its
240     /// pointer-typed arguments, with arbitrary offsets.
241     ///
242     /// This property corresponds to the IntrReadArgMem LLVM intrinsic flag.
243     OnlyReadsArgumentPointees = ArgumentPointees | Ref,
244
245     /// OnlyAccessesArgumentPointees - The only memory references in this
246     /// function (if it has any) are non-volatile loads and stores from objects
247     /// pointed to by its pointer-typed arguments, with arbitrary offsets.
248     ///
249     /// This property corresponds to the IntrReadWriteArgMem LLVM intrinsic flag.
250     OnlyAccessesArgumentPointees = ArgumentPointees | ModRef,
251
252     /// OnlyReadsMemory - This function does not perform any non-local stores or
253     /// volatile loads, but may read from any memory location.
254     ///
255     /// This property corresponds to the GCC 'pure' attribute.
256     /// This property corresponds to the LLVM IR 'readonly' attribute.
257     /// This property corresponds to the IntrReadMem LLVM intrinsic flag.
258     OnlyReadsMemory = Anywhere | Ref,
259
260     /// UnknownModRefBehavior - This indicates that the function could not be
261     /// classified into one of the behaviors above.
262     UnknownModRefBehavior = Anywhere | ModRef
263   };
264
265   /// getModRefBehavior - Return the behavior when calling the given call site.
266   virtual ModRefBehavior getModRefBehavior(ImmutableCallSite CS);
267
268   /// getModRefBehavior - Return the behavior when calling the given function.
269   /// For use when the call site is not known.
270   virtual ModRefBehavior getModRefBehavior(const Function *F);
271
272   /// doesNotAccessMemory - If the specified call is known to never read or
273   /// write memory, return true.  If the call only reads from known-constant
274   /// memory, it is also legal to return true.  Calls that unwind the stack
275   /// are legal for this predicate.
276   ///
277   /// Many optimizations (such as CSE and LICM) can be performed on such calls
278   /// without worrying about aliasing properties, and many calls have this
279   /// property (e.g. calls to 'sin' and 'cos').
280   ///
281   /// This property corresponds to the GCC 'const' attribute.
282   ///
283   bool doesNotAccessMemory(ImmutableCallSite CS) {
284     return getModRefBehavior(CS) == DoesNotAccessMemory;
285   }
286
287   /// doesNotAccessMemory - If the specified function is known to never read or
288   /// write memory, return true.  For use when the call site is not known.
289   ///
290   bool doesNotAccessMemory(const Function *F) {
291     return getModRefBehavior(F) == DoesNotAccessMemory;
292   }
293
294   /// onlyReadsMemory - If the specified call is known to only read from
295   /// non-volatile memory (or not access memory at all), return true.  Calls
296   /// that unwind the stack are legal for this predicate.
297   ///
298   /// This property allows many common optimizations to be performed in the
299   /// absence of interfering store instructions, such as CSE of strlen calls.
300   ///
301   /// This property corresponds to the GCC 'pure' attribute.
302   ///
303   bool onlyReadsMemory(ImmutableCallSite CS) {
304     return onlyReadsMemory(getModRefBehavior(CS));
305   }
306
307   /// onlyReadsMemory - If the specified function is known to only read from
308   /// non-volatile memory (or not access memory at all), return true.  For use
309   /// when the call site is not known.
310   ///
311   bool onlyReadsMemory(const Function *F) {
312     return onlyReadsMemory(getModRefBehavior(F));
313   }
314
315   /// onlyReadsMemory - Return true if functions with the specified behavior are
316   /// known to only read from non-volatile memory (or not access memory at all).
317   ///
318   static bool onlyReadsMemory(ModRefBehavior MRB) {
319     return !(MRB & Mod);
320   }
321
322   /// onlyAccessesArgPointees - Return true if functions with the specified
323   /// behavior are known to read and write at most from objects pointed to by
324   /// their pointer-typed arguments (with arbitrary offsets).
325   ///
326   static bool onlyAccessesArgPointees(ModRefBehavior MRB) {
327     return !(MRB & Anywhere & ~ArgumentPointees);
328   }
329
330   /// doesAccessArgPointees - Return true if functions with the specified
331   /// behavior are known to potentially read or write from objects pointed
332   /// to be their pointer-typed arguments (with arbitrary offsets).
333   ///
334   static bool doesAccessArgPointees(ModRefBehavior MRB) {
335     return (MRB & ModRef) && (MRB & ArgumentPointees);
336   }
337
338   /// getModRefInfo - Return information about whether or not an instruction may
339   /// read or write the specified memory location.  An instruction
340   /// that doesn't read or write memory may be trivially LICM'd for example.
341   ModRefResult getModRefInfo(const Instruction *I,
342                              const Location &Loc) {
343     switch (I->getOpcode()) {
344     case Instruction::VAArg:  return getModRefInfo((const VAArgInst*)I, Loc);
345     case Instruction::Load:   return getModRefInfo((const LoadInst*)I,  Loc);
346     case Instruction::Store:  return getModRefInfo((const StoreInst*)I, Loc);
347     case Instruction::Fence:  return getModRefInfo((const FenceInst*)I, Loc);
348     case Instruction::AtomicCmpXchg:
349       return getModRefInfo((const AtomicCmpXchgInst*)I, Loc);
350     case Instruction::AtomicRMW:
351       return getModRefInfo((const AtomicRMWInst*)I, Loc);
352     case Instruction::Call:   return getModRefInfo((const CallInst*)I,  Loc);
353     case Instruction::Invoke: return getModRefInfo((const InvokeInst*)I,Loc);
354     default:                  return NoModRef;
355     }
356   }
357
358   /// getModRefInfo - A convenience wrapper.
359   ModRefResult getModRefInfo(const Instruction *I,
360                              const Value *P, uint64_t Size) {
361     return getModRefInfo(I, Location(P, Size));
362   }
363
364   /// getModRefInfo (for call sites) - Return whether information about whether
365   /// a particular call site modifies or reads the specified memory location.
366   virtual ModRefResult getModRefInfo(ImmutableCallSite CS,
367                                      const Location &Loc);
368
369   /// getModRefInfo (for call sites) - A convenience wrapper.
370   ModRefResult getModRefInfo(ImmutableCallSite CS,
371                              const Value *P, uint64_t Size) {
372     return getModRefInfo(CS, Location(P, Size));
373   }
374
375   /// getModRefInfo (for calls) - Return whether information about whether
376   /// a particular call modifies or reads the specified memory location.
377   ModRefResult getModRefInfo(const CallInst *C, const Location &Loc) {
378     return getModRefInfo(ImmutableCallSite(C), Loc);
379   }
380
381   /// getModRefInfo (for calls) - A convenience wrapper.
382   ModRefResult getModRefInfo(const CallInst *C, const Value *P, uint64_t Size) {
383     return getModRefInfo(C, Location(P, Size));
384   }
385
386   /// getModRefInfo (for invokes) - Return whether information about whether
387   /// a particular invoke modifies or reads the specified memory location.
388   ModRefResult getModRefInfo(const InvokeInst *I,
389                              const Location &Loc) {
390     return getModRefInfo(ImmutableCallSite(I), Loc);
391   }
392
393   /// getModRefInfo (for invokes) - A convenience wrapper.
394   ModRefResult getModRefInfo(const InvokeInst *I,
395                              const Value *P, uint64_t Size) {
396     return getModRefInfo(I, Location(P, Size));
397   }
398
399   /// getModRefInfo (for loads) - Return whether information about whether
400   /// a particular load modifies or reads the specified memory location.
401   ModRefResult getModRefInfo(const LoadInst *L, const Location &Loc);
402
403   /// getModRefInfo (for loads) - A convenience wrapper.
404   ModRefResult getModRefInfo(const LoadInst *L, const Value *P, uint64_t Size) {
405     return getModRefInfo(L, Location(P, Size));
406   }
407
408   /// getModRefInfo (for stores) - Return whether information about whether
409   /// a particular store modifies or reads the specified memory location.
410   ModRefResult getModRefInfo(const StoreInst *S, const Location &Loc);
411
412   /// getModRefInfo (for stores) - A convenience wrapper.
413   ModRefResult getModRefInfo(const StoreInst *S, const Value *P, uint64_t Size){
414     return getModRefInfo(S, Location(P, Size));
415   }
416
417   /// getModRefInfo (for fences) - Return whether information about whether
418   /// a particular store modifies or reads the specified memory location.
419   ModRefResult getModRefInfo(const FenceInst *S, const Location &Loc) {
420     // Conservatively correct.  (We could possibly be a bit smarter if
421     // Loc is a alloca that doesn't escape.)
422     return ModRef;
423   }
424
425   /// getModRefInfo (for fences) - A convenience wrapper.
426   ModRefResult getModRefInfo(const FenceInst *S, const Value *P, uint64_t Size){
427     return getModRefInfo(S, Location(P, Size));
428   }
429
430   /// getModRefInfo (for cmpxchges) - Return whether information about whether
431   /// a particular cmpxchg modifies or reads the specified memory location.
432   ModRefResult getModRefInfo(const AtomicCmpXchgInst *CX, const Location &Loc);
433
434   /// getModRefInfo (for cmpxchges) - A convenience wrapper.
435   ModRefResult getModRefInfo(const AtomicCmpXchgInst *CX,
436                              const Value *P, unsigned Size) {
437     return getModRefInfo(CX, Location(P, Size));
438   }
439
440   /// getModRefInfo (for atomicrmws) - Return whether information about whether
441   /// a particular atomicrmw modifies or reads the specified memory location.
442   ModRefResult getModRefInfo(const AtomicRMWInst *RMW, const Location &Loc);
443
444   /// getModRefInfo (for atomicrmws) - A convenience wrapper.
445   ModRefResult getModRefInfo(const AtomicRMWInst *RMW,
446                              const Value *P, unsigned Size) {
447     return getModRefInfo(RMW, Location(P, Size));
448   }
449
450   /// getModRefInfo (for va_args) - Return whether information about whether
451   /// a particular va_arg modifies or reads the specified memory location.
452   ModRefResult getModRefInfo(const VAArgInst* I, const Location &Loc);
453
454   /// getModRefInfo (for va_args) - A convenience wrapper.
455   ModRefResult getModRefInfo(const VAArgInst* I, const Value* P, uint64_t Size){
456     return getModRefInfo(I, Location(P, Size));
457   }
458
459   /// getModRefInfo - Return information about whether two call sites may refer
460   /// to the same set of memory locations.  See 
461   ///   http://llvm.org/docs/AliasAnalysis.html#ModRefInfo
462   /// for details.
463   virtual ModRefResult getModRefInfo(ImmutableCallSite CS1,
464                                      ImmutableCallSite CS2);
465
466   /// callCapturesBefore - Return information about whether a particular call 
467   /// site modifies or reads the specified memory location.
468   ModRefResult callCapturesBefore(const Instruction *I,
469                                   const AliasAnalysis::Location &MemLoc,
470                                   DominatorTree *DT);
471
472   /// callCapturesBefore - A convenience wrapper.
473   ModRefResult callCapturesBefore(const Instruction *I, const Value *P,
474                                   uint64_t Size, DominatorTree *DT) {
475     return callCapturesBefore(I, Location(P, Size), DT);
476   }
477
478   //===--------------------------------------------------------------------===//
479   /// Higher level methods for querying mod/ref information.
480   ///
481
482   /// canBasicBlockModify - Return true if it is possible for execution of the
483   /// specified basic block to modify the value pointed to by Ptr.
484   bool canBasicBlockModify(const BasicBlock &BB, const Location &Loc);
485
486   /// canBasicBlockModify - A convenience wrapper.
487   bool canBasicBlockModify(const BasicBlock &BB, const Value *P, uint64_t Size){
488     return canBasicBlockModify(BB, Location(P, Size));
489   }
490
491   /// canInstructionRangeModify - Return true if it is possible for the
492   /// execution of the specified instructions to modify the value pointed to by
493   /// Ptr.  The instructions to consider are all of the instructions in the
494   /// range of [I1,I2] INCLUSIVE.  I1 and I2 must be in the same basic block.
495   bool canInstructionRangeModify(const Instruction &I1, const Instruction &I2,
496                                  const Location &Loc);
497
498   /// canInstructionRangeModify - A convenience wrapper.
499   bool canInstructionRangeModify(const Instruction &I1, const Instruction &I2,
500                                  const Value *Ptr, uint64_t Size) {
501     return canInstructionRangeModify(I1, I2, Location(Ptr, Size));
502   }
503
504   //===--------------------------------------------------------------------===//
505   /// Methods that clients should call when they transform the program to allow
506   /// alias analyses to update their internal data structures.  Note that these
507   /// methods may be called on any instruction, regardless of whether or not
508   /// they have pointer-analysis implications.
509   ///
510
511   /// deleteValue - This method should be called whenever an LLVM Value is
512   /// deleted from the program, for example when an instruction is found to be
513   /// redundant and is eliminated.
514   ///
515   virtual void deleteValue(Value *V);
516
517   /// copyValue - This method should be used whenever a preexisting value in the
518   /// program is copied or cloned, introducing a new value.  Note that analysis
519   /// implementations should tolerate clients that use this method to introduce
520   /// the same value multiple times: if the analysis already knows about a
521   /// value, it should ignore the request.
522   ///
523   virtual void copyValue(Value *From, Value *To);
524
525   /// addEscapingUse - This method should be used whenever an escaping use is
526   /// added to a pointer value.  Analysis implementations may either return
527   /// conservative responses for that value in the future, or may recompute
528   /// some or all internal state to continue providing precise responses.
529   ///
530   /// Escaping uses are considered by anything _except_ the following:
531   ///  - GEPs or bitcasts of the pointer
532   ///  - Loads through the pointer
533   ///  - Stores through (but not of) the pointer
534   virtual void addEscapingUse(Use &U);
535
536   /// replaceWithNewValue - This method is the obvious combination of the two
537   /// above, and it provided as a helper to simplify client code.
538   ///
539   void replaceWithNewValue(Value *Old, Value *New) {
540     copyValue(Old, New);
541     deleteValue(Old);
542   }
543 };
544
545 // Specialize DenseMapInfo for Location.
546 template<>
547 struct DenseMapInfo<AliasAnalysis::Location> {
548   static inline AliasAnalysis::Location getEmptyKey() {
549     return
550       AliasAnalysis::Location(DenseMapInfo<const Value *>::getEmptyKey(),
551                               0, 0);
552   }
553   static inline AliasAnalysis::Location getTombstoneKey() {
554     return
555       AliasAnalysis::Location(DenseMapInfo<const Value *>::getTombstoneKey(),
556                               0, 0);
557   }
558   static unsigned getHashValue(const AliasAnalysis::Location &Val) {
559     return DenseMapInfo<const Value *>::getHashValue(Val.Ptr) ^
560            DenseMapInfo<uint64_t>::getHashValue(Val.Size) ^
561            DenseMapInfo<const MDNode *>::getHashValue(Val.TBAATag);
562   }
563   static bool isEqual(const AliasAnalysis::Location &LHS,
564                       const AliasAnalysis::Location &RHS) {
565     return LHS.Ptr == RHS.Ptr &&
566            LHS.Size == RHS.Size &&
567            LHS.TBAATag == RHS.TBAATag;
568   }
569 };
570
571 /// isNoAliasCall - Return true if this pointer is returned by a noalias
572 /// function.
573 bool isNoAliasCall(const Value *V);
574
575 /// isIdentifiedObject - Return true if this pointer refers to a distinct and
576 /// identifiable object.  This returns true for:
577 ///    Global Variables and Functions (but not Global Aliases)
578 ///    Allocas and Mallocs
579 ///    ByVal and NoAlias Arguments
580 ///    NoAlias returns
581 ///
582 bool isIdentifiedObject(const Value *V);
583
584 /// isKnownNonNull - Return true if this pointer couldn't possibly be null by
585 /// its definition.  This returns true for allocas, non-extern-weak globals and
586 /// byval arguments.
587 bool isKnownNonNull(const Value *V);
588
589 } // End llvm namespace
590
591 #endif