AliasAnalysis.h revision 9f27074f42f03af640977006dc7c05005fb77991
14df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner//===- llvm/Analysis/AliasAnalysis.h - Alias Analysis Interface -*- C++ -*-===// 29769ab22265b313171d201b5928688524a01bd87Misha Brukman// 36fbcc26f1460eaee4e0eb8b426fc1ff0c7af11beJohn Criswell// The LLVM Compiler Infrastructure 46fbcc26f1460eaee4e0eb8b426fc1ff0c7af11beJohn Criswell// 57ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// This file is distributed under the University of Illinois Open Source 67ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// License. See LICENSE.TXT for details. 79769ab22265b313171d201b5928688524a01bd87Misha Brukman// 86fbcc26f1460eaee4e0eb8b426fc1ff0c7af11beJohn Criswell//===----------------------------------------------------------------------===// 94df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner// 104df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner// This file defines the generic AliasAnalysis interface, which is used as the 114df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner// common interface used by all clients of alias analysis information, and 121c56b730a6313886076d7b293a126ae5576f5288Chris Lattner// implemented by all alias analysis implementations. Mod/Ref information is 131c56b730a6313886076d7b293a126ae5576f5288Chris Lattner// also captured by this interface. 144df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner// 154df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner// Implementations of this interface must implement the various virtual methods, 164df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner// which automatically provides functionality for the entire suite of client 174df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner// APIs. 184df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner// 191c56b730a6313886076d7b293a126ae5576f5288Chris Lattner// This API represents memory as a (Pointer, Size) pair. The Pointer component 201c56b730a6313886076d7b293a126ae5576f5288Chris Lattner// specifies the base memory address of the region, the Size specifies how large 21e53e3772f3c8b4cba69b7d77c8b2148a080fe9aeDan Gohman// of an area is being queried, or UnknownSize if the size is not known. 22e53e3772f3c8b4cba69b7d77c8b2148a080fe9aeDan Gohman// Pointers that point to two completely different objects in memory never 23e53e3772f3c8b4cba69b7d77c8b2148a080fe9aeDan Gohman// alias, regardless of the value of the Size component. 241c56b730a6313886076d7b293a126ae5576f5288Chris Lattner// 254df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner//===----------------------------------------------------------------------===// 264df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner 274df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner#ifndef LLVM_ANALYSIS_ALIAS_ANALYSIS_H 284df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner#define LLVM_ANALYSIS_ALIAS_ANALYSIS_H 294df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner 301c56b730a6313886076d7b293a126ae5576f5288Chris Lattner#include "llvm/Support/CallSite.h" 317107c3badfe78ec89dcab6c02cf1b1bcaccc42a8Reid Spencer#include "llvm/System/IncludeFile.h" 3236f78c8935da34074ccd06d5674e45b9cd45da8bChris Lattner#include <vector> 33d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke 34d0fde30ce850b78371fd1386338350591f9ff494Brian Gaekenamespace llvm { 35d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke 361c56b730a6313886076d7b293a126ae5576f5288Chris Lattnerclass LoadInst; 371c56b730a6313886076d7b293a126ae5576f5288Chris Lattnerclass StoreInst; 3814f1703ae33e13dbcadd701603fd4d7a6f7010b9Andrew Lenharthclass VAArgInst; 391c56b730a6313886076d7b293a126ae5576f5288Chris Lattnerclass TargetData; 406df60a9effe4d20a48cfd9d105c0ab3c5dc3e690Reid Spencerclass Pass; 416df60a9effe4d20a48cfd9d105c0ab3c5dc3e690Reid Spencerclass AnalysisUsage; 421c56b730a6313886076d7b293a126ae5576f5288Chris Lattner 431c56b730a6313886076d7b293a126ae5576f5288Chris Lattnerclass AliasAnalysis { 441c56b730a6313886076d7b293a126ae5576f5288Chris Lattnerprotected: 45ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner const TargetData *TD; 46cb74993bdc37681ddbb80fa361575107afae1350Dan Gohman 47cb74993bdc37681ddbb80fa361575107afae1350Dan Gohmanprivate: 48ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner AliasAnalysis *AA; // Previous Alias Analysis to chain to. 49ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner 50cb74993bdc37681ddbb80fa361575107afae1350Dan Gohmanprotected: 511c56b730a6313886076d7b293a126ae5576f5288Chris Lattner /// InitializeAliasAnalysis - Subclasses must call this method to initialize 521c56b730a6313886076d7b293a126ae5576f5288Chris Lattner /// the AliasAnalysis interface before any other methods are called. This is 531c56b730a6313886076d7b293a126ae5576f5288Chris Lattner /// typically called by the run* methods of these subclasses. This may be 541c56b730a6313886076d7b293a126ae5576f5288Chris Lattner /// called multiple times. 551c56b730a6313886076d7b293a126ae5576f5288Chris Lattner /// 561c56b730a6313886076d7b293a126ae5576f5288Chris Lattner void InitializeAliasAnalysis(Pass *P); 579769ab22265b313171d201b5928688524a01bd87Misha Brukman 5864d237cfae6bcb11157d525c79b5a5335e30370bDan Gohman /// getAnalysisUsage - All alias analysis implementations should invoke this 59fc2a3ed0c9e32cf7edaf5030fa0972b916cc5f0bDan Gohman /// directly (using AliasAnalysis::getAnalysisUsage(AU)). 601c56b730a6313886076d7b293a126ae5576f5288Chris Lattner virtual void getAnalysisUsage(AnalysisUsage &AU) const; 611c56b730a6313886076d7b293a126ae5576f5288Chris Lattner 621c56b730a6313886076d7b293a126ae5576f5288Chris Lattnerpublic: 631997473cf72957d0e70322e2fe6fe2ab141c58a6Devang Patel static char ID; // Class identification, replacement for typeinfo 64ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner AliasAnalysis() : TD(0), AA(0) {} 651c56b730a6313886076d7b293a126ae5576f5288Chris Lattner virtual ~AliasAnalysis(); // We want to be subclassed 661c56b730a6313886076d7b293a126ae5576f5288Chris Lattner 67ef1cfac9e50def9097cd3e3ab3c5cad7f4c758ccDan Gohman /// UnknownSize - This is a special value which can be used with the 68ef1cfac9e50def9097cd3e3ab3c5cad7f4c758ccDan Gohman /// size arguments in alias queries to indicate that the caller does not 69ef1cfac9e50def9097cd3e3ab3c5cad7f4c758ccDan Gohman /// know the sizes of the potential memory references. 70ef1cfac9e50def9097cd3e3ab3c5cad7f4c758ccDan Gohman static unsigned const UnknownSize = ~0u; 71ef1cfac9e50def9097cd3e3ab3c5cad7f4c758ccDan Gohman 72fc2a3ed0c9e32cf7edaf5030fa0972b916cc5f0bDan Gohman /// getTargetData - Return a pointer to the current TargetData object, or 73fc2a3ed0c9e32cf7edaf5030fa0972b916cc5f0bDan Gohman /// null if no TargetData object is available. 74dd298c8c6eb036baf35bf5a559c59d2afd2c7944Misha Brukman /// 75fc2a3ed0c9e32cf7edaf5030fa0972b916cc5f0bDan Gohman const TargetData *getTargetData() const { return TD; } 76fc2a3ed0c9e32cf7edaf5030fa0972b916cc5f0bDan Gohman 77fc2a3ed0c9e32cf7edaf5030fa0972b916cc5f0bDan Gohman /// getTypeStoreSize - Return the TargetData store size for the given type, 78fc2a3ed0c9e32cf7edaf5030fa0972b916cc5f0bDan Gohman /// if known, or a conservative value otherwise. 79fc2a3ed0c9e32cf7edaf5030fa0972b916cc5f0bDan Gohman /// 80fc2a3ed0c9e32cf7edaf5030fa0972b916cc5f0bDan Gohman unsigned getTypeStoreSize(const Type *Ty); 814df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner 821c56b730a6313886076d7b293a126ae5576f5288Chris Lattner //===--------------------------------------------------------------------===// 831c56b730a6313886076d7b293a126ae5576f5288Chris Lattner /// Alias Queries... 841c56b730a6313886076d7b293a126ae5576f5288Chris Lattner /// 854df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner 86b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// Location - A description of a memory location. 87b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman struct Location { 88b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// Ptr - The address of the start of the location. 89b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman const Value *Ptr; 90b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// Size - The size of the location. 91b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman unsigned Size; 92b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// TBAATag - The metadata node which describes the TBAA type of 93b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// the location, or null if there is no (unique) tag. 94b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman const MDNode *TBAATag; 95b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman 96b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman explicit Location(const Value *P = 0, 97b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman unsigned S = UnknownSize, 98b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman const MDNode *N = 0) 99b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman : Ptr(P), Size(S), TBAATag(N) {} 1009f27074f42f03af640977006dc7c05005fb77991Dan Gohman 1019f27074f42f03af640977006dc7c05005fb77991Dan Gohman Location getWithNewPtr(const Value *NewPtr) const { 1029f27074f42f03af640977006dc7c05005fb77991Dan Gohman Location Copy(*this); 1039f27074f42f03af640977006dc7c05005fb77991Dan Gohman Copy.Ptr = NewPtr; 1049f27074f42f03af640977006dc7c05005fb77991Dan Gohman return Copy; 1059f27074f42f03af640977006dc7c05005fb77991Dan Gohman } 1069f27074f42f03af640977006dc7c05005fb77991Dan Gohman 1079f27074f42f03af640977006dc7c05005fb77991Dan Gohman Location getWithoutTBAATag() const { 1089f27074f42f03af640977006dc7c05005fb77991Dan Gohman Location Copy(*this); 1099f27074f42f03af640977006dc7c05005fb77991Dan Gohman Copy.TBAATag = 0; 1109f27074f42f03af640977006dc7c05005fb77991Dan Gohman return Copy; 1119f27074f42f03af640977006dc7c05005fb77991Dan Gohman } 112b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman }; 113b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman 114f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner /// Alias analysis result - Either we know for sure that it does not alias, we 115f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner /// know for sure it must alias, or we don't know anything: The two pointers 116f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner /// _might_ alias. This enum is designed so you can do things like: 117f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner /// if (AA.alias(P1, P2)) { ... } 118f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner /// to check to see if two pointers might alias. 119f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner /// 120e53e3772f3c8b4cba69b7d77c8b2148a080fe9aeDan Gohman /// See docs/AliasAnalysis.html for more information on the specific meanings 121e53e3772f3c8b4cba69b7d77c8b2148a080fe9aeDan Gohman /// of these values. 122e53e3772f3c8b4cba69b7d77c8b2148a080fe9aeDan Gohman /// 1231c56b730a6313886076d7b293a126ae5576f5288Chris Lattner enum AliasResult { NoAlias = 0, MayAlias = 1, MustAlias = 2 }; 1244df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner 125f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner /// alias - The main low level interface to the alias analysis implementation. 126f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner /// Returns a Result indicating whether the two pointers are aliased to each 127f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner /// other. This is the interface that must be implemented by specific alias 128f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner /// analysis implementations. 129b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman virtual AliasResult alias(const Location &LocA, const Location &LocB); 1304df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner 131b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// alias - A convenience wrapper. 132b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman AliasResult alias(const Value *V1, unsigned V1Size, 133b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman const Value *V2, unsigned V2Size) { 134b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman return alias(Location(V1, V1Size), Location(V2, V2Size)); 135b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman } 136b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman 137b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// alias - A convenience wrapper. 138847a84efd23a2c7d90429b82f6e0f19d1f913d9aDan Gohman AliasResult alias(const Value *V1, const Value *V2) { 139ef1cfac9e50def9097cd3e3ab3c5cad7f4c758ccDan Gohman return alias(V1, UnknownSize, V2, UnknownSize); 140847a84efd23a2c7d90429b82f6e0f19d1f913d9aDan Gohman } 141847a84efd23a2c7d90429b82f6e0f19d1f913d9aDan Gohman 142c46530b6a32a53edf0d6d32bcd09ea5d76940472Chris Lattner /// isNoAlias - A trivial helper function to check to see if the specified 143c46530b6a32a53edf0d6d32bcd09ea5d76940472Chris Lattner /// pointers are no-alias. 144b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman bool isNoAlias(const Location &LocA, const Location &LocB) { 145b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman return alias(LocA, LocB) == NoAlias; 146b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman } 147b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman 148b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// isNoAlias - A convenience wrapper. 149c46530b6a32a53edf0d6d32bcd09ea5d76940472Chris Lattner bool isNoAlias(const Value *V1, unsigned V1Size, 150c46530b6a32a53edf0d6d32bcd09ea5d76940472Chris Lattner const Value *V2, unsigned V2Size) { 151b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman return isNoAlias(Location(V1, V1Size), Location(V2, V2Size)); 152c46530b6a32a53edf0d6d32bcd09ea5d76940472Chris Lattner } 153c46530b6a32a53edf0d6d32bcd09ea5d76940472Chris Lattner 154b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// pointsToConstantMemory - If the specified memory location is known to be 155b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// constant, return true. This allows disambiguation of store 156762e8e846f0ad50ffea56216c5ea20db1c95b756Chris Lattner /// instructions from constant pointers. 157762e8e846f0ad50ffea56216c5ea20db1c95b756Chris Lattner /// 158b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman virtual bool pointsToConstantMemory(const Location &Loc); 159b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman 160b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// pointsToConstantMemory - A convenient wrapper. 161b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman bool pointsToConstantMemory(const Value *P) { 162b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman return pointsToConstantMemory(Location(P)); 163b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman } 16462b5c167de0ca5883a7ad5eb0900eb0c15ad3707Chris Lattner 165248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner //===--------------------------------------------------------------------===// 166248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner /// Simple mod/ref information... 167248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner /// 168248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner 169248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner /// ModRefResult - Represent the result of a mod/ref query. Mod and Ref are 170248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner /// bits which may be or'd together. 171248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner /// 172248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner enum ModRefResult { NoModRef = 0, Ref = 1, Mod = 2, ModRef = 3 }; 1739769ab22265b313171d201b5928688524a01bd87Misha Brukman 1749769ab22265b313171d201b5928688524a01bd87Misha Brukman 175248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner /// ModRefBehavior - Summary of how a function affects memory in the program. 176248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner /// Loads from constant globals are not considered memory accesses for this 177248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner /// interface. Also, functions may freely modify stack space local to their 178248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner /// invocation without having to report it through these interfaces. 179248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner enum ModRefBehavior { 180248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner // DoesNotAccessMemory - This function does not perform any non-local loads 181248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner // or stores to memory. 182248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner // 183248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner // This property corresponds to the GCC 'const' attribute. 184248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner DoesNotAccessMemory, 1859769ab22265b313171d201b5928688524a01bd87Misha Brukman 186070fbe69d36b24616de4e484ecbea221a2c7e8c2Duncan Sands // AccessesArguments - This function accesses function arguments in well 187070fbe69d36b24616de4e484ecbea221a2c7e8c2Duncan Sands // known (possibly volatile) ways, but does not access any other memory. 188248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner AccessesArguments, 1899769ab22265b313171d201b5928688524a01bd87Misha Brukman 190248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner // AccessesArgumentsAndGlobals - This function has accesses function 191070fbe69d36b24616de4e484ecbea221a2c7e8c2Duncan Sands // arguments and global variables well known (possibly volatile) ways, but 192248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner // does not access any other memory. 193248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner AccessesArgumentsAndGlobals, 1949769ab22265b313171d201b5928688524a01bd87Misha Brukman 195248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner // OnlyReadsMemory - This function does not perform any non-local stores or 196248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner // volatile loads, but may read from any memory location. 197248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner // 198248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner // This property corresponds to the GCC 'pure' attribute. 199248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner OnlyReadsMemory, 2009769ab22265b313171d201b5928688524a01bd87Misha Brukman 201248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner // UnknownModRefBehavior - This indicates that the function could not be 202248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner // classified into one of the behaviors above. 203248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner UnknownModRefBehavior 204248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner }; 2059769ab22265b313171d201b5928688524a01bd87Misha Brukman 206dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// getModRefBehavior - Return the behavior when calling the given call site. 207a41af344c2964573318a77e2b43eafd4d3804003Dan Gohman virtual ModRefBehavior getModRefBehavior(ImmutableCallSite CS); 208dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands 209dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// getModRefBehavior - Return the behavior when calling the given function. 210dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// For use when the call site is not known. 211a41af344c2964573318a77e2b43eafd4d3804003Dan Gohman virtual ModRefBehavior getModRefBehavior(const Function *F); 212dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands 21379fca6fea87be7221843031870bbf2c9ae1fc555Dan Gohman /// getIntrinsicModRefBehavior - Return the modref behavior of the intrinsic 21413214eb8ccaef26d9f5ad79a702f4b196d357537Dan Gohman /// with the given id. Most clients won't need this, because the regular 21513214eb8ccaef26d9f5ad79a702f4b196d357537Dan Gohman /// getModRefBehavior incorporates this information. 21679fca6fea87be7221843031870bbf2c9ae1fc555Dan Gohman static ModRefBehavior getIntrinsicModRefBehavior(unsigned iid); 2177c422ac216fe39fc9c402a704cf296cca9dc5b22Duncan Sands 218dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// doesNotAccessMemory - If the specified call is known to never read or 219dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// write memory, return true. If the call only reads from known-constant 220dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// memory, it is also legal to return true. Calls that unwind the stack 221dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// are legal for this predicate. 2223e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner /// 223dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// Many optimizations (such as CSE and LICM) can be performed on such calls 224dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// without worrying about aliasing properties, and many calls have this 225dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// property (e.g. calls to 'sin' and 'cos'). 2263e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner /// 2273e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner /// This property corresponds to the GCC 'const' attribute. 2283e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner /// 22979fca6fea87be7221843031870bbf2c9ae1fc555Dan Gohman bool doesNotAccessMemory(ImmutableCallSite CS) { 230652f7ea955bb433d6b7a4d33685dca9485fd7b8bEvan Cheng return getModRefBehavior(CS) == DoesNotAccessMemory; 231dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands } 232dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands 233dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// doesNotAccessMemory - If the specified function is known to never read or 234dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// write memory, return true. For use when the call site is not known. 235dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// 23679fca6fea87be7221843031870bbf2c9ae1fc555Dan Gohman bool doesNotAccessMemory(const Function *F) { 237dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands return getModRefBehavior(F) == DoesNotAccessMemory; 238248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner } 2393e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner 240dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// onlyReadsMemory - If the specified call is known to only read from 241dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// non-volatile memory (or not access memory at all), return true. Calls 242dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// that unwind the stack are legal for this predicate. 2433e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner /// 2443e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner /// This property allows many common optimizations to be performed in the 2453e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner /// absence of interfering store instructions, such as CSE of strlen calls. 2463e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner /// 2473e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner /// This property corresponds to the GCC 'pure' attribute. 2483e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner /// 24979fca6fea87be7221843031870bbf2c9ae1fc555Dan Gohman bool onlyReadsMemory(ImmutableCallSite CS) { 250652f7ea955bb433d6b7a4d33685dca9485fd7b8bEvan Cheng ModRefBehavior MRB = getModRefBehavior(CS); 251dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands return MRB == DoesNotAccessMemory || MRB == OnlyReadsMemory; 252dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands } 253dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands 254dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// onlyReadsMemory - If the specified function is known to only read from 255dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// non-volatile memory (or not access memory at all), return true. For use 256dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// when the call site is not known. 257dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands /// 25879fca6fea87be7221843031870bbf2c9ae1fc555Dan Gohman bool onlyReadsMemory(const Function *F) { 259dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands ModRefBehavior MRB = getModRefBehavior(F); 2608eec644862251e14add0d2707d655fcce91e8f70Chris Lattner return MRB == DoesNotAccessMemory || MRB == OnlyReadsMemory; 261248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner } 2624df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner 2631c56b730a6313886076d7b293a126ae5576f5288Chris Lattner 2641c56b730a6313886076d7b293a126ae5576f5288Chris Lattner /// getModRefInfo - Return information about whether or not an instruction may 265b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// read or write the specified memory location. An instruction 2661c56b730a6313886076d7b293a126ae5576f5288Chris Lattner /// that doesn't read or write memory may be trivially LICM'd for example. 267fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman ModRefResult getModRefInfo(const Instruction *I, 268b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman const Location &Loc) { 269fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman switch (I->getOpcode()) { 270b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman case Instruction::VAArg: return getModRefInfo((const VAArgInst*)I, Loc); 271b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman case Instruction::Load: return getModRefInfo((const LoadInst*)I, Loc); 272b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman case Instruction::Store: return getModRefInfo((const StoreInst*)I, Loc); 273b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman case Instruction::Call: return getModRefInfo((const CallInst*)I, Loc); 274b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman case Instruction::Invoke: return getModRefInfo((const InvokeInst*)I,Loc); 275fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman default: return NoModRef; 276fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman } 277fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman } 2781c56b730a6313886076d7b293a126ae5576f5288Chris Lattner 279b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// getModRefInfo - A convenience wrapper. 280b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman ModRefResult getModRefInfo(const Instruction *I, 281b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman const Value *P, unsigned Size) { 282b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman return getModRefInfo(I, Location(P, Size)); 283b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman } 284b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman 2851c56b730a6313886076d7b293a126ae5576f5288Chris Lattner /// getModRefInfo (for call sites) - Return whether information about whether 286b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// a particular call site modifies or reads the specified memory location. 28779fca6fea87be7221843031870bbf2c9ae1fc555Dan Gohman virtual ModRefResult getModRefInfo(ImmutableCallSite CS, 288b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman const Location &Loc); 289b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman 290b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// getModRefInfo (for call sites) - A convenience wrapper. 291b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman ModRefResult getModRefInfo(ImmutableCallSite CS, 292b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman const Value *P, unsigned Size) { 293b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman return getModRefInfo(CS, Location(P, Size)); 294b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman } 2951c56b730a6313886076d7b293a126ae5576f5288Chris Lattner 296fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman /// getModRefInfo (for calls) - Return whether information about whether 297b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// a particular call modifies or reads the specified memory location. 298b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman ModRefResult getModRefInfo(const CallInst *C, const Location &Loc) { 299b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman return getModRefInfo(ImmutableCallSite(C), Loc); 300b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman } 301b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman 302b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// getModRefInfo (for calls) - A convenience wrapper. 30379fca6fea87be7221843031870bbf2c9ae1fc555Dan Gohman ModRefResult getModRefInfo(const CallInst *C, const Value *P, unsigned Size) { 304b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman return getModRefInfo(C, Location(P, Size)); 3051c56b730a6313886076d7b293a126ae5576f5288Chris Lattner } 306fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman 307fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman /// getModRefInfo (for invokes) - Return whether information about whether 308b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// a particular invoke modifies or reads the specified memory location. 309b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman ModRefResult getModRefInfo(const InvokeInst *I, 310b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman const Location &Loc) { 311b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman return getModRefInfo(ImmutableCallSite(I), Loc); 312b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman } 313b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman 314b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// getModRefInfo (for invokes) - A convenience wrapper. 31579fca6fea87be7221843031870bbf2c9ae1fc555Dan Gohman ModRefResult getModRefInfo(const InvokeInst *I, 31679fca6fea87be7221843031870bbf2c9ae1fc555Dan Gohman const Value *P, unsigned Size) { 317b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman return getModRefInfo(I, Location(P, Size)); 3181c56b730a6313886076d7b293a126ae5576f5288Chris Lattner } 319fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman 320fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman /// getModRefInfo (for loads) - Return whether information about whether 321b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// a particular load modifies or reads the specified memory location. 322b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman ModRefResult getModRefInfo(const LoadInst *L, const Location &Loc); 323b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman 324b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// getModRefInfo (for loads) - A convenience wrapper. 325b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman ModRefResult getModRefInfo(const LoadInst *L, const Value *P, unsigned Size) { 326b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman return getModRefInfo(L, Location(P, Size)); 327b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman } 328fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman 329fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman /// getModRefInfo (for stores) - Return whether information about whether 330b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// a particular store modifies or reads the specified memory location. 331b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman ModRefResult getModRefInfo(const StoreInst *S, const Location &Loc); 332b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman 333b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// getModRefInfo (for stores) - A convenience wrapper. 334b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman ModRefResult getModRefInfo(const StoreInst *S, const Value *P, unsigned Size) { 335b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman return getModRefInfo(S, Location(P, Size)); 336b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman } 337fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman 338fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman /// getModRefInfo (for va_args) - Return whether information about whether 339b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// a particular va_arg modifies or reads the specified memory location. 340b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman ModRefResult getModRefInfo(const VAArgInst* I, const Location &Loc); 341b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman 342b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// getModRefInfo (for va_args) - A convenience wrapper. 343b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman ModRefResult getModRefInfo(const VAArgInst* I, const Value* P, unsigned Size) { 344b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman return getModRefInfo(I, Location(P, Size)); 345b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman } 346fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman 347fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman /// getModRefInfo - Return information about whether two call sites may refer 348fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman /// to the same set of memory locations. See 349fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman /// http://llvm.org/docs/AliasAnalysis.html#ModRefInfo 350fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman /// for details. 351fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman virtual ModRefResult getModRefInfo(ImmutableCallSite CS1, 352fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman ImmutableCallSite CS2); 3534df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner 354ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner //===--------------------------------------------------------------------===// 355ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// Higher level methods for querying mod/ref information. 356ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// 357ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner 358f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner /// canBasicBlockModify - Return true if it is possible for execution of the 359f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner /// specified basic block to modify the value pointed to by Ptr. 360b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman bool canBasicBlockModify(const BasicBlock &BB, const Location &Loc); 361b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman 362b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// canBasicBlockModify - A convenience wrapper. 363b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman bool canBasicBlockModify(const BasicBlock &BB, const Value *P, unsigned Size){ 364b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman return canBasicBlockModify(BB, Location(P, Size)); 365b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman } 3664df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner 367f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner /// canInstructionRangeModify - Return true if it is possible for the 368f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner /// execution of the specified instructions to modify the value pointed to by 369f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner /// Ptr. The instructions to consider are all of the instructions in the 370f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner /// range of [I1,I2] INCLUSIVE. I1 and I2 must be in the same basic block. 3714df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner bool canInstructionRangeModify(const Instruction &I1, const Instruction &I2, 372b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman const Location &Loc); 373b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman 374b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman /// canInstructionRangeModify - A convenience wrapper. 375b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman bool canInstructionRangeModify(const Instruction &I1, const Instruction &I2, 376b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman const Value *Ptr, unsigned Size) { 377b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman return canInstructionRangeModify(I1, I2, Location(Ptr, Size)); 378b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman } 379ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner 380ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner //===--------------------------------------------------------------------===// 381ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// Methods that clients should call when they transform the program to allow 382ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// alias analyses to update their internal data structures. Note that these 383ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// methods may be called on any instruction, regardless of whether or not 384ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// they have pointer-analysis implications. 385ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// 386ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner 387ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// deleteValue - This method should be called whenever an LLVM Value is 388ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// deleted from the program, for example when an instruction is found to be 389ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// redundant and is eliminated. 390ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// 391ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner virtual void deleteValue(Value *V); 392ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner 393ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// copyValue - This method should be used whenever a preexisting value in the 394ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// program is copied or cloned, introducing a new value. Note that analysis 395ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// implementations should tolerate clients that use this method to introduce 396ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// the same value multiple times: if the analysis already knows about a 397ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// value, it should ignore the request. 398ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// 399ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner virtual void copyValue(Value *From, Value *To); 400ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner 401ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// replaceWithNewValue - This method is the obvious combination of the two 402ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// above, and it provided as a helper to simplify client code. 403ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner /// 404ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner void replaceWithNewValue(Value *Old, Value *New) { 405ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner copyValue(Old, New); 406ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner deleteValue(Old); 407ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner } 4084df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner}; 4094df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner 410a5f81bba4ab18d6129774d4d67495f14b6f64375Dan Gohman/// isNoAliasCall - Return true if this pointer is returned by a noalias 411a5f81bba4ab18d6129774d4d67495f14b6f64375Dan Gohman/// function. 412a5f81bba4ab18d6129774d4d67495f14b6f64375Dan Gohmanbool isNoAliasCall(const Value *V); 413a5f81bba4ab18d6129774d4d67495f14b6f64375Dan Gohman 4143311a1f8f0d8a2c6d940802bbb95eba0b801a615Dan Gohman/// isIdentifiedObject - Return true if this pointer refers to a distinct and 415a5f81bba4ab18d6129774d4d67495f14b6f64375Dan Gohman/// identifiable object. This returns true for: 4165753a4a0033da4add45f2e9930a4e1159d92a869Dan Gohman/// Global Variables and Functions (but not Global Aliases) 417a5f81bba4ab18d6129774d4d67495f14b6f64375Dan Gohman/// Allocas and Mallocs 4189e86f4364b912ae743490ba01d6989acfd12c046Dan Gohman/// ByVal and NoAlias Arguments 4199e86f4364b912ae743490ba01d6989acfd12c046Dan Gohman/// NoAlias returns 4203311a1f8f0d8a2c6d940802bbb95eba0b801a615Dan Gohman/// 4219e86f4364b912ae743490ba01d6989acfd12c046Dan Gohmanbool isIdentifiedObject(const Value *V); 4223311a1f8f0d8a2c6d940802bbb95eba0b801a615Dan Gohman 4234f1bd9e9963239c119db70070db1d68286b3de7eReid Spencer} // End llvm namespace 4244f1bd9e9963239c119db70070db1d68286b3de7eReid Spencer 425fc188b95b81332c12043173c7f517341c6ad27a9Brian Gaeke// Because of the way .a files work, we must force the BasicAA implementation to 426fc188b95b81332c12043173c7f517341c6ad27a9Brian Gaeke// be pulled in if the AliasAnalysis header is included. Otherwise we run 427fc188b95b81332c12043173c7f517341c6ad27a9Brian Gaeke// the risk of AliasAnalysis being used, but the default implementation not 428fc188b95b81332c12043173c7f517341c6ad27a9Brian Gaeke// being linked into the tool that uses it. 4294f1bd9e9963239c119db70070db1d68286b3de7eReid SpencerFORCE_DEFINING_FILE_TO_BE_LINKED(AliasAnalysis) 4304f1bd9e9963239c119db70070db1d68286b3de7eReid SpencerFORCE_DEFINING_FILE_TO_BE_LINKED(BasicAliasAnalysis) 431d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke 4324df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner#endif 433