LLVM  3.7.0
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 MemoryLocation 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
22 // MemoryLocation::UnknownSize if the size is not known. The TBAA tag
23 // identifies the "type" of the memory reference; see the
24 // TypeBasedAliasAnalysis class for details.
25 //
26 // Some non-obvious details include:
27 // - Pointers that point to two completely different objects in memory never
28 // alias, regardless of the value of the Size component.
29 // - NoAlias doesn't imply inequal pointers. The most obvious example of this
30 // is two pointers to constant memory. Even if they are equal, constant
31 // memory is never stored to, so there will never be any dependencies.
32 // In this and other situations, the pointers may be both NoAlias and
33 // MustAlias at the same time. The current API can only return one result,
34 // though this is rarely a problem in practice.
35 //
36 //===----------------------------------------------------------------------===//
37 
38 #ifndef LLVM_ANALYSIS_ALIASANALYSIS_H
39 #define LLVM_ANALYSIS_ALIASANALYSIS_H
40 
41 #include "llvm/ADT/DenseMap.h"
42 #include "llvm/IR/CallSite.h"
43 #include "llvm/IR/Metadata.h"
45 
46 namespace llvm {
47 
48 class LoadInst;
49 class StoreInst;
50 class VAArgInst;
51 class DataLayout;
52 class TargetLibraryInfo;
53 class Pass;
54 class AnalysisUsage;
55 class MemTransferInst;
56 class MemIntrinsic;
57 class DominatorTree;
58 
59 /// The possible results of an alias query.
60 ///
61 /// These results are always computed between two MemoryLocation objects as
62 /// a query to some alias analysis.
63 ///
64 /// Note that these are unscoped enumerations because we would like to support
65 /// implicitly testing a result for the existence of any possible aliasing with
66 /// a conversion to bool, but an "enum class" doesn't support this. The
67 /// canonical names from the literature are suffixed and unique anyways, and so
68 /// they serve as global constants in LLVM for these results.
69 ///
70 /// See docs/AliasAnalysis.html for more information on the specific meanings
71 /// of these values.
73  /// The two locations do not alias at all.
74  ///
75  /// This value is arranged to convert to false, while all other values
76  /// convert to true. This allows a boolean context to convert the result to
77  /// a binary flag indicating whether there is the possibility of aliasing.
78  NoAlias = 0,
79  /// The two locations may or may not alias. This is the least precise result.
81  /// The two locations alias, but only due to a partial overlap.
83  /// The two locations precisely alias each other.
85 };
86 
88 protected:
89  const DataLayout *DL;
91 
92 private:
93  AliasAnalysis *AA; // Previous Alias Analysis to chain to.
94 
95 protected:
96  /// InitializeAliasAnalysis - Subclasses must call this method to initialize
97  /// the AliasAnalysis interface before any other methods are called. This is
98  /// typically called by the run* methods of these subclasses. This may be
99  /// called multiple times.
100  ///
101  void InitializeAliasAnalysis(Pass *P, const DataLayout *DL);
102 
103  /// getAnalysisUsage - All alias analysis implementations should invoke this
104  /// directly (using AliasAnalysis::getAnalysisUsage(AU)).
105  virtual void getAnalysisUsage(AnalysisUsage &AU) const;
106 
107 public:
108  static char ID; // Class identification, replacement for typeinfo
109  AliasAnalysis() : DL(nullptr), TLI(nullptr), AA(nullptr) {}
110  virtual ~AliasAnalysis(); // We want to be subclassed
111 
112  /// getTargetLibraryInfo - Return a pointer to the current TargetLibraryInfo
113  /// object, or null if no TargetLibraryInfo object is available.
114  ///
115  const TargetLibraryInfo *getTargetLibraryInfo() const { return TLI; }
116 
117  /// getTypeStoreSize - Return the DataLayout store size for the given type,
118  /// if known, or a conservative value otherwise.
119  ///
120  uint64_t getTypeStoreSize(Type *Ty);
121 
122  //===--------------------------------------------------------------------===//
123  /// Alias Queries...
124  ///
125 
126  /// alias - The main low level interface to the alias analysis implementation.
127  /// Returns an AliasResult indicating whether the two pointers are aliased to
128  /// each other. This is the interface that must be implemented by specific
129  /// alias analysis implementations.
130  virtual AliasResult alias(const MemoryLocation &LocA,
131  const MemoryLocation &LocB);
132 
133  /// alias - A convenience wrapper.
134  AliasResult alias(const Value *V1, uint64_t V1Size,
135  const Value *V2, uint64_t V2Size) {
136  return alias(MemoryLocation(V1, V1Size), MemoryLocation(V2, V2Size));
137  }
138 
139  /// alias - A convenience wrapper.
140  AliasResult alias(const Value *V1, const Value *V2) {
141  return alias(V1, MemoryLocation::UnknownSize, V2,
143  }
144 
145  /// isNoAlias - A trivial helper function to check to see if the specified
146  /// pointers are no-alias.
147  bool isNoAlias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
148  return alias(LocA, LocB) == NoAlias;
149  }
150 
151  /// isNoAlias - A convenience wrapper.
152  bool isNoAlias(const Value *V1, uint64_t V1Size,
153  const Value *V2, uint64_t V2Size) {
154  return isNoAlias(MemoryLocation(V1, V1Size), MemoryLocation(V2, V2Size));
155  }
156 
157  /// isNoAlias - A convenience wrapper.
158  bool isNoAlias(const Value *V1, const Value *V2) {
159  return isNoAlias(MemoryLocation(V1), MemoryLocation(V2));
160  }
161 
162  /// isMustAlias - A convenience wrapper.
163  bool isMustAlias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
164  return alias(LocA, LocB) == MustAlias;
165  }
166 
167  /// isMustAlias - A convenience wrapper.
168  bool isMustAlias(const Value *V1, const Value *V2) {
169  return alias(V1, 1, V2, 1) == MustAlias;
170  }
171 
172  /// pointsToConstantMemory - If the specified memory location is
173  /// known to be constant, return true. If OrLocal is true and the
174  /// specified memory location is known to be "local" (derived from
175  /// an alloca), return true. Otherwise return false.
176  virtual bool pointsToConstantMemory(const MemoryLocation &Loc,
177  bool OrLocal = false);
178 
179  /// pointsToConstantMemory - A convenient wrapper.
180  bool pointsToConstantMemory(const Value *P, bool OrLocal = false) {
181  return pointsToConstantMemory(MemoryLocation(P), OrLocal);
182  }
183 
184  //===--------------------------------------------------------------------===//
185  /// Simple mod/ref information...
186  ///
187 
188  /// ModRefResult - Represent the result of a mod/ref query. Mod and Ref are
189  /// bits which may be or'd together.
190  ///
191  enum ModRefResult { NoModRef = 0, Ref = 1, Mod = 2, ModRef = 3 };
192 
193  /// These values define additional bits used to define the
194  /// ModRefBehavior values.
196 
197  /// ModRefBehavior - Summary of how a function affects memory in the program.
198  /// Loads from constant globals are not considered memory accesses for this
199  /// interface. Also, functions may freely modify stack space local to their
200  /// invocation without having to report it through these interfaces.
202  /// DoesNotAccessMemory - This function does not perform any non-local loads
203  /// or stores to memory.
204  ///
205  /// This property corresponds to the GCC 'const' attribute.
206  /// This property corresponds to the LLVM IR 'readnone' attribute.
207  /// This property corresponds to the IntrNoMem LLVM intrinsic flag.
209 
210  /// OnlyReadsArgumentPointees - The only memory references in this function
211  /// (if it has any) are non-volatile loads from objects pointed to by its
212  /// pointer-typed arguments, with arbitrary offsets.
213  ///
214  /// This property corresponds to the LLVM IR 'argmemonly' attribute combined
215  /// with 'readonly' attribute.
216  /// This property corresponds to the IntrReadArgMem LLVM intrinsic flag.
218 
219  /// OnlyAccessesArgumentPointees - The only memory references in this
220  /// function (if it has any) are non-volatile loads and stores from objects
221  /// pointed to by its pointer-typed arguments, with arbitrary offsets.
222  ///
223  /// This property corresponds to the LLVM IR 'argmemonly' attribute.
224  /// This property corresponds to the IntrReadWriteArgMem LLVM intrinsic flag.
226 
227  /// OnlyReadsMemory - This function does not perform any non-local stores or
228  /// volatile loads, but may read from any memory location.
229  ///
230  /// This property corresponds to the GCC 'pure' attribute.
231  /// This property corresponds to the LLVM IR 'readonly' attribute.
232  /// This property corresponds to the IntrReadMem LLVM intrinsic flag.
234 
235  /// UnknownModRefBehavior - This indicates that the function could not be
236  /// classified into one of the behaviors above.
238  };
239 
240  /// Get the ModRef info associated with a pointer argument of a callsite. The
241  /// result's bits are set to indicate the allowed aliasing ModRef kinds. Note
242  /// that these bits do not necessarily account for the overall behavior of
243  /// the function, but rather only provide additional per-argument
244  /// information.
245  virtual ModRefResult getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx);
246 
247  /// getModRefBehavior - Return the behavior when calling the given call site.
249 
250  /// getModRefBehavior - Return the behavior when calling the given function.
251  /// For use when the call site is not known.
252  virtual ModRefBehavior getModRefBehavior(const Function *F);
253 
254  /// doesNotAccessMemory - If the specified call is known to never read or
255  /// write memory, return true. If the call only reads from known-constant
256  /// memory, it is also legal to return true. Calls that unwind the stack
257  /// are legal for this predicate.
258  ///
259  /// Many optimizations (such as CSE and LICM) can be performed on such calls
260  /// without worrying about aliasing properties, and many calls have this
261  /// property (e.g. calls to 'sin' and 'cos').
262  ///
263  /// This property corresponds to the GCC 'const' attribute.
264  ///
267  }
268 
269  /// doesNotAccessMemory - If the specified function is known to never read or
270  /// write memory, return true. For use when the call site is not known.
271  ///
274  }
275 
276  /// onlyReadsMemory - If the specified call is known to only read from
277  /// non-volatile memory (or not access memory at all), return true. Calls
278  /// that unwind the stack are legal for this predicate.
279  ///
280  /// This property allows many common optimizations to be performed in the
281  /// absence of interfering store instructions, such as CSE of strlen calls.
282  ///
283  /// This property corresponds to the GCC 'pure' attribute.
284  ///
287  }
288 
289  /// onlyReadsMemory - If the specified function is known to only read from
290  /// non-volatile memory (or not access memory at all), return true. For use
291  /// when the call site is not known.
292  ///
293  bool onlyReadsMemory(const Function *F) {
295  }
296 
297  /// onlyReadsMemory - Return true if functions with the specified behavior are
298  /// known to only read from non-volatile memory (or not access memory at all).
299  ///
300  static bool onlyReadsMemory(ModRefBehavior MRB) {
301  return !(MRB & Mod);
302  }
303 
304  /// onlyAccessesArgPointees - Return true if functions with the specified
305  /// behavior are known to read and write at most from objects pointed to by
306  /// their pointer-typed arguments (with arbitrary offsets).
307  ///
309  return !(MRB & Anywhere & ~ArgumentPointees);
310  }
311 
312  /// doesAccessArgPointees - Return true if functions with the specified
313  /// behavior are known to potentially read or write from objects pointed
314  /// to be their pointer-typed arguments (with arbitrary offsets).
315  ///
317  return (MRB & ModRef) && (MRB & ArgumentPointees);
318  }
319 
320  /// getModRefInfo - Return information about whether or not an
321  /// instruction may read or write memory (without regard to a
322  /// specific location)
324  if (auto CS = ImmutableCallSite(I)) {
325  auto MRB = getModRefBehavior(CS);
326  if (MRB & ModRef)
327  return ModRef;
328  else if (MRB & Ref)
329  return Ref;
330  else if (MRB & Mod)
331  return Mod;
332  return NoModRef;
333  }
334 
335  return getModRefInfo(I, MemoryLocation());
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.
342  switch (I->getOpcode()) {
343  case Instruction::VAArg: return getModRefInfo((const VAArgInst*)I, Loc);
344  case Instruction::Load: return getModRefInfo((const LoadInst*)I, Loc);
345  case Instruction::Store: return getModRefInfo((const StoreInst*)I, Loc);
346  case Instruction::Fence: return getModRefInfo((const FenceInst*)I, Loc);
347  case Instruction::AtomicCmpXchg:
348  return getModRefInfo((const AtomicCmpXchgInst*)I, Loc);
349  case Instruction::AtomicRMW:
350  return getModRefInfo((const AtomicRMWInst*)I, Loc);
351  case Instruction::Call: return getModRefInfo((const CallInst*)I, Loc);
352  case Instruction::Invoke: return getModRefInfo((const InvokeInst*)I,Loc);
353  default: return NoModRef;
354  }
355  }
356 
357  /// getModRefInfo - A convenience wrapper.
359  const Value *P, uint64_t Size) {
360  return getModRefInfo(I, MemoryLocation(P, Size));
361  }
362 
363  /// getModRefInfo (for call sites) - Return information about whether
364  /// a particular call site modifies or reads the specified memory location.
366  const MemoryLocation &Loc);
367 
368  /// getModRefInfo (for call sites) - A convenience wrapper.
370  const Value *P, uint64_t Size) {
371  return getModRefInfo(CS, MemoryLocation(P, Size));
372  }
373 
374  /// getModRefInfo (for calls) - Return information about whether
375  /// a particular call modifies or reads the specified memory location.
377  return getModRefInfo(ImmutableCallSite(C), Loc);
378  }
379 
380  /// getModRefInfo (for calls) - A convenience wrapper.
381  ModRefResult getModRefInfo(const CallInst *C, const Value *P, uint64_t Size) {
382  return getModRefInfo(C, MemoryLocation(P, Size));
383  }
384 
385  /// getModRefInfo (for invokes) - Return information about whether
386  /// a particular invoke modifies or reads the specified memory location.
388  return getModRefInfo(ImmutableCallSite(I), Loc);
389  }
390 
391  /// getModRefInfo (for invokes) - A convenience wrapper.
393  const Value *P, uint64_t Size) {
394  return getModRefInfo(I, MemoryLocation(P, Size));
395  }
396 
397  /// getModRefInfo (for loads) - Return information about whether
398  /// a particular load modifies or reads the specified memory location.
399  ModRefResult getModRefInfo(const LoadInst *L, const MemoryLocation &Loc);
400 
401  /// getModRefInfo (for loads) - A convenience wrapper.
402  ModRefResult getModRefInfo(const LoadInst *L, const Value *P, uint64_t Size) {
403  return getModRefInfo(L, MemoryLocation(P, Size));
404  }
405 
406  /// getModRefInfo (for stores) - Return information about whether
407  /// a particular store modifies or reads the specified memory location.
408  ModRefResult getModRefInfo(const StoreInst *S, const MemoryLocation &Loc);
409 
410  /// getModRefInfo (for stores) - A convenience wrapper.
411  ModRefResult getModRefInfo(const StoreInst *S, const Value *P, uint64_t Size){
412  return getModRefInfo(S, MemoryLocation(P, Size));
413  }
414 
415  /// getModRefInfo (for fences) - Return information about whether
416  /// a particular store modifies or reads the specified memory location.
418  // Conservatively correct. (We could possibly be a bit smarter if
419  // Loc is a alloca that doesn't escape.)
420  return ModRef;
421  }
422 
423  /// getModRefInfo (for fences) - A convenience wrapper.
424  ModRefResult getModRefInfo(const FenceInst *S, const Value *P, uint64_t Size){
425  return getModRefInfo(S, MemoryLocation(P, Size));
426  }
427 
428  /// getModRefInfo (for cmpxchges) - Return information about whether
429  /// a particular cmpxchg modifies or reads the specified memory location.
431  const MemoryLocation &Loc);
432 
433  /// getModRefInfo (for cmpxchges) - A convenience wrapper.
435  const Value *P, unsigned Size) {
436  return getModRefInfo(CX, MemoryLocation(P, Size));
437  }
438 
439  /// getModRefInfo (for atomicrmws) - Return information about whether
440  /// a particular atomicrmw modifies or reads the specified memory location.
442  const MemoryLocation &Loc);
443 
444  /// getModRefInfo (for atomicrmws) - A convenience wrapper.
446  const Value *P, unsigned Size) {
447  return getModRefInfo(RMW, MemoryLocation(P, Size));
448  }
449 
450  /// getModRefInfo (for va_args) - Return information about whether
451  /// a particular va_arg modifies or reads the specified memory location.
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, MemoryLocation(P, Size));
457  }
458  /// getModRefInfo - Return information about whether a call and an instruction
459  /// may refer to the same memory locations.
462 
463  /// getModRefInfo - Return information about whether two call sites may refer
464  /// to the same set of memory locations. See
465  /// http://llvm.org/docs/AliasAnalysis.html#ModRefInfo
466  /// for details.
468  ImmutableCallSite CS2);
469 
470  /// callCapturesBefore - Return information about whether a particular call
471  /// site modifies or reads the specified memory location.
473  const MemoryLocation &MemLoc,
474  DominatorTree *DT);
475 
476  /// callCapturesBefore - A convenience wrapper.
478  uint64_t Size, DominatorTree *DT) {
479  return callCapturesBefore(I, MemoryLocation(P, Size), DT);
480  }
481 
482  //===--------------------------------------------------------------------===//
483  /// Higher level methods for querying mod/ref information.
484  ///
485 
486  /// canBasicBlockModify - Return true if it is possible for execution of the
487  /// specified basic block to modify the location Loc.
488  bool canBasicBlockModify(const BasicBlock &BB, const MemoryLocation &Loc);
489 
490  /// canBasicBlockModify - A convenience wrapper.
491  bool canBasicBlockModify(const BasicBlock &BB, const Value *P, uint64_t Size){
492  return canBasicBlockModify(BB, MemoryLocation(P, Size));
493  }
494 
495  /// canInstructionRangeModRef - Return true if it is possible for the
496  /// execution of the specified instructions to mod\ref (according to the
497  /// mode) the location Loc. The instructions to consider are all
498  /// of the instructions in the range of [I1,I2] INCLUSIVE.
499  /// I1 and I2 must be in the same basic block.
500  bool canInstructionRangeModRef(const Instruction &I1, const Instruction &I2,
501  const MemoryLocation &Loc,
502  const ModRefResult Mode);
503 
504  /// canInstructionRangeModRef - A convenience wrapper.
506  const Instruction &I2, const Value *Ptr,
507  uint64_t Size, const ModRefResult Mode) {
508  return canInstructionRangeModRef(I1, I2, MemoryLocation(Ptr, Size), Mode);
509  }
510 
511  //===--------------------------------------------------------------------===//
512  /// Methods that clients should call when they transform the program to allow
513  /// alias analyses to update their internal data structures. Note that these
514  /// methods may be called on any instruction, regardless of whether or not
515  /// they have pointer-analysis implications.
516  ///
517 
518  /// deleteValue - This method should be called whenever an LLVM Value is
519  /// deleted from the program, for example when an instruction is found to be
520  /// redundant and is eliminated.
521  ///
522  virtual void deleteValue(Value *V);
523 
524  /// addEscapingUse - This method should be used whenever an escaping use is
525  /// added to a pointer value. Analysis implementations may either return
526  /// conservative responses for that value in the future, or may recompute
527  /// some or all internal state to continue providing precise responses.
528  ///
529  /// Escaping uses are considered by anything _except_ the following:
530  /// - GEPs or bitcasts of the pointer
531  /// - Loads through the pointer
532  /// - Stores through (but not of) the pointer
533  virtual void addEscapingUse(Use &U);
534 
535  /// replaceWithNewValue - This method is the obvious combination of the two
536  /// above, and it provided as a helper to simplify client code.
537  ///
538  void replaceWithNewValue(Value *Old, Value *New) {
539  deleteValue(Old);
540  }
541 };
542 
543 /// isNoAliasCall - Return true if this pointer is returned by a noalias
544 /// function.
545 bool isNoAliasCall(const Value *V);
546 
547 /// isNoAliasArgument - Return true if this is an argument with the noalias
548 /// attribute.
549 bool isNoAliasArgument(const Value *V);
550 
551 /// isIdentifiedObject - Return true if this pointer refers to a distinct and
552 /// identifiable object. This returns true for:
553 /// Global Variables and Functions (but not Global Aliases)
554 /// Allocas
555 /// ByVal and NoAlias Arguments
556 /// NoAlias returns (e.g. calls to malloc)
557 ///
558 bool isIdentifiedObject(const Value *V);
559 
560 /// isIdentifiedFunctionLocal - Return true if V is umabigously identified
561 /// at the function-level. Different IdentifiedFunctionLocals can't alias.
562 /// Further, an IdentifiedFunctionLocal can not alias with any function
563 /// arguments other than itself, which is not necessarily true for
564 /// IdentifiedObjects.
565 bool isIdentifiedFunctionLocal(const Value *V);
566 
567 } // End llvm namespace
568 
569 #endif
void replaceWithNewValue(Value *Old, Value *New)
replaceWithNewValue - This method is the obvious combination of the two above, and it provided as a h...
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:82
The two locations precisely alias each other.
Definition: AliasAnalysis.h:84
ModRefResult getModRefInfo(ImmutableCallSite CS, const Value *P, uint64_t Size)
getModRefInfo (for call sites) - A convenience wrapper.
A parsed version of the target data layout string in and methods for querying it. ...
Definition: DataLayout.h:104
bool onlyReadsMemory(const Function *F)
onlyReadsMemory - If the specified function is known to only read from non-volatile memory (or not ac...
ModRefResult callCapturesBefore(const Instruction *I, const MemoryLocation &MemLoc, DominatorTree *DT)
callCapturesBefore - Return information about whether a particular call site modifies or reads the sp...
FenceInst - an instruction for ordering other memory operations.
Definition: Instructions.h:445
AtomicCmpXchgInst - an instruction that atomically checks whether a specified value is in a memory lo...
Definition: Instructions.h:515
The two locations alias, but only due to a partial overlap.
Definition: AliasAnalysis.h:82
ModRefBehavior
ModRefBehavior - Summary of how a function affects memory in the program.
CallInst - This class represents a function call, abstracting a target machine's calling convention...
This file contains the declarations for metadata subclasses.
AliasResult alias(const Value *V1, uint64_t V1Size, const Value *V2, uint64_t V2Size)
alias - A convenience wrapper.
ModRefResult getModRefInfo(const AtomicCmpXchgInst *CX, const Value *P, unsigned Size)
getModRefInfo (for cmpxchges) - A convenience wrapper.
The two locations do not alias at all.
Definition: AliasAnalysis.h:78
F(f)
bool isNoAliasCall(const Value *V)
isNoAliasCall - Return true if this pointer is returned by a noalias function.
LoadInst - an instruction for reading from memory.
Definition: Instructions.h:177
AtomicRMWInst - an instruction that atomically reads a memory location, combines it with another valu...
Definition: Instructions.h:674
ModRefResult callCapturesBefore(const Instruction *I, const Value *P, uint64_t Size, DominatorTree *DT)
callCapturesBefore - A convenience wrapper.
The two locations may or may not alias. This is the least precise result.
Definition: AliasAnalysis.h:80
virtual bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal=false)
pointsToConstantMemory - If the specified memory location is known to be constant, return true.
bool isMustAlias(const MemoryLocation &LocA, const MemoryLocation &LocB)
isMustAlias - A convenience wrapper.
ModRefResult getModRefInfo(const Instruction *I, const MemoryLocation &Loc)
getModRefInfo - Return information about whether or not an instruction may read or write the specifie...
A Use represents the edge between a Value definition and its users.
Definition: Use.h:69
OnlyReadsMemory - This function does not perform any non-local stores or volatile loads...
ModRefResult getModRefInfo(const LoadInst *L, const Value *P, uint64_t Size)
getModRefInfo (for loads) - A convenience wrapper.
virtual ModRefResult getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx)
Get the ModRef info associated with a pointer argument of a callsite.
bool isIdentifiedObject(const Value *V)
isIdentifiedObject - Return true if this pointer refers to a distinct and identifiable object...
bool doesNotAccessMemory(const Function *F)
doesNotAccessMemory - If the specified function is known to never read or write memory, return true.
bool isNoAlias(const Value *V1, uint64_t V1Size, const Value *V2, uint64_t V2Size)
isNoAlias - A convenience wrapper.
virtual void addEscapingUse(Use &U)
addEscapingUse - This method should be used whenever an escaping use is added to a pointer value...
uint64_t getTypeStoreSize(Type *Ty)
getTypeStoreSize - Return the DataLayout store size for the given type, if known, or a conservative v...
ModRefResult getModRefInfo(const AtomicRMWInst *RMW, const Value *P, unsigned Size)
getModRefInfo (for atomicrmws) - A convenience wrapper.
StoreInst - an instruction for storing to memory.
Definition: Instructions.h:316
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
Definition: Dominators.h:67
bool onlyReadsMemory(ImmutableCallSite CS)
onlyReadsMemory - If the specified call is known to only read from non-volatile memory (or not access...
#define P(N)
LLVM Basic Block Representation.
Definition: BasicBlock.h:65
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
OnlyAccessesArgumentPointees - The only memory references in this function (if it has any) are non-vo...
bool canInstructionRangeModRef(const Instruction &I1, const Instruction &I2, const Value *Ptr, uint64_t Size, const ModRefResult Mode)
canInstructionRangeModRef - A convenience wrapper.
AliasResult
The possible results of an alias query.
Definition: AliasAnalysis.h:72
Represent the analysis usage information of a pass.
const TargetLibraryInfo * TLI
Definition: AliasAnalysis.h:90
bool doesNotAccessMemory(ImmutableCallSite CS)
doesNotAccessMemory - If the specified call is known to never read or write memory, return true.
ModRefResult getModRefInfo(const FenceInst *S, const Value *P, uint64_t Size)
getModRefInfo (for fences) - A convenience wrapper.
static bool doesAccessArgPointees(ModRefBehavior MRB)
doesAccessArgPointees - Return true if functions with the specified behavior are known to potentially...
ModRefResult getModRefInfo(const CallInst *C, const MemoryLocation &Loc)
getModRefInfo (for calls) - Return information about whether a particular call modifies or reads the ...
VAArgInst - This class represents the va_arg llvm instruction, which returns an argument of the speci...
virtual void deleteValue(Value *V)
Methods that clients should call when they transform the program to allow alias analyses to update th...
aarch64 type AArch64 Type Promotion Pass
OnlyReadsArgumentPointees - The only memory references in this function (if it has any) are non-volat...
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 isIdentifiedFunctionLocal(const Value *V)
isIdentifiedFunctionLocal - Return true if V is umabigously identified at the function-level.
Representation for a specific memory location.
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.
virtual AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
Alias Queries...
Provides information about what library functions are available for the current target.
ModRefResult getModRefInfo(const Instruction *I)
getModRefInfo - Return information about whether or not an instruction may read or write memory (with...
ModRefResult getModRefInfo(const InvokeInst *I, const Value *P, uint64_t Size)
getModRefInfo (for invokes) - A convenience wrapper.
void InitializeAliasAnalysis(Pass *P, const DataLayout *DL)
InitializeAliasAnalysis - Subclasses must call this method to initialize the AliasAnalysis interface ...
ModRefResult getModRefInfo(const InvokeInst *I, const MemoryLocation &Loc)
getModRefInfo (for invokes) - Return information about whether a particular invoke modifies or reads ...
bool isNoAlias(const Value *V1, const Value *V2)
isNoAlias - A convenience wrapper.
bool canInstructionRangeModRef(const Instruction &I1, const Instruction &I2, const MemoryLocation &Loc, const ModRefResult Mode)
canInstructionRangeModRef - Return true if it is possible for the execution of the specified instruct...
ModRefResult getModRefInfo(const StoreInst *S, const Value *P, uint64_t Size)
getModRefInfo (for stores) - A convenience wrapper.
static bool onlyAccessesArgPointees(ModRefBehavior MRB)
onlyAccessesArgPointees - Return true if functions with the specified behavior are known to read and ...
This file provides utility analysis objects describing memory locations.
ImmutableCallSite - establish a view to a call site for examination.
Definition: CallSite.h:418
#define I(x, y, z)
Definition: MD5.cpp:54
bool canBasicBlockModify(const BasicBlock &BB, const MemoryLocation &Loc)
Higher level methods for querying mod/ref information.
DoesNotAccessMemory - This function does not perform any non-local loads or stores to memory...
LLVM Value Representation.
Definition: Value.h:69
ModRefResult
Simple mod/ref information...
const DataLayout * DL
Definition: AliasAnalysis.h:89
unsigned getOpcode() const
getOpcode() returns a member of one of the enums like Instruction::Add.
Definition: Instruction.h:112
ModRefResult getModRefInfo(const Instruction *I, const Value *P, uint64_t Size)
getModRefInfo - A convenience wrapper.
virtual void getAnalysisUsage(AnalysisUsage &AU) const
getAnalysisUsage - All alias analysis implementations should invoke this directly (using AliasAnalysi...
InvokeInst - Invoke instruction.
const TargetLibraryInfo * getTargetLibraryInfo() const
getTargetLibraryInfo - Return a pointer to the current TargetLibraryInfo object, or null if no Target...
bool isNoAliasArgument(const Value *V)
isNoAliasArgument - Return true if this is an argument with the noalias attribute.
bool isNoAlias(const MemoryLocation &LocA, const MemoryLocation &LocB)
isNoAlias - A trivial helper function to check to see if the specified pointers are no-alias...
bool pointsToConstantMemory(const Value *P, bool OrLocal=false)
pointsToConstantMemory - A convenient wrapper.
AliasResult alias(const Value *V1, const Value *V2)
alias - A convenience wrapper.
UnknownModRefBehavior - This indicates that the function could not be classified into one of the beha...
static bool onlyReadsMemory(ModRefBehavior MRB)
onlyReadsMemory - Return true if functions with the specified behavior are known to only read from no...
ModRefResult getModRefInfo(const FenceInst *S, const MemoryLocation &Loc)
getModRefInfo (for fences) - Return information about whether a particular store modifies or reads th...
ModRefResult getModRefInfo(const VAArgInst *I, const Value *P, uint64_t Size)
getModRefInfo (for va_args) - A convenience wrapper.