LLVM API Documentation

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