PageRenderTime 27ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/3rd_party/llvm/include/llvm/Analysis/AliasAnalysis.h

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