Move isIdentifiedObject and isNoAliasCall into AliasAnalysis.cpp since
authorDan Gohman <gohman@apple.com>
Tue, 3 Feb 2009 01:28:32 +0000 (01:28 +0000)
committerDan Gohman <gohman@apple.com>
Tue, 3 Feb 2009 01:28:32 +0000 (01:28 +0000)
they are useful to analyses other than BasicAliasAnalysis.cpp. Include
the full comment for isIdentifiedObject in the header file. Thanks to
Chris for suggeseting this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63589 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/AliasAnalysis.h
lib/Analysis/AliasAnalysis.cpp
lib/Analysis/BasicAliasAnalysis.cpp

index 2beb8fb0bf160dba10a01f97355f228ea2dd30ff..1b38baf48c57395ce40b8866cff680f1a31eebd7 100644 (file)
@@ -345,8 +345,16 @@ public:
   }
 };
 
+/// isNoAliasCall - Return true if this pointer is returned by a noalias
+/// function.
+bool isNoAliasCall(const Value *V);
+
 /// isIdentifiedObject - Return true if this pointer refers to a distinct and
-/// identifiable object.
+/// identifiable object.  This returns true for:
+///    Global Variables and Functions
+///    Allocas and Mallocs
+///    ByVal and NoAlias Arguments
+///    NoAlias returns
 ///
 bool isIdentifiedObject(const Value *V);
 
index c8c43a69ef743bb841505fa9e825da66c490498d..d5de2fe616acbc319abc18cbf5e96b40b3fbc99f 100644 (file)
@@ -207,6 +207,30 @@ bool AliasAnalysis::canInstructionRangeModify(const Instruction &I1,
   return false;
 }
 
+/// isNoAliasCall - Return true if this pointer is returned by a noalias
+/// function.
+bool llvm::isNoAliasCall(const Value *V) {
+  if (isa<CallInst>(V) || isa<InvokeInst>(V))
+    return CallSite(const_cast<Instruction*>(cast<Instruction>(V)))
+      .paramHasAttr(0, Attribute::NoAlias);
+  return false;
+}
+
+/// isIdentifiedObject - Return true if this pointer refers to a distinct and
+/// identifiable object.  This returns true for:
+///    Global Variables and Functions
+///    Allocas and Mallocs
+///    ByVal and NoAlias Arguments
+///    NoAlias returns
+///
+bool llvm::isIdentifiedObject(const Value *V) {
+  if (isa<GlobalValue>(V) || isa<AllocationInst>(V) || isNoAliasCall(V))
+    return true;
+  if (const Argument *A = dyn_cast<Argument>(V))
+    return A->hasNoAliasAttr() || A->hasByValAttr();
+  return false;
+}
+
 // Because of the way .a files work, we must force the BasicAA implementation to
 // be pulled in if the AliasAnalysis classes are pulled in.  Otherwise we run
 // the risk of AliasAnalysis being used, but the default implementation not
index 1002868e84cbb72240ef4f6419eec13a1e39ea24..ccbe338585df3f9d2b40d6bd22fd640a345f1566 100644 (file)
@@ -64,30 +64,6 @@ static const Value *GetGEPOperands(const Value *V,
   return V;
 }
 
-/// isNoAliasCall - Return true if this pointer is returned by a noalias
-/// function.
-static bool isNoAliasCall(const Value *V) {
-  if (isa<CallInst>(V) || isa<InvokeInst>(V))
-    return CallSite(const_cast<Instruction*>(cast<Instruction>(V)))
-      .paramHasAttr(0, Attribute::NoAlias);
-  return false;
-}
-
-/// isIdentifiedObject - Return true if this pointer refers to a distinct and
-/// identifiable object.  This returns true for:
-///    Global Variables and Functions
-///    Allocas and Mallocs
-///    ByVal and NoAlias Arguments
-///    NoAlias returns
-///
-bool llvm::isIdentifiedObject(const Value *V) {
-  if (isa<GlobalValue>(V) || isa<AllocationInst>(V) || isNoAliasCall(V))
-    return true;
-  if (const Argument *A = dyn_cast<Argument>(V))
-    return A->hasNoAliasAttr() || A->hasByValAttr();
-  return false;
-}
-
 /// isKnownNonNull - Return true if we know that the specified value is never
 /// null.
 static bool isKnownNonNull(const Value *V) {